Re: [PATCH v5] erofs: accept source file descriptor via fsconfig

Gao Xiang <[email protected]> Tue, 4 Aug 2026 07:37:25 +0800
Newsgroups org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
On Mon, Aug 03, 2026 at 02:01:41PM +0200, Giuseppe Scrivano wrote:
> Chao Yu <[email protected]> writes:
>=20
> > On 7/29/26 00:05, Giuseppe Scrivano wrote:
> >> Allow userspace to pass an already-opened file descriptor as the moun=
t
> >> source instead of a path string.  This is useful for tools that alrea=
dy
> >> 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/20260717134147.1602735-1-gs=
[email protected]/
> >> v3: https://lore.kernel.org/linux-fsdevel/20260714154917.489993-1-gsc=
[email protected]/
> >> v2: https://lore.kernel.org/linux-fsdevel/20260711071137.4130824-1-gs=
[email protected]/
> >> v1: https://lore.kernel.org/linux-fsdevel/ak5GfvVfWLJU1EwK@debian/
> >>   Documentation/filesystems/erofs.rst | 15 ++++++
> >>   fs/erofs/super.c                    | 73 ++++++++++++++++++++++++--=
=2D--
> >>   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.
> >>   =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D    =3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
> >>   +File-backed mounts
> >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> >> +
> >> +When CONFIG_EROFS_FS_BACKED_BY_FILE is enabled, EROFS file-backed im=
ages
> >> +can be mounted directly without a loopback block device.  The backin=
g file
> >> +can be given either as a path, or as an already-opened file descript=
or.
> >> +
> >> +When a file descriptor is used, the kernel resolves its path and rec=
ords it
> >> +so that /proc/mounts and similar interfaces can still report the mou=
nt
> >> +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 pa=
th
> >> +instead.
> >
> > Do we need to add an entry to describe the new mount option source=3D =
in
> > "Mount options" section in erofs.rst?
> >
> > Thanks,
>=20
> I've another patch "erofs: reuse superblock for file-backed mounts" that
> also touches erofs.rst and it is currently based on top of this version.
> I wonder what is your preferred way to handle them.

EROFS dev branch usually has a small number of patches. Since Chao gave
a new suggestion, I think a v6 is needed (but you could add all
previous reviewed-by:).

And "erofs: reuse superblock for file-backed mounts" needs to be rebased
too, I will find time to play with it this week (or you could add a
testcase in erofs-utils experimental-tests if you have time.)

>=20
> Will maintainers deal with conflicts or do I need to submit them as a
> single series?
>=20
> Do you prefer a new submission v6 with the following fixup?
>=20
> diff --git a/Documentation/filesystems/erofs.rst b/Documentation/filesys=
tems/erofs.rst
> index c972a869f3e9..49c4e7dbc5d6 100644
> --- a/Documentation/filesystems/erofs.rst
> +++ b/Documentation/filesystems/erofs.rst
> @@ -137,6 +137,8 @@ fsoffset=3D%llu          Specify block-aligned files=
ystem offset for the primary d
>  inode_share            Enable inode page sharing for this filesystem.  =
Inodes with
>                         identical content within the same domain ID can =
share the
>                         page cache.
> +source=3D%s              (For file-backed mounts) Specify the backing i=
mage as a path
> +                       or as an already-opened file descriptor.

Not quite sure "an already-opened file descriptor" is "%s", but I'm fine
since it's quite a minor one (it's unneeded to nitpick the
documentation).

Thanks,
Gao Xiang


>=20
> Thanks,
> Giuseppe
>=20
>=20