Hi Jan,

On Wed, Jul 29, 2026 at 11:57:25AM +0200, Jan Kara wrote:
> On Wed 29-07-26 09:40:50, Gao Xiang wrote:
> > On Tue, Jul 28, 2026 at 06:05:32PM +0200, Giuseppe Scrivano wrote:
> > > Allow userspace to pass an already-opened file descriptor as the mount
> > > source instead of a path string.  This is useful for tools that already
> > > hold an fd to the image, such as composefs reusing an existing erofs
> > > backing file.
> > > 
> > > Signed-off-by: Giuseppe Scrivano <[email protected]>
> > > ---
> > > v4: 
> > > https://lore.kernel.org/linux-fsdevel/[email protected]/
> > > v3: 
> > > https://lore.kernel.org/linux-fsdevel/[email protected]/
> > > v2: 
> > > https://lore.kernel.org/linux-fsdevel/[email protected]/
> > > v1: https://lore.kernel.org/linux-fsdevel/ak5GfvVfWLJU1EwK@debian/
> > > 
> > >  Documentation/filesystems/erofs.rst | 15 ++++++
> > >  fs/erofs/super.c                    | 73 ++++++++++++++++++++++++-----
> > >  2 files changed, 77 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/Documentation/filesystems/erofs.rst 
> > > b/Documentation/filesystems/erofs.rst
> > > index 4230884fb359..774e8b236d09 100644
> > > --- a/Documentation/filesystems/erofs.rst
> > > +++ b/Documentation/filesystems/erofs.rst
> > > @@ -139,6 +139,21 @@ inode_share            Enable inode page sharing for 
> > > this filesystem.  Inodes wi
> > >                         page cache.
> > >  ===================    
> > > =========================================================
> > >  
> > > +File-backed mounts
> > > +==================
> > > +
> > > +When CONFIG_EROFS_FS_BACKED_BY_FILE is enabled, EROFS file-backed images
> > > +can be mounted directly without a loopback block device.  The backing 
> > > file
> > > +can be given either as a path, or as an already-opened file descriptor.
> > > +
> > > +When a file descriptor is used, the kernel resolves its path and records 
> > > it
> > > +so that /proc/mounts and similar interfaces can still report the mount
> > > +source.
> > > +
> > > +Only regular files are accepted as backing files; to mount an image that
> > > +resides on a block device, use the traditional block device mount path
> > > +instead.
> > 
> > Reviewed-by: Gao Xiang <[email protected]>
> > 
> > Hi Christian, Jan, could you ack this (`fc->source` filling when
> > `source_fd` is used) if possible?
> 
> Whenever I see a use of d_path() (or file_path() in this case) I'm a bit
> watchful because its result is inherently racy and unsafe. But in this case
> the result is only used for alloc_vfsmnt() which uses it for mnt_devname so
> in the worst case we'll get an unreliable path in /proc/mounts or similar.
> I guess that's acceptable. So feel free to add:

Thanks for your reply and comment.  Yeah, the result of d_path() can become
outdated later since it only uses seqcounts to ensure that within the process,
but here I also think "mnt_devname" usage doesn't really matter (but I hope
filling like this is fine and stable in the long term.)

> 
> Acked-by: Jan Kara <[email protected]>

Thanks!

Thanks,
Gao Xiang

> 
>                                                               Honza
> -- 
> Jan Kara <[email protected]>
> SUSE Labs, CR
> 

Reply via email to