summaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
authorJack Qiu <jack.qiu@huawei.com>2021-04-09 13:27:35 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-14 08:22:32 +0200
commit7de46dc46efd49dc8cc59b52d56c5ab1eb8e8497 (patch)
tree27f8a9d3c67af1390c087afe6171d11ec60e4aa4 /fs/direct-io.c
parent24afe15d966540a0e2099d8efcce5b8286abeb6b (diff)
downloadlinux-stable-7de46dc46efd49dc8cc59b52d56c5ab1eb8e8497.tar.gz
linux-stable-7de46dc46efd49dc8cc59b52d56c5ab1eb8e8497.tar.bz2
linux-stable-7de46dc46efd49dc8cc59b52d56c5ab1eb8e8497.zip
fs: direct-io: fix missing sdio->boundary
commit df41872b68601059dd4a84858952dcae58acd331 upstream. I encountered a hung task issue, but not a performance one. I run DIO on a device (need lba continuous, for example open channel ssd), maybe hungtask in below case: DIO: Checkpoint: get addr A(at boundary), merge into BIO, no submit because boundary missing flush dirty data(get addr A+1), wait IO(A+1) writeback timeout, because DIO(A) didn't submit get addr A+2 fail, because checkpoint is doing dio_send_cur_page() may clear sdio->boundary, so prevent it from missing a boundary. Link: https://lkml.kernel.org/r/20210322042253.38312-1-jack.qiu@huawei.com Fixes: b1058b981272 ("direct-io: submit bio after boundary buffer is added to it") Signed-off-by: Jack Qiu <jack.qiu@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 1abb7634b2d5..ec7c7d1c0329 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -856,6 +856,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
struct buffer_head *map_bh)
{
int ret = 0;
+ int boundary = sdio->boundary; /* dio_send_cur_page may clear it */
if (dio->op == REQ_OP_WRITE) {
/*
@@ -894,10 +895,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits;
out:
/*
- * If sdio->boundary then we want to schedule the IO now to
+ * If boundary then we want to schedule the IO now to
* avoid metadata seeks.
*/
- if (sdio->boundary) {
+ if (boundary) {
ret = dio_send_cur_page(dio, sdio, map_bh);
if (sdio->bio)
dio_bio_submit(dio, sdio);