From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] btrfs-progs: lowmem-check: Fix false alert on dropped leaf
Date: Wed, 18 Jan 2017 13:21:07 +0800 [thread overview]
Message-ID: <20170118052107.7394-1-quwenruo@cn.fujitsu.com> (raw)
For btrfs-progs test case 021-partially-dropped-snapshot-case, if the
first leaf is already dropped, btrfs check low-memory mode will report
false alert:
checking fs roots
checksum verify failed on 29917184 found E4E3BDB6 wanted 00000000
checksum verify failed on 29917184 found E4E3BDB6 wanted 00000000
checksum verify failed on 29917184 found E4E3BDB6 wanted 00000000
checksum verify failed on 29917184 found E4E3BDB6 wanted 00000000
This is caused by we are calling check_fs_first_inode() function,
unlike the rest part of check_fs_root_v2(), it doesn't have enough check
on dropping progress, and caused the false alert.
Fix it by checking dropping progress before searching slot.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
cmds-check.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/cmds-check.c b/cmds-check.c
index 1dba2985..25247fd9 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -4939,11 +4939,18 @@ static int check_fs_first_inode(struct btrfs_root *root, unsigned int ext_ref)
int err = 0;
int ret;
- btrfs_init_path(&path);
key.objectid = BTRFS_FIRST_FREE_OBJECTID;
key.type = BTRFS_INODE_ITEM_KEY;
key.offset = 0;
+ /* For root being dropped, we don't need to check first inode */
+ if (btrfs_root_refs(&root->root_item) == 0 &&
+ btrfs_disk_key_objectid(&root->root_item.drop_progress) >=
+ key.objectid)
+ return 0;
+
+ btrfs_init_path(&path);
+
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
if (ret < 0)
goto out;
--
2.11.0
next reply other threads:[~2017-01-18 5:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-18 5:21 Qu Wenruo [this message]
2017-01-20 18:21 ` [PATCH] btrfs-progs: lowmem-check: Fix false alert on dropped leaf David Sterba
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=20170118052107.7394-1-quwenruo@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--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).