* [PATCH] btrfs-progs: fix false alert on tree block crossing 64K page boundary
@ 2021-03-06 0:40 Qu Wenruo
2021-03-06 2:01 ` Wang Yugui
2021-03-09 14:24 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2021-03-06 0:40 UTC (permalink / raw)
To: linux-btrfs; +Cc: Wang Yugui
[BUG]
When btrfs-check is executed on even newly created fs, it can report
tree blocks crossing 64K page boundary like this:
Opening filesystem to check...
Checking filesystem on /dev/test/test
UUID: 80d734c8-dcbc-411b-9623-a10bd9e7767f
[1/7] checking root items
[2/7] checking extents
WARNING: tree block [30523392, 30539776) crosses 64K page boudnary, may cause problem for 64K page system
[3/7] checking free space cache
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups skipped (not enabled on this FS)
found 131072 bytes used, no error found
total csum bytes: 0
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 125199
file data blocks allocated: 0
referenced 0
[CAUSE]
Tree block [30523392, 30539776) is at the last 16K slot of page.
As 30523392 % 65536 = 49152, and 30539776 % 65536 = 0.
The cross boundary check is using exclusive end, which causes false
alerts.
[FIX]
Use inclusive end to do the cross 64K boundary check.
Reported-by: Wang Yugui <wangyugui@e16-tech.com>
Fixes: fc38ae7f4826 ("btrfs-progs: check: detect and warn about tree blocks crossing 64K page boundary")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
check/mode-common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/check/mode-common.h b/check/mode-common.h
index 8fdeb7f6be0a..3107b00c48bf 100644
--- a/check/mode-common.h
+++ b/check/mode-common.h
@@ -186,7 +186,7 @@ int get_extent_item_generation(u64 bytenr, u64 *gen_ret);
static inline void btrfs_check_subpage_eb_alignment(u64 start, u32 len)
{
if (start / BTRFS_MAX_METADATA_BLOCKSIZE !=
- (start + len) / BTRFS_MAX_METADATA_BLOCKSIZE)
+ (start + len - 1) / BTRFS_MAX_METADATA_BLOCKSIZE)
warning(
"tree block [%llu, %llu) crosses 64K page boudnary, may cause problem for 64K page system",
start, start + len);
--
2.30.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: fix false alert on tree block crossing 64K page boundary
2021-03-06 0:40 [PATCH] btrfs-progs: fix false alert on tree block crossing 64K page boundary Qu Wenruo
@ 2021-03-06 2:01 ` Wang Yugui
2021-03-09 14:24 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Wang Yugui @ 2021-03-06 2:01 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs
Hi,
It passed the test. Thanks a lot.
Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2021/03/06
> [BUG]
> When btrfs-check is executed on even newly created fs, it can report
> tree blocks crossing 64K page boundary like this:
>
> Opening filesystem to check...
> Checking filesystem on /dev/test/test
> UUID: 80d734c8-dcbc-411b-9623-a10bd9e7767f
> [1/7] checking root items
> [2/7] checking extents
> WARNING: tree block [30523392, 30539776) crosses 64K page boudnary, may cause problem for 64K page system
> [3/7] checking free space cache
> [4/7] checking fs roots
> [5/7] checking only csums items (without verifying data)
> [6/7] checking root refs
> [7/7] checking quota groups skipped (not enabled on this FS)
> found 131072 bytes used, no error found
> total csum bytes: 0
> total tree bytes: 131072
> total fs tree bytes: 32768
> total extent tree bytes: 16384
> btree space waste bytes: 125199
> file data blocks allocated: 0
> referenced 0
>
> [CAUSE]
> Tree block [30523392, 30539776) is at the last 16K slot of page.
> As 30523392 % 65536 = 49152, and 30539776 % 65536 = 0.
>
> The cross boundary check is using exclusive end, which causes false
> alerts.
>
> [FIX]
> Use inclusive end to do the cross 64K boundary check.
>
> Reported-by: Wang Yugui <wangyugui@e16-tech.com>
> Fixes: fc38ae7f4826 ("btrfs-progs: check: detect and warn about tree blocks crossing 64K page boundary")
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> check/mode-common.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/check/mode-common.h b/check/mode-common.h
> index 8fdeb7f6be0a..3107b00c48bf 100644
> --- a/check/mode-common.h
> +++ b/check/mode-common.h
> @@ -186,7 +186,7 @@ int get_extent_item_generation(u64 bytenr, u64 *gen_ret);
> static inline void btrfs_check_subpage_eb_alignment(u64 start, u32 len)
> {
> if (start / BTRFS_MAX_METADATA_BLOCKSIZE !=
> - (start + len) / BTRFS_MAX_METADATA_BLOCKSIZE)
> + (start + len - 1) / BTRFS_MAX_METADATA_BLOCKSIZE)
> warning(
> "tree block [%llu, %llu) crosses 64K page boudnary, may cause problem for 64K page system",
> start, start + len);
> --
> 2.30.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: fix false alert on tree block crossing 64K page boundary
2021-03-06 0:40 [PATCH] btrfs-progs: fix false alert on tree block crossing 64K page boundary Qu Wenruo
2021-03-06 2:01 ` Wang Yugui
@ 2021-03-09 14:24 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2021-03-09 14:24 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, Wang Yugui
On Sat, Mar 06, 2021 at 08:40:19AM +0800, Qu Wenruo wrote:
> [BUG]
> When btrfs-check is executed on even newly created fs, it can report
> tree blocks crossing 64K page boundary like this:
>
> Opening filesystem to check...
> Checking filesystem on /dev/test/test
> UUID: 80d734c8-dcbc-411b-9623-a10bd9e7767f
> [1/7] checking root items
> [2/7] checking extents
> WARNING: tree block [30523392, 30539776) crosses 64K page boudnary, may cause problem for 64K page system
> [3/7] checking free space cache
> [4/7] checking fs roots
> [5/7] checking only csums items (without verifying data)
> [6/7] checking root refs
> [7/7] checking quota groups skipped (not enabled on this FS)
> found 131072 bytes used, no error found
> total csum bytes: 0
> total tree bytes: 131072
> total fs tree bytes: 32768
> total extent tree bytes: 16384
> btree space waste bytes: 125199
> file data blocks allocated: 0
> referenced 0
>
> [CAUSE]
> Tree block [30523392, 30539776) is at the last 16K slot of page.
> As 30523392 % 65536 = 49152, and 30539776 % 65536 = 0.
>
> The cross boundary check is using exclusive end, which causes false
> alerts.
>
> [FIX]
> Use inclusive end to do the cross 64K boundary check.
>
> Reported-by: Wang Yugui <wangyugui@e16-tech.com>
> Fixes: fc38ae7f4826 ("btrfs-progs: check: detect and warn about tree blocks crossing 64K page boundary")
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Thanks. I've extended the 001 test for mkfs to actually check for any
check warnings right after mkfs, covering all profiles and
single/multiple setups.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-09 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-06 0:40 [PATCH] btrfs-progs: fix false alert on tree block crossing 64K page boundary Qu Wenruo
2021-03-06 2:01 ` Wang Yugui
2021-03-09 14:24 ` David Sterba
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.