clean_bdev_aliases: Prevent cleaning blocks that are not in block range
Subsystems (2)
PATCH 1/1 clean_bdev_aliases: Prevent cleaning blocks that are not in block range
The first block to be cleaned may start at a non-zero page offset. In such a scenario clean_bdev_aliases() will end up cleaning blocks that do not fall in the range of blocks to be cleaned. This commit fixes the issue by skipping blocks that do not fall in valid block range.
--- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/buffer.c +1 -1
@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len) head =page_buffers (page); bh = head; do { - if (!buffer_mapped(bh)) + if (!buffer_mapped(bh) || (bh->b_blocknr < block)) goto next; if (bh->b_blocknr >= block + len) break;
Signature · 1 line
2.5.5
Quoted 6 lines · Chandan Rajendra
The first block to be cleaned may start at a non-zero page offset. In such a scenario
clean_bdev_aliases()will end up cleaning blocks that do not fall in the range of blocks to be cleaned. This commit fixes the issue by skipping blocks that do not fall in valid block range.Signed-off-by Chandan Rajendra <[email protected]>
Ah, very good catch! How did you spot this?
The patch looks good. You can add:
Jens, please merge this fix quickly as we may end up discarding changes to innocent metadata blocks due to this... Thanks!
Honza
Quoted 20 lines
--- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/buffer.c +1
-1@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len) head =page_buffers (page); bh = head; do { - if (!buffer_mapped(bh)) + if (!buffer_mapped(bh) || (bh->b_blocknr < block)) goto next; if (bh->b_blocknr >= block + len) break;Signature · 1 line
2.5.5
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Eryu Guan
Reviewed-byQuoted 9 lines · Jan Kara
Quoted 6 lines · Chandan Rajendra
The first block to be cleaned may start at a non-zero page offset. In such a scenario
clean_bdev_aliases()will end up cleaning blocks that do not fall in the range of blocks to be cleaned. This commit fixes the issue by skipping blocks that do not fall in valid block range.Signed-off-by Chandan Rajendra <[email protected]>Ah, very good catch! How did you spot this?
I failed to notice this patch, and I came up with a same patch today myself, and I'm still testing it.
I found this by xfstests, many tests (tens of tests) failed fsck after test when testing extN if blocksize < pagesize. E.g. generic/013 could reproduce the fs corruption quite reliablely for me.
Quoted 36 lines
The patch looks good. You can add:
Reviewed-by Jan Kara <[email protected]>Jens, please merge this fix quickly as we may end up discarding changes to innocent metadata blocks due to this... Thanks!
Honza
Quoted 20 lines
--- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/buffer.c +1
-1@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len) head =page_buffers (page); bh = head; do { - if (!buffer_mapped(bh)) + if (!buffer_mapped(bh) || (bh->b_blocknr < block)) goto next; if (bh->b_blocknr >= block + len) break;Signature · 1 line
2.5.5Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Chandan Rajendra
The first block to be cleaned may start at a non-zero page offset. In such a scenario
clean_bdev_aliases()will end up cleaning blocks that do not fall in the range of blocks to be cleaned. This commit fixes the issue by skipping blocks that do not fall in valid block range.
Queued up, thanks.
Signature · 1 line
Jens Axboe
Jan Kara
reviewerQuoted 11 lines · Eryu Guan
Quoted 9 lines · Jan Kara
Quoted 6 lines · Chandan Rajendra
The first block to be cleaned may start at a non-zero page offset. In such a scenario
clean_bdev_aliases()will end up cleaning blocks that do not fall in the range of blocks to be cleaned. This commit fixes the issue by skipping blocks that do not fall in valid block range.Signed-off-by Chandan Rajendra <[email protected]>Ah, very good catch! How did you spot this?
Quoted 8 lines
I failed to notice this patch, and I came up with a same patch today myself, and I'm still testing it.
I found this by xfstests, many tests (tens of tests) failed fsck after test when testing extN if blocksize < pagesize. E.g. generic/013 could reproduce the fs corruption quite reliablely for me.
Reviewed-by Eryu Guan <[email protected]>
Thanks! Yeah, I had run xfstests with those patches but not with blocksize < pagesize :-| Shit happens... need to be more careful next time.
Honza
Quoted 35 lines
Quoted 35 lines
The patch looks good. You can add:
Reviewed-by Jan Kara <[email protected]>Jens, please merge this fix quickly as we may end up discarding changes to innocent metadata blocks due to this... Thanks!
Honza
Quoted 20 lines
--- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/buffer.c +1
-1@@ -1660,7 +1660,7 @@ void clean_bdev_aliases(struct block_device *bdev, sector_t block, sector_t len) head =page_buffers (page); bh = head; do { - if (!buffer_mapped(bh)) + if (!buffer_mapped(bh) || (bh->b_blocknr < block)) goto next; if (bh->b_blocknr >= block + len) break;Signature · 1 line
2.5.5Signature · 6 lines
Jan Kara <[email protected]> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR