linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, jack.qiu@huawei.com, jack@suse.cz,
	linux-mm@kvack.org, mm-commits@vger.kernel.org,
	stable@vger.kernel.org, torvalds@linux-foundation.org
Subject: [patch 12/16] fs: direct-io: fix missing sdio->boundary
Date: Fri, 09 Apr 2021 13:27:35 -0700	[thread overview]
Message-ID: <20210409202735.f8KT72Y5i%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210409132633.6855fc8fea1b3905ea1bb4be@linux-foundation.org>

From: Jack Qiu <jack.qiu@huawei.com>
Subject: fs: direct-io: fix missing sdio->boundary

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>
---

 fs/direct-io.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/direct-io.c~fs-direct-io-fix-missing-sdio-boundary
+++ a/fs/direct-io.c
@@ -812,6 +812,7 @@ submit_page_section(struct dio *dio, str
 		    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) {
 		/*
@@ -850,10 +851,10 @@ submit_page_section(struct dio *dio, str
 	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);
_


  parent reply	other threads:[~2021-04-09 20:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 20:26 incoming Andrew Morton
2021-04-09 20:27 ` [patch 01/16] MAINTAINERS: update CZ.NIC's Turris information Andrew Morton
2021-04-09 20:27 ` [patch 02/16] treewide: change my e-mail address, fix my name Andrew Morton
2021-04-09 20:27 ` [patch 03/16] mailmap: update email address for Jordan Crouse Andrew Morton
2021-04-09 20:27 ` [patch 04/16] .mailmap: fix old email addresses Andrew Morton
2021-04-09 20:27 ` [patch 05/16] kasan: fix hwasan build for gcc Andrew Morton
2021-04-09 20:39   ` Andrey Konovalov
2021-04-09 20:58     ` Andrew Morton
2021-04-12  9:56       ` Marco Elver
2021-04-12 12:54         ` Andrey Konovalov
2021-04-09 21:55     ` Linus Torvalds
2021-04-09 20:27 ` [patch 06/16] kasan: remove redundant config option Andrew Morton
2021-04-09 20:27 ` [patch 07/16] mm/gup: check page posion status for coredump Andrew Morton
2021-04-09 20:27 ` [patch 08/16] nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff Andrew Morton
2021-04-09 20:27 ` [patch 09/16] gcov: re-fix clang-11+ support Andrew Morton
2021-04-09 20:27 ` [patch 10/16] ocfs2: fix deadlock between setattr and dio_end_io_write Andrew Morton
2021-04-09 20:27 ` [patch 11/16] ia64: fix user_stack_pointer() for ptrace() Andrew Morton
2021-04-09 20:27 ` Andrew Morton [this message]
2021-04-09 20:27 ` [patch 13/16] kasan: fix conflict with page poisoning Andrew Morton
2021-04-09 20:27 ` [patch 14/16] lib/test_kasan_module.c: suppress unused var warning Andrew Morton
2021-04-09 20:27 ` [patch 15/16] kfence, x86: fix preemptible warning on KPTI-enabled systems Andrew Morton
2021-04-09 20:27 ` [patch 16/16] lib: fix kconfig dependency on ARCH_WANT_FRAME_POINTERS Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210409202735.f8KT72Y5i%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=jack.qiu@huawei.com \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).