From: Fox Chen <foxhlchen@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Fox Chen <foxhlchen@gmail.com>, gregkh@linuxfoundation.org
Subject: [PATCH] btrfs-progs: utils: fix btrfs_wipe_existing_sb probe bug
Date: Thu, 25 Mar 2021 21:10:08 +0800 [thread overview]
Message-ID: <20210325131008.105629-1-foxhlchen@gmail.com> (raw)
btrfs_wipe_existing_sb() misses calling blkid_do_fullprobe() to do
the real probe. After calling blkid_new_probe() &
blkid_probe_set_device() to setup blkid_probe context, it directly
calls blkid_probe_lookup_value(). This results in
blkid_probe_lookup_value returning -1, because pr->values is empty.
Signed-off-by: Fox Chen <foxhlchen@gmail.com>
---
common/device-utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/device-utils.c b/common/device-utils.c
index c860b946..f8e2e776 100644
--- a/common/device-utils.c
+++ b/common/device-utils.c
@@ -114,7 +114,7 @@ static int btrfs_wipe_existing_sb(int fd)
if (!pr)
return -1;
- if (blkid_probe_set_device(pr, fd, 0, 0)) {
+ if (blkid_probe_set_device(pr, fd, 0, 0) || blkid_do_fullprobe(pr)) {
ret = -1;
goto out;
}
--
2.31.0
next reply other threads:[~2021-03-25 13:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-25 13:10 Fox Chen [this message]
2021-04-09 4:32 ` [PATCH] btrfs-progs: utils: fix btrfs_wipe_existing_sb probe bug Wang Yugui
2021-04-15 6:19 ` Fox Chen
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=20210325131008.105629-1-foxhlchen@gmail.com \
--to=foxhlchen@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-btrfs@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 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).