On Wed 31-08-22 15:21:00, Zhang Yi wrote:
quoted hunk ↗ jump to hunk
ll_rw_block() is not safe for the sync IO path because it skip buffers
which has been locked by others, it could lead to false positive EIO
when submitting read IO. So stop using ll_rw_block(), switch to use new
helpers which could guarantee buffer locked and submit IO if needed.
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
fs/buffer.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index a663191903ed..e14adc638bfe 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
...
quoted hunk ↗ jump to hunk
@@ -1342,7 +1342,8 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
{
struct buffer_head *bh = __getblk(bdev, block, size);
if (likely(bh)) {
- ll_rw_block(REQ_OP_READ | REQ_RAHEAD, 1, &bh);
+ if (trylock_buffer(bh))
+ __bh_read(bh, REQ_RAHEAD, false);
I suppose this can be bh_readahead()?
brelse(bh);
}
}
Otherwise the patch looks good.
Honza
--
Jan Kara [off-list ref]
SUSE Labs, CR