Re: [PATCH RFC 3/4] md: Missing decrease active_io for flush io
From: Yu Kuai <hidden>
Date: 2024-02-23 03:06:41
Also in:
dm-devel
Hi, 在 2024/02/20 23:30, Xiao Ni 写道:
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 <redacted>Same patch is already applied: 855678ed8534 md: Fix missing release of 'active_io' for flush Thanks, Kuai
quoted hunk ↗ jump to hunk
--- 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)