Re: open_by_handle_at() in userns
From: J. Bruce Fields <hidden>
Date: 2021-04-08 16:08:47
Also in:
linux-fsdevel
On Thu, Apr 08, 2021 at 06:54:52PM +0300, Amir Goldstein wrote:
They are understood to me :) but I didn't want to get into it, because it is complicated to explain and I wasn't sure if anyone cared... I started working on open_by_handle_at() in userns for fanotify and fanotify mostly reports directory fhandle, so no issues with cross-directory renames. In any case, fanotify never reports "connectable" non-dir file handles. Because my proposed change ALSO makes it possible to start talking about userspace nfs server inside userns (in case anyone cares), I wanted to lay out the path towards a userspace "subtree_check" like solution.
We have to support subdirectory exports and subtree checking because we already have, but, FWIW, if I were writing a new NFS server from scratch, I don't think I would. It's poorly understood, and the effort would be better spent on more flexible storage management. --b.
Another thing I am contemplating is, if and when idmapped mount support is added to overlayfs, we can store an additional "connectable" file handle in the overlayfs index (whose key is the non-connectable fhandle) and fix ovl_acceptable() similar to nfsd_acceptable() and then we will be able to mount an overlayfs inside userns with nfs_export support. I've included a two liner patch on the fhandle_userns branch to allow overlayfs inside userns with nfs_export support in the case that underlying filesystem was mounted inside userns, but that is not such an interesting use case IMO. Thanks, Amir.