> > > If /home is a bind mount from, say, /data/home/ and you are watching > > > both /home and /data, you will need to figure out that they are the same > > > underlying fs and use a mount_fd of /data. > > > > My current plan is to discard any mounts which specify a root that is > > a subpath of another mount, and in the case of multiple mounts of the > > same root, pick one to move forward with (with hints from > > configuration) and only mark that one. > > > > You can also use open_by_handle() to determine if one mount > is a subtree of another. > > if you have two fds and two different fhandles from the root of two mounts > of the same fsid, only one of these commands will result in an fd with > non empty path: > fd2inmount1 = open_by_handle_at(mount1_fd, fhandle2, O_PATH); > fd1inmount2 = open_by_handle_at(mount2_fd, fhandle1, O_PATH); > > So you can throw away subtree mounts of the same fsid keeping > only one mount_fd per fsid as you traverse the mounts. > Well ,that's incorrect. You may have bind mount of non-overlapping subtrees and you may not have the root mount at all in your mount namespace. In that case, you can always keep all mount_fd's of a certain fsid and try to resolve the file handles in each one. Not optimal, but this is the information we have in events at the moment. Thanks, Amir.