Re: [PATCH] Btrfs: fix wrong superblock generation mismatch while scrubbing superblocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/02/2013 10:52 AM, Wang Shilong wrote:
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.
I am sorry, My miss, this is not true, because tree log won't update superblock's
generation. I will try to track this issue as soon as possible.


Reported-by: Sebastian Ochmann <ochmann@xxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Wang Shilong <wangsl.fnst@xxxxxxxxxxxxxx>
Reviewed-by: Miao Xie <miaox@xxxxxxxxxxxxxx>
Miao is innocent, he found my fault as soon as possible.
don't blame him.

---
  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;

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux