Browse Source

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>
Chandan Rajendra 8 years ago
parent
commit
6c006a9d94
1 changed files with 1 additions and 1 deletions
  1. 1 1
      fs/buffer.c

+ 1 - 1
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);
 			head = page_buffers(page);
 			bh = head;
 			bh = head;
 			do {
 			do {
-				if (!buffer_mapped(bh))
+				if (!buffer_mapped(bh) || (bh->b_blocknr < block))
 					goto next;
 					goto next;
 				if (bh->b_blocknr >= block + len)
 				if (bh->b_blocknr >= block + len)
 					break;
 					break;