From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>
Cc: Allison Karlitskaya <allison.karlitskaya@redhat.com>,
Chao Yu <chao@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org,
Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH 2/2] erofs: use get_tree_bdev_by_dev() to avoid misleading messages
Date: Tue, 8 Oct 2024 17:56:06 +0800 [thread overview]
Message-ID: <20241008095606.990466-2-hsiangkao@linux.alibaba.com> (raw)
In-Reply-To: <20241008095606.990466-1-hsiangkao@linux.alibaba.com>
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>
---
fs/erofs/super.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index 666873f745da..04a5873c1594 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -700,16 +700,19 @@ 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;
+ dev_t dev;
int ret;
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);
+ if (!fc->source)
+ return invalf(fc, "No source specified");
+ ret = lookup_bdev(fc->source, &dev);
+ if (!ret)
+ return get_tree_bdev_by_dev(fc, erofs_fc_fill_super, dev);
#ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
if (ret == -ENOTBLK) {
- if (!fc->source)
- return invalf(fc, "No source specified");
sbi->fdev = filp_open(fc->source, O_RDONLY | O_LARGEFILE, 0);
if (IS_ERR(sbi->fdev))
return PTR_ERR(sbi->fdev);
--
2.43.5
next prev parent reply other threads:[~2024-10-08 9:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 9:56 [PATCH 1/2] fs/super.c: introduce get_tree_bdev_by_dev() Gao Xiang
2024-10-08 9:56 ` Gao Xiang [this message]
2024-10-08 11:49 ` Christoph Hellwig
2024-10-08 12:10 ` Gao Xiang
2024-10-08 12:23 ` Christoph Hellwig
2024-10-08 12:33 ` Gao Xiang
2024-10-08 12:55 ` Christoph Hellwig
2024-10-08 13:12 ` 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=20241008095606.990466-2-hsiangkao@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=allison.karlitskaya@redhat.com \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=jack@suse.cz \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).