Skip to contentSkip to conversation

btrfs: fix the uptodate assert in btree_csum_one_bio

PATCH In review Christoph Hellwig 3 participants 3 messages May 26, 2023 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: fix the uptodate assert in btree_csum_one_bio

btree_csum_one_bio needs to use the btrfs_page_test_uptodate helper to check for uptodate status as the page might not be marked uptodate for a sub-page size buffer.

Fixes 5067444c99c3 ("btrfs: remove the extent_buffer lookup in btree block checksumming")
---
 fs/btrfs/disk-io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
index c461a46ac6f207..36d6b8d4b2c1fa 100644
@@ -269,7 +269,8 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
 
 	if (WARN_ON_ONCE(found_start != eb->start))
 		return BLK_STS_IOERR;
-	if (WARN_ON_ONCE(!PageUptodate(eb->pages[0])))
+	if (WARN_ON(!btrfs_page_test_uptodate(fs_info, eb->pages[0],
+					      eb->start, eb->len)))
 		return BLK_STS_IOERR;
 
 	ASSERT(memcmp_extent_buffer(eb, fs_info->fs_devices->metadata_uuid,
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Christoph Hellwig

btree_csum_one_bio needs to use the btrfs_page_test_uptodate helper to check for uptodate status as the page might not be marked uptodate for a sub-page size buffer.

Fixes 5067444c99c3 ("btrfs: remove the extent_buffer lookup in btree block checksumming")

Thanks,
Qu

Quoted 18 lines
---
  fs/btrfs/disk-io.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
index c461a46ac6f207..36d6b8d4b2c1fa 100644
@@ -269,7 +269,8 @@ blk_status_t btree_csum_one_bio(struct btrfs_bio *bbio)
 
  	if (WARN_ON_ONCE(found_start != eb->start))
  		return BLK_STS_IOERR;
-	if (WARN_ON_ONCE(!PageUptodate(eb->pages[0])))
+	if (WARN_ON(!btrfs_page_test_uptodate(fs_info, eb->pages[0],
+					      eb->start, eb->len)))
  		return BLK_STS_IOERR;
 
  	ASSERT(memcmp_extent_buffer(eb, fs_info->fs_devices->metadata_uuid,
#2 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

btree_csum_one_bio needs to use the btrfs_page_test_uptodate helper to check for uptodate status as the page might not be marked uptodate for a sub-page size buffer.

Fixes 5067444c99c3 ("btrfs: remove the extent_buffer lookup in btree block checksumming")

Folded to the patch, thanks.

Quoted 3 lines