Christian Brauner [off-list ref] wrote:
quoted
quoted
If you tried to go through /proc/pid/fd with open(O_PATH), I think
you'd get
the symlink, not the target.
Then you should use fdget(), no? :)
That is unless you want fsinfo() to be useable on any fd and just fds
that are returned from the new mount-api syscalls. Maybe that wasn't
clear from my first mail.
fsinfo(), as coded, is usable on any fd, as for fstat(), statx() and
fstatfs().
I have made it such that if you do this on the fd returned by fsopen() or
fspick(), the access is diverted to the filesystem that the fs_context refers
to since querying anon_inodes is of little value.
Now, it could be argued that it should require an AT_xxx flag to cause this
diversion to happen.
Is the information returned for:
int fd = fsopen()/fspick();
fsinfo(fd);
int ofd = open("/", O_PATH);
fsinfo(ofd, ...);
the same if they refer to the same mount or would they differ?
At the moment it differs. In the former case, there may not even be a
superblock attached to the fd to query, though invariants like filesystem
parameter types and names can be queried.
David