Skip to content

Commit b953614

Browse files
committed
fhandle, pidfs: support open_by_handle_at() purely based on file handle
Various filesystems such as pidfs (and likely drm in the future) have a use-case to support opening files purely based on the handle without having to require a file descriptor to another object. That's especially the case for filesystems that don't do any lookup whatsoever and there's zero relationship between the objects. Such filesystems are also singletons that stay around for the lifetime of the system meaning that they can be uniquely identified and accessed purely based on the file handle type. Enable that so that userspace doesn't have to allocate an object needlessly especially if they can't do that for whatever reason. Link: https://lore.kernel.org/20250624-work-pidfs-fhandle-v2-10-d02a04858fe3@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 3941e37 commit b953614

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fs/fhandle.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ static int get_path_anchor(int fd, struct path *root)
188188
return 0;
189189
}
190190

191+
if (fd == FD_PIDFS_ROOT) {
192+
pidfs_get_root(root);
193+
return 0;
194+
}
195+
191196
return -EBADF;
192197
}
193198

0 commit comments

Comments
 (0)