linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Ni <xni@redhat.com>
To: song@kernel.org
Cc: yukuai1@huaweicloud.com, bmarzins@redhat.com, heinzm@redhat.com,
	snitzer@kernel.org, ncroxon@redhat.com, neilb@suse.de,
	linux-raid@vger.kernel.org, dm-devel@lists.linux.dev
Subject: [PATCH RFC 3/4] md: Missing decrease active_io for flush io
Date: Tue, 20 Feb 2024 23:30:58 +0800	[thread overview]
Message-ID: <20240220153059.11233-4-xni@redhat.com> (raw)
In-Reply-To: <20240220153059.11233-1-xni@redhat.com>

If all flush bios finish fast, it doesn't decrease active_io. And it will
stuck when stopping array.

This can be reproduced by lvm2 test shell/integrity-caching.sh.
But it can't reproduce 100%.

Fixes: fa2bbff7b0b4 ("md: synchronize flush io with array reconfiguration")
Signed-off-by: Xiao Ni <xni@redhat.com>
---
 drivers/md/md.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 77e3af7cf6bb..a41bed286fd2 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -579,8 +579,12 @@ static void submit_flushes(struct work_struct *ws)
 			rcu_read_lock();
 		}
 	rcu_read_unlock();
-	if (atomic_dec_and_test(&mddev->flush_pending))
+	if (atomic_dec_and_test(&mddev->flush_pending)) {
+		/* The pair is percpu_ref_get() from md_flush_request() */
+		percpu_ref_put(&mddev->active_io);
+
 		queue_work(md_wq, &mddev->flush_work);
+	}
 }
 
 static void md_submit_flush_data(struct work_struct *ws)
-- 
2.32.0 (Apple Git-132)


  parent reply	other threads:[~2024-02-20 15:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 15:30 [PATCH RFC V2 0/4] Fix regression bugs Xiao Ni
2024-02-20 15:30 ` [PATCH RFC 1/4] dm-raid/md: Clear MD_RECOVERY_WAIT when stopping dmraid Xiao Ni
2024-02-23  3:31   ` Yu Kuai
2024-02-23 13:20     ` Xiao Ni
2024-02-26  1:31       ` Yu Kuai
2024-02-26  5:12         ` Xiao Ni
2024-02-26  9:36           ` Yu Kuai
2024-02-27  7:16             ` Xiao Ni
2024-02-27  7:39               ` Yu Kuai
2024-03-01  4:18             ` Xiao Ni
2024-02-23 10:31   ` Yu Kuai
2024-02-23 13:40     ` Xiao Ni
2024-02-20 15:30 ` [PATCH RFC 2/4] md: Set MD_RECOVERY_FROZEN before stop sync thread Xiao Ni
2024-02-23  3:12   ` Yu Kuai
2024-02-23  3:58     ` Song Liu
2024-02-20 15:30 ` Xiao Ni [this message]
2024-02-23  3:06   ` [PATCH RFC 3/4] md: Missing decrease active_io for flush io Yu Kuai
2024-02-23 13:49     ` Xiao Ni
2024-02-20 15:30 ` [PATCH RFC V2 4/4] md/raid5: Don't check crossing reshape when reshape hasn't started Xiao Ni
2024-02-23  3:08   ` Yu Kuai
2024-02-23 14:00     ` Xiao Ni
2024-02-21  5:45 ` [PATCH RFC V2 0/4] Fix regression bugs Benjamin Marzinski
2024-02-23  2:42   ` Xiao Ni

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=20240220153059.11233-4-xni@redhat.com \
    --to=xni@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=heinzm@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=ncroxon@redhat.com \
    --cc=neilb@suse.de \
    --cc=snitzer@kernel.org \
    --cc=song@kernel.org \
    --cc=yukuai1@huaweicloud.com \
    /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).