[v2,1/3] btrfs-progs: check/lowmem: Fix the incorrect error message of check_extent_data_item
diff mbox

Message ID 20180228101323.25442-1-lufq.fnst@cn.fujitsu.com
State New
Headers show

Commit Message

Lu Fengqi Feb. 28, 2018, 10:13 a.m. UTC
Instead of the disk_bytenr and disk_num_bytes of the extent_item which the
file extent references, we should output the objectid and offset of the
file extent. And the leaf may be shared by the file trees, we should print
the objectid of the root and the owner of the leaf.

Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree")
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
V2: Output the objectid of the root and the owner of the leaf.

 check/mode-lowmem.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Lu Fengqi Feb. 28, 2018, 10:13 a.m. UTC | #1
Add the testcase for false alert of data extent backref lost with the
extent offset.

The image can be reproduced by the following commands:
------
dev=~/test.img
mnt=/mnt/btrfs

umount $mnt &> /dev/null
fallocate -l 128M $dev

mkfs.btrfs $dev
mount $dev $mnt

for i in `seq 1 10`; do
	xfs_io -f -c "pwrite 0 2K" $mnt/file$i
done

xfs_io -f -c "falloc 0 64K" $mnt/file11

for i in `seq 1 32`; do
	xfs_io -f -c "reflink $mnt/file11 0 $(($i * 64))K 64K" $mnt/file11
done

xfs_io -f -c "reflink $mnt/file11 32K $((33 * 64))K 32K" $mnt/file11

btrfs subvolume snapshot $mnt $mnt/snap1

umount $mnt
btrfs-image -c9 $dev extent_data_ref.img
------

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 .../fsck-tests/020-extent-ref-cases/extent_data_ref.img  | Bin 0 -> 6144 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 tests/fsck-tests/020-extent-ref-cases/extent_data_ref.img

diff --git a/tests/fsck-tests/020-extent-ref-cases/extent_data_ref.img b/tests/fsck-tests/020-extent-ref-cases/extent_data_ref.img
new file mode 100644
index 0000000000000000000000000000000000000000..3ab2396ba9c810d98f16a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I0u{eh^?hAla$<8phJ_iTIvsQl87
z7fh3tg=l-h5^sMQjZ%hw*Js@yjSBXjC4sVGqv)XzOD|EawsU&r>9clu<yo_`thO^i
a{m_i3m!>iDz<<x=x92wlzZv+iVBjBP`o6jV

literal 0
HcmV?d00001
Qu Wenruo March 8, 2018, 8:12 a.m. UTC | #2
On 2018年02月28日 18:13, Lu Fengqi wrote:
> Add the testcase for false alert of data extent backref lost with the
> extent offset.
> 
> The image can be reproduced by the following commands:
> ------
> dev=~/test.img
> mnt=/mnt/btrfs
> 
> umount $mnt &> /dev/null
> fallocate -l 128M $dev
> 
> mkfs.btrfs $dev
> mount $dev $mnt
> 
> for i in `seq 1 10`; do
> 	xfs_io -f -c "pwrite 0 2K" $mnt/file$i
> done
> 
> xfs_io -f -c "falloc 0 64K" $mnt/file11
> 
> for i in `seq 1 32`; do
> 	xfs_io -f -c "reflink $mnt/file11 0 $(($i * 64))K 64K" $mnt/file11
> done
> 
> xfs_io -f -c "reflink $mnt/file11 32K $((33 * 64))K 32K" $mnt/file11
> 
> btrfs subvolume snapshot $mnt $mnt/snap1
> 
> umount $mnt
> btrfs-image -c9 $dev extent_data_ref.img
> ------
> 

The image reproducer looks good.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu


> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> ---
>  .../fsck-tests/020-extent-ref-cases/extent_data_ref.img  | Bin 0 -> 6144 bytes
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  create mode 100644 tests/fsck-tests/020-extent-ref-cases/extent_data_ref.img
> 
> diff --git a/tests/fsck-tests/020-extent-ref-cases/extent_data_ref.img b/tests/fsck-tests/020-extent-ref-cases/extent_data_ref.img
> new file mode 100644
> index 0000000000000000000000000000000000000000..3ab2396ba9c810d98f16a5efcf7fe23ee4b12ab5
> GIT binary patch
> literal 6144
> zcmeHKhgXx!wg;pLB1&(OB2^R<s&u7D4NVA02^bDdib(G@AW9MG2$7D`0)jxKg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J_iTIvsQl87
> z7fh3tg=l-h5^sMQjZ%hw*Js@yjSBXjC4sVGqv)XzOD|EawsU&r>9clu<yo_`thO^i
> a{m_i3m!>iDz<<x=x92wlzZv+iVBjBP`o6jV
> 
> literal 0
> HcmV?d00001
>
Qu Wenruo March 8, 2018, 8:13 a.m. UTC | #3
On 2018年02月28日 18:13, Lu Fengqi wrote:
> Instead of the disk_bytenr and disk_num_bytes of the extent_item which the
> file extent references, we should output the objectid and offset of the
> file extent. And the leaf may be shared by the file trees, we should print
> the objectid of the root and the owner of the leaf.
> 
> Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree")
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> ---
> V2: Output the objectid of the root and the owner of the leaf.
> 
>  check/mode-lowmem.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
> index 62bcf3d2e126..f37b1b2c1571 100644
> --- a/check/mode-lowmem.c
> +++ b/check/mode-lowmem.c
> @@ -2631,9 +2631,9 @@ static int check_extent_data_item(struct btrfs_root *root,
>  
>  	if (!(extent_flags & BTRFS_EXTENT_FLAG_DATA)) {
>  		error(
> -		    "extent[%llu %llu] backref type mismatch, wanted bit: %llx",
> -		    disk_bytenr, disk_num_bytes,
> -		    BTRFS_EXTENT_FLAG_DATA);
> +"file extent[%llu %llu] root %llu owner %llu backref type mismatch, wanted bit: %llx",
> +			fi_key.objectid, fi_key.offset, root->objectid, owner,

Indeed this is much easier to identify the problem.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> +			BTRFS_EXTENT_FLAG_DATA);
>  		err |= BACKREF_MISMATCH;
>  	}
>  
> @@ -2722,8 +2722,9 @@ out:
>  		err |= BACKREF_MISSING;
>  	btrfs_release_path(&path);
>  	if (err & BACKREF_MISSING) {
> -		error("data extent[%llu %llu] backref lost",
> -		      disk_bytenr, disk_num_bytes);
> +		error(
> +		"file extent[%llu %llu] root %llu owner %llu backref lost",
> +			fi_key.objectid, fi_key.offset, root->objectid, owner);
>  	}
>  	return err;
>  }
>
David Sterba March 9, 2018, 4:18 p.m. UTC | #4
On Thu, Mar 08, 2018 at 04:13:27PM +0800, Qu Wenruo wrote:
> 
> 
> On 2018年02月28日 18:13, Lu Fengqi wrote:
> > Instead of the disk_bytenr and disk_num_bytes of the extent_item which the
> > file extent references, we should output the objectid and offset of the
> > file extent. And the leaf may be shared by the file trees, we should print
> > the objectid of the root and the owner of the leaf.
> > 
> > Fixes: b0d360b541f0 ("btrfs-progs: check: introduce function to check data backref in extent tree")
> > Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> > ---
> > V2: Output the objectid of the root and the owner of the leaf.
> > 
> >  check/mode-lowmem.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
> > index 62bcf3d2e126..f37b1b2c1571 100644
> > --- a/check/mode-lowmem.c
> > +++ b/check/mode-lowmem.c
> > @@ -2631,9 +2631,9 @@ static int check_extent_data_item(struct btrfs_root *root,
> >  
> >  	if (!(extent_flags & BTRFS_EXTENT_FLAG_DATA)) {
> >  		error(
> > -		    "extent[%llu %llu] backref type mismatch, wanted bit: %llx",
> > -		    disk_bytenr, disk_num_bytes,
> > -		    BTRFS_EXTENT_FLAG_DATA);
> > +"file extent[%llu %llu] root %llu owner %llu backref type mismatch, wanted bit: %llx",
> > +			fi_key.objectid, fi_key.offset, root->objectid, owner,
> 
> Indeed this is much easier to identify the problem.
> 
> Reviewed-by: Qu Wenruo <wqu@suse.com>

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

Patch
diff mbox

diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 62bcf3d2e126..f37b1b2c1571 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -2631,9 +2631,9 @@  static int check_extent_data_item(struct btrfs_root *root,
 
 	if (!(extent_flags & BTRFS_EXTENT_FLAG_DATA)) {
 		error(
-		    "extent[%llu %llu] backref type mismatch, wanted bit: %llx",
-		    disk_bytenr, disk_num_bytes,
-		    BTRFS_EXTENT_FLAG_DATA);
+"file extent[%llu %llu] root %llu owner %llu backref type mismatch, wanted bit: %llx",
+			fi_key.objectid, fi_key.offset, root->objectid, owner,
+			BTRFS_EXTENT_FLAG_DATA);
 		err |= BACKREF_MISMATCH;
 	}
 
@@ -2722,8 +2722,9 @@  out:
 		err |= BACKREF_MISSING;
 	btrfs_release_path(&path);
 	if (err & BACKREF_MISSING) {
-		error("data extent[%llu %llu] backref lost",
-		      disk_bytenr, disk_num_bytes);
+		error(
+		"file extent[%llu %llu] root %llu owner %llu backref lost",
+			fi_key.objectid, fi_key.offset, root->objectid, owner);
 	}
 	return err;
 }