diff options
author | Chandan Rajendra <chandan@linux.vnet.ibm.com> | 2016-12-25 19:01:03 +0530 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-01-02 09:35:14 -0700 |
commit | 6c006a9d94bfb5cbcc5150e8fd7f45d3f92f3ee8 (patch) | |
tree | 1496fa58d4878969d6b1e78acbc73074a4b85618 /fs/buffer.c | |
parent | 8e5d31eb02c08d94262e1281adc8574134af65fd (diff) | |
download | linux-6c006a9d94bfb5cbcc5150e8fd7f45d3f92f3ee8.tar.gz linux-6c006a9d94bfb5cbcc5150e8fd7f45d3f92f3ee8.tar.bz2 linux-6c006a9d94bfb5cbcc5150e8fd7f45d3f92f3ee8.zip |
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.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index d21771fcf7d3..0e87401cf335 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -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; |