Message ID | 20241009033151.2334888-2-hsiangkao@linux.alibaba.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v2,1/2] fs/super.c: introduce get_tree_bdev_flags() | expand |
On Wed, Oct 09, 2024 at 11:31:51AM +0800, Gao Xiang wrote: > Users can pass in an arbitrary source path for the proper type of > a mount then without "Can't lookup blockdev" error message. > > Reported-by: Allison Karlitskaya <allison.karlitskaya@redhat.com> > Closes: https://lore.kernel.org/r/CAOYeF9VQ8jKVmpy5Zy9DNhO6xmWSKMB-DO8yvBB0XvBE7=3Ugg@mail.gmail.com > Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> > --- > changes since v1: > - use new get_tree_bdev_flags(). > > fs/erofs/super.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/fs/erofs/super.c b/fs/erofs/super.c > index 666873f745da..b89836a8760d 100644 > --- a/fs/erofs/super.c > +++ b/fs/erofs/super.c > @@ -705,7 +705,9 @@ static int erofs_fc_get_tree(struct fs_context *fc) > if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) > return get_tree_nodev(fc, erofs_fc_fill_super); > > - ret = get_tree_bdev(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); Why not pass it unconditionally and provide your own more useful error message at the end of the function if you could not find any source?
Hi Christoph, On 2024/10/9 15:31, Christoph Hellwig wrote: > On Wed, Oct 09, 2024 at 11:31:51AM +0800, Gao Xiang wrote: >> Users can pass in an arbitrary source path for the proper type of >> a mount then without "Can't lookup blockdev" error message. >> >> Reported-by: Allison Karlitskaya <allison.karlitskaya@redhat.com> >> Closes: https://lore.kernel.org/r/CAOYeF9VQ8jKVmpy5Zy9DNhO6xmWSKMB-DO8yvBB0XvBE7=3Ugg@mail.gmail.com >> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> >> --- >> changes since v1: >> - use new get_tree_bdev_flags(). >> >> fs/erofs/super.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/fs/erofs/super.c b/fs/erofs/super.c >> index 666873f745da..b89836a8760d 100644 >> --- a/fs/erofs/super.c >> +++ b/fs/erofs/super.c >> @@ -705,7 +705,9 @@ static int erofs_fc_get_tree(struct fs_context *fc) >> if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) >> return get_tree_nodev(fc, erofs_fc_fill_super); >> >> - ret = get_tree_bdev(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); > > Why not pass it unconditionally and provide your own more useful > error message at the end of the function if you could not find any > source? My own (potential) concern is that if CONFIG_EROFS_FS_BACKED_BY_FILE is off, EROFS should just behave as other pure bdev fses since I'm not sure if some userspace program really relies on "Can't lookup blockdev" behavior. .. Yet that is just my own potential worry anyway. Thanks, Gao Xiang
On 2024/10/9 15:37, Gao Xiang wrote: > Hi Christoph, > ... >>> >>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c >>> index 666873f745da..b89836a8760d 100644 >>> --- a/fs/erofs/super.c >>> +++ b/fs/erofs/super.c >>> @@ -705,7 +705,9 @@ static int erofs_fc_get_tree(struct fs_context *fc) >>> if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) >>> return get_tree_nodev(fc, erofs_fc_fill_super); >>> - ret = get_tree_bdev(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); >> >> Why not pass it unconditionally and provide your own more useful >> error message at the end of the function if you could not find any >> source? > > My own (potential) concern is that if CONFIG_EROFS_FS_BACKED_BY_FILE > is off, EROFS should just behave as other pure bdev fses since I'm > not sure if some userspace program really relies on > "Can't lookup blockdev" behavior. > > .. Yet that is just my own potential worry anyway. Many thanks all for the review... So I guess it sounds fine? Hi Christian, If they also look good to you, since it's a VFS change, if possible, could you apply these two patches through the VFS tree for this cycle? There is a redundant blank line removal in the first patch, I guess you could help adjust or I need to submit another version? I also have another related fix in erofs tree to address a syzbot issue https://lore.kernel.org/r/20240917130803.32418-1-hsiangkao@linux.alibaba.com but it shouldn't cause any conflict with the second patch though.. Thanks, Gao Xiang > > Thanks, > Gao Xiang >
diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 666873f745da..b89836a8760d 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -705,7 +705,9 @@ static int erofs_fc_get_tree(struct fs_context *fc) if (IS_ENABLED(CONFIG_EROFS_FS_ONDEMAND) && sbi->fsid) return get_tree_nodev(fc, erofs_fc_fill_super); - ret = get_tree_bdev(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); #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE if (ret == -ENOTBLK) { if (!fc->source)
Users can pass in an arbitrary source path for the proper type of a mount then without "Can't lookup blockdev" error message. Reported-by: Allison Karlitskaya <allison.karlitskaya@redhat.com> Closes: https://lore.kernel.org/r/CAOYeF9VQ8jKVmpy5Zy9DNhO6xmWSKMB-DO8yvBB0XvBE7=3Ugg@mail.gmail.com Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> --- changes since v1: - use new get_tree_bdev_flags(). fs/erofs/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)