linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix wrong superblock generation mismatch while scrubbing superblocks
@ 2013-12-02  2:52 Wang Shilong
  2013-12-02  4:01 ` Wang Shilong
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Shilong @ 2013-12-02  2:52 UTC (permalink / raw)
  To: linux-btrfs; +Cc: ochmann

While scrubbing superblocks we will check every superblock's checksum
and generation. However, checking superblock's generation may cause
some problems, this is because tree log sync only flush first superblock
, while this will cause other superblocks' generation mismatch.

We only report superblock generation mismatch if it is first superblock
or we make sure we are not doing tree log.

Reported-by: Sebastian Ochmann <ochmann@informatik.uni-bonn.de>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/scrub.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 2544805..b29a91f 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1794,8 +1794,15 @@ static int scrub_checksum_super(struct scrub_block *sblock)
 	if (sblock->pagev[0]->logical != btrfs_super_bytenr(s))
 		++fail_cor;
 
-	if (sblock->pagev[0]->generation != btrfs_super_generation(s))
-		++fail_gen;
+	if (sblock->pagev[0]->generation != btrfs_super_generation(s)) {
+		/*
+		 * we only report a generation mismatch if this is first
+		 * superblock or we can make sure we are not doing tree log.
+		 */
+		if (btrfs_super_bytenr(s) == btrfs_sb_offset(0) ||
+				!root->fs_info->log_root_tree)
+			++fail_gen;
+	}
 
 	if (memcmp(s->fsid, fs_info->fsid, BTRFS_UUID_SIZE))
 		++fail_cor;
-- 
1.8.3.1


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

end of thread, other threads:[~2013-12-02  4:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-02  2:52 [PATCH] Btrfs: fix wrong superblock generation mismatch while scrubbing superblocks Wang Shilong
2013-12-02  4:01 ` Wang Shilong

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