From: Giuseppe Scrivano <gscrivan@redhat.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org, cyphar@cyphar.com,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3] erofs: accept source file descriptor via fsconfig
Date: Fri, 17 Jul 2026 10:28:04 +0200 [thread overview]
Message-ID: <87cxwm2f6z.fsf@redhat.com> (raw)
In-Reply-To: <a3ee4538-6273-4d25-90d0-8dbaac092a38@linux.alibaba.com> (Gao Xiang's message of "Fri, 17 Jul 2026 11:42:39 +0800")
Gao Xiang <hsiangkao@linux.alibaba.com> writes:
> Hi Giuseppe,
>
> On 2026/7/14 23:48, 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 <gscrivan@redhat.com>
>
> Use the current erofs-utils testsuite, the following tests seems skipped incorrectly.
>
> [Error 22] Invalid argument
> SKIP: erofs/008
> [Error 22] Invalid argument
> SKIP: erofs/009
> [Error 22] Invalid argument
> SKIP: erofs/010
> [Error 22] Invalid argument
> SKIP: erofs/011
>
> [Error 22] Invalid argument
> SKIP: erofs/017
> [Error 22] Invalid argument
> SKIP: erofs/018
>
> And the kernel message shows:
> [ 116.477816] erofs: source is unsupported
> ...
>
> git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git -b experimental-tests
> $ sudo make check
>
> Thanks,
> Gao Xiang
it seems to be caused by the different error returned by erofs_fc_get_tree.
Would you be fine if I amend this on top of v3?
Thanks,
Giuseppe
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index d7baf9f34dc0..829ae530d7ca 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -791,17 +791,22 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
static int erofs_fc_get_tree(struct fs_context *fc)
{
struct erofs_sb_info *sbi = fc->s_fs_info;
- struct file *file = sbi->dif0.file;
+ int ret;
- if (!IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) || !file) {
- int ret;
+ if (IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) && sbi->dif0.file) {
+ if (!S_ISREG(file_inode(sbi->dif0.file)->i_mode) ||
+ !sbi->dif0.file->f_mapping->a_ops->read_folio) {
+ errorfc(fc, "source is unsupported");
+ return -EINVAL;
+ }
+ return get_tree_nodev(fc, erofs_fc_fill_super);
+ }
- ret = get_tree_bdev_flags(fc, erofs_fc_fill_super,
- IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) ?
- GET_TREE_BDEV_QUIET_LOOKUP : 0);
- if (!IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) ||
- ret != -ENOTBLK)
- return ret;
+ ret = get_tree_bdev_flags(fc, erofs_fc_fill_super,
+ IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) ?
+ GET_TREE_BDEV_QUIET_LOOKUP : 0);
+ if (IS_ENABLED(CONFIG_EROFS_FS_BACKED_BY_FILE) && ret == -ENOTBLK) {
+ struct file *file;
if (!fc->source)
return invalf(fc, "No source specified");
@@ -809,13 +814,12 @@ static int erofs_fc_get_tree(struct fs_context *fc)
if (IS_ERR(file))
return PTR_ERR(file);
sbi->dif0.file = file;
+
+ if (S_ISREG(file_inode(sbi->dif0.file)->i_mode) &&
+ sbi->dif0.file->f_mapping->a_ops->read_folio)
+ return get_tree_nodev(fc, erofs_fc_fill_super);
}
- if (!S_ISREG(file_inode(file)->i_mode) ||
- !file->f_mapping->a_ops->read_folio) {
- errorfc(fc, "source is unsupported");
- return -EINVAL;
- }
- return get_tree_nodev(fc, erofs_fc_fill_super);
+ return ret;
}
static int erofs_fc_reconfigure(struct fs_context *fc)
next prev parent reply other threads:[~2026-07-17 8:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 15:48 [PATCH v3] erofs: accept source file descriptor via fsconfig Giuseppe Scrivano
2026-07-17 3:42 ` Gao Xiang
2026-07-17 8:28 ` Giuseppe Scrivano [this message]
2026-07-17 8:37 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87cxwm2f6z.fsf@redhat.com \
--to=gscrivan@redhat.com \
--cc=cyphar@cyphar.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.