linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: utils: fix btrfs_wipe_existing_sb probe bug
@ 2021-03-25 13:10 Fox Chen
  2021-04-09  4:32 ` Wang Yugui
  0 siblings, 1 reply; 3+ messages in thread
From: Fox Chen @ 2021-03-25 13:10 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Fox Chen, gregkh

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-15  6:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-25 13:10 [PATCH] btrfs-progs: utils: fix btrfs_wipe_existing_sb probe bug Fox Chen
2021-04-09  4:32 ` Wang Yugui
2021-04-15  6:19   ` Fox Chen

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).