linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range
@ 2016-12-25 13:31 Chandan Rajendra
  2017-01-02 15:58 ` Jan Kara
  2017-01-02 16:35 ` Jens Axboe
  0 siblings, 2 replies; 5+ messages in thread
From: Chandan Rajendra @ 2016-12-25 13:31 UTC (permalink / raw)
  To: axboe, jack; +Cc: Chandan Rajendra, linux-block, linux-fsdevel, linux-kernel

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>
---
 fs/buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 1df2bd5..28484b3 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;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-02 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-25 13:31 [PATCH] clean_bdev_aliases: Prevent cleaning blocks that are not in block range Chandan Rajendra
2017-01-02 15:58 ` Jan Kara
2017-01-02 16:21   ` Eryu Guan
2017-01-02 16:46     ` Jan Kara
2017-01-02 16:35 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).