[PATCH] direct-io: don't introduce another read of inode->i_blkbits

Subsystems: filesystems (vfs and infrastructure), the rest

STALE3494d

4 messages, 3 authors, 2017-01-10 · open the first message on its own page

[PATCH] direct-io: don't introduce another read of inode->i_blkbits

From: Jeff Moyer <hidden>
Date: 2017-01-09 21:42:59

Commit 20ce44d545844 ("do_direct_IO: Use inode->i_blkbits to compute
block count to be cleaned") introduced a regression: if the block size
of the block device is changed while a direct I/O request is being
setup, it can result in a panic.  See commit ab73857e354ab ("direct-io:
don't read inode->i_blkbits multiple times") for the reasoning, and
commit b87570f5d3496 ("Fix a crash when block device is read and block
size is changed at the same time") for a more detailed problem
description and reproducer.

Fixes: 20ce44d545844
Signed-off-by: Jeff Moyer <redacted>

---
Chandan, can you please test this to ensure this still fixes your problem?
diff --git a/fs/direct-io.c b/fs/direct-io.c
index b20adf9..c87bae4 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -905,8 +905,8 @@ static inline void dio_zero_block(struct dio *dio, struct dio_submit *sdio,
 static int do_direct_IO(struct dio *dio, struct dio_submit *sdio,
 			struct buffer_head *map_bh)
 {
-	const unsigned i_blkbits = dio->inode->i_blkbits;
 	const unsigned blkbits = sdio->blkbits;
+	const unsigned i_blkbits = blkbits + sdio->blkfactor;
 	int ret = 0;
 
 	while (sdio->block_in_file < sdio->final_block_in_request) {

Re: [PATCH] direct-io: don't introduce another read of inode->i_blkbits

From: Jens Axboe <axboe@kernel.dk>
Date: 2017-01-09 21:44:48

On 01/09/2017 02:42 PM, Jeff Moyer wrote:
Commit 20ce44d545844 ("do_direct_IO: Use inode->i_blkbits to compute
block count to be cleaned") introduced a regression: if the block size
of the block device is changed while a direct I/O request is being
setup, it can result in a panic.  See commit ab73857e354ab ("direct-io:
don't read inode->i_blkbits multiple times") for the reasoning, and
commit b87570f5d3496 ("Fix a crash when block device is read and block
size is changed at the same time") for a more detailed problem
description and reproducer.

Fixes: 20ce44d545844
Signed-off-by: Jeff Moyer <redacted>

---
Chandan, can you please test this to ensure this still fixes your problem?
Please, that would be great. And if so, then let's fold the two.

-- 
Jens Axboe

Re: [PATCH] direct-io: don't introduce another read of inode->i_blkbits

From: Chandan Rajendra <hidden>
Date: 2017-01-10 05:28:10

On Monday, January 09, 2017 04:42:58 PM Jeff Moyer wrote:
Commit 20ce44d545844 ("do_direct_IO: Use inode->i_blkbits to compute
block count to be cleaned") introduced a regression: if the block size
of the block device is changed while a direct I/O request is being
setup, it can result in a panic.  See commit ab73857e354ab ("direct-io:
don't read inode->i_blkbits multiple times") for the reasoning, and
commit b87570f5d3496 ("Fix a crash when block device is read and block
size is changed at the same time") for a more detailed problem
description and reproducer.

Fixes: 20ce44d545844
Signed-off-by: Jeff Moyer <redacted>

---
Chandan, can you please test this to ensure this still fixes your problem?
This patch fixes the failure,

Tested-by: Chandan Rajendra <redacted>

-- 
chandan

Re: [PATCH] direct-io: don't introduce another read of inode->i_blkbits

From: Jens Axboe <axboe@kernel.dk>
Date: 2017-01-10 20:31:20

On 01/09/2017 10:27 PM, Chandan Rajendra wrote:
On Monday, January 09, 2017 04:42:58 PM Jeff Moyer wrote:
quoted
Commit 20ce44d545844 ("do_direct_IO: Use inode->i_blkbits to compute
block count to be cleaned") introduced a regression: if the block size
of the block device is changed while a direct I/O request is being
setup, it can result in a panic.  See commit ab73857e354ab ("direct-io:
don't read inode->i_blkbits multiple times") for the reasoning, and
commit b87570f5d3496 ("Fix a crash when block device is read and block
size is changed at the same time") for a more detailed problem
description and reproducer.

Fixes: 20ce44d545844
Signed-off-by: Jeff Moyer <redacted>

---
Chandan, can you please test this to ensure this still fixes your problem?
This patch fixes the failure,

Tested-by: Chandan Rajendra <redacted>
I've updated the patch, thanks guys.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help