linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: fsck: Fix a false metadata extent warning
@ 2016-03-31  2:19 Qu Wenruo
  2016-03-31 16:30 ` David Sterba
  0 siblings, 1 reply; 11+ messages in thread
From: Qu Wenruo @ 2016-03-31  2:19 UTC (permalink / raw)
  To: linux-btrfs

At least 2 user from mail list reported btrfsck reported false alert of
"bad metadata [XXXX,YYYY) crossing stripe boundary".

While the reported number are all inside the same 64K boundary.
After some check, all the false alert have the same bytenr feature,
which can be divided by stripe size (64K).

The result seems to be initial 'max_size' can be 0, causing 'start' +
'max_size' - 1, to cross the stripe boundary.

Fix it by always update extent_record->cross_stripe when the
extent_record is updated, to avoid temporary false alert to be reported.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 cmds-check.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index d157075..ef23ddb 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -4579,9 +4579,9 @@ static int add_extent_rec(struct cache_tree *extent_cache,
 		 * As now stripe_len is fixed to BTRFS_STRIPE_LEN, just check
 		 * it.
 		 */
-		if (metadata && check_crossing_stripes(rec->start,
-						       rec->max_size))
-				rec->crossing_stripes = 1;
+		if (metadata)
+			rec->crossing_stripes = check_crossing_stripes(
+					rec->start, rec->max_size);
 		check_extent_type(rec);
 		maybe_free_extent_rec(extent_cache, rec);
 		return ret;
@@ -4641,8 +4641,8 @@ static int add_extent_rec(struct cache_tree *extent_cache,
 	}
 
 	if (metadata)
-		if (check_crossing_stripes(rec->start, rec->max_size))
-			rec->crossing_stripes = 1;
+		rec->crossing_stripes = check_crossing_stripes(rec->start,
+				rec->max_size);
 	check_extent_type(rec);
 	return ret;
 }
-- 
2.7.4




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

end of thread, other threads:[~2016-04-05  8:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31  2:19 [PATCH] btrfs-progs: fsck: Fix a false metadata extent warning Qu Wenruo
2016-03-31 16:30 ` David Sterba
2016-04-01  0:28   ` Qu Wenruo
2016-04-01  8:44     ` David Sterba
2016-04-01  8:50       ` Qu Wenruo
2016-04-01 11:39         ` David Sterba
2016-04-01 12:09           ` Qu Wenruo
2016-04-01 12:48             ` David Sterba
2016-04-04 11:18         ` David Sterba
2016-04-05  1:28           ` Qu Wenruo
2016-04-05  8:43             ` David Sterba

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