All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag
@ 2015-11-25  6:19 Qu Wenruo
  2015-11-26 14:27 ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Qu Wenruo @ 2015-11-25  6:19 UTC (permalink / raw)
  To: linux-btrfs; +Cc: calestyo

In process_extent_item(), it gives 'metadata' initial value 0, but for
non-skinny-metadata case, metadata extent can't be judged just from key
type and it forgot that case.

This causes a lot of false alert in non-skinny-metadata filesystem.

Fix it by set correct metadata value before calling add_extent_rec().

Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
v2:
   Use bit AND instead of equal to check TREE_BLOCK bit.
---
 cmds-check.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index fd661d9..938b863 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -5134,6 +5134,10 @@ static int process_extent_item(struct btrfs_root *root,
 
 	ei = btrfs_item_ptr(eb, slot, struct btrfs_extent_item);
 	refs = btrfs_extent_refs(eb, ei);
+	if (btrfs_extent_flags(eb, ei) & BTRFS_EXTENT_FLAG_TREE_BLOCK)
+		metadata = 1;
+	else
+		metadata = 0;
 
 	add_extent_rec(extent_cache, NULL, 0, key.objectid, num_bytes,
 		       refs, 0, 0, 0, metadata, 1, num_bytes);
-- 
2.6.2


-- 
This message has been scanned for viruses and
dangerous content by Fujitsu, and is believed to be clean.


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

* Re: [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag
  2015-11-25  6:19 [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag Qu Wenruo
@ 2015-11-26 14:27 ` David Sterba
  2015-11-26 15:20   ` Christoph Anton Mitterer
  0 siblings, 1 reply; 5+ messages in thread
From: David Sterba @ 2015-11-26 14:27 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, calestyo

On Wed, Nov 25, 2015 at 02:19:06PM +0800, Qu Wenruo wrote:
> In process_extent_item(), it gives 'metadata' initial value 0, but for
> non-skinny-metadata case, metadata extent can't be judged just from key
> type and it forgot that case.
> 
> This causes a lot of false alert in non-skinny-metadata filesystem.
> 
> Fix it by set correct metadata value before calling add_extent_rec().
> 
> Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Patch replaced, thanks. The test image is pushed as well.

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

* Re: [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag
  2015-11-26 14:27 ` David Sterba
@ 2015-11-26 15:20   ` Christoph Anton Mitterer
  2015-11-27  0:40     ` Qu Wenruo
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Anton Mitterer @ 2015-11-26 15:20 UTC (permalink / raw)
  To: dsterba, Qu Wenruo; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

Hey.

I can confirm that the new patch fixes the issue on both test
filesystems.

Thanks for working that out. I guess there's no longer a need to keep
that old filesystems now?!

Cheers,
Chris.

On Thu, 2015-11-26 at 15:27 +0100, David Sterba wrote:
> On Wed, Nov 25, 2015 at 02:19:06PM +0800, Qu Wenruo wrote:
> > In process_extent_item(), it gives 'metadata' initial value 0, but
> > for
> > non-skinny-metadata case, metadata extent can't be judged just from
> > key
> > type and it forgot that case.
> > 
> > This causes a lot of false alert in non-skinny-metadata filesystem.
> > 
> > Fix it by set correct metadata value before calling
> > add_extent_rec().
> > 
> > Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
> > Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> 
> Patch replaced, thanks. The test image is pushed as well.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5313 bytes --]

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

* Re: [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag
  2015-11-26 15:20   ` Christoph Anton Mitterer
@ 2015-11-27  0:40     ` Qu Wenruo
  2015-11-27  0:54       ` Christoph Anton Mitterer
  0 siblings, 1 reply; 5+ messages in thread
From: Qu Wenruo @ 2015-11-27  0:40 UTC (permalink / raw)
  To: Christoph Anton Mitterer, dsterba; +Cc: linux-btrfs



Christoph Anton Mitterer wrote on 2015/11/26 16:20 +0100:
> Hey.
>
> I can confirm that the new patch fixes the issue on both test
> filesystems.
>
> Thanks for working that out. I guess there's no longer a need to keep
> that old filesystems now?!

Of course no need to keep.
But since there is no real error, feel free to keep using it or just re 
format it with skinny-metadata.

Thanks,
Qu

>
> Cheers,
> Chris.
>
> On Thu, 2015-11-26 at 15:27 +0100, David Sterba wrote:
>> On Wed, Nov 25, 2015 at 02:19:06PM +0800, Qu Wenruo wrote:
>>> In process_extent_item(), it gives 'metadata' initial value 0, but
>>> for
>>> non-skinny-metadata case, metadata extent can't be judged just from
>>> key
>>> type and it forgot that case.
>>>
>>> This causes a lot of false alert in non-skinny-metadata filesystem.
>>>
>>> Fix it by set correct metadata value before calling
>>> add_extent_rec().
>>>
>>> Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
>>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>>
>> Patch replaced, thanks. The test image is pushed as well.



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

* Re: [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag
  2015-11-27  0:40     ` Qu Wenruo
@ 2015-11-27  0:54       ` Christoph Anton Mitterer
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Anton Mitterer @ 2015-11-27  0:54 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

On Fri, 2015-11-27 at 08:40 +0800, Qu Wenruo wrote:
> But since there is no real error
sure... 

> feel free to keep using it or just re 
> format it with skinny-metadata.
That's just onging =)

Thanks for all your efforts in that issue =)


Chris.

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5313 bytes --]

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

end of thread, other threads:[~2015-11-27  0:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25  6:19 [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag Qu Wenruo
2015-11-26 14:27 ` David Sterba
2015-11-26 15:20   ` Christoph Anton Mitterer
2015-11-27  0:40     ` Qu Wenruo
2015-11-27  0:54       ` Christoph Anton Mitterer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.