From: Logan Gunthorpe <logang@deltatee.com>
To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
Song Liu <song@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Guoqing Jiang <guoqing.jiang@linux.dev>,
Stephen Bates <sbates@raithlin.com>,
Martin Oliveira <Martin.Oliveira@eideticom.com>,
David Sloan <David.Sloan@eideticom.com>,
David Sloan <david.sloan@eideticom.com>,
Logan Gunthorpe <logang@deltatee.com>
Subject: [PATCH 1/5] md: Flush workqueue md_rdev_misc_wq in md_alloc()
Date: Thu, 11 Aug 2022 11:14:13 -0600 [thread overview]
Message-ID: <20220811171417.147697-2-logang@deltatee.com> (raw)
In-Reply-To: <20220811171417.147697-1-logang@deltatee.com>
From: David Sloan <david.sloan@eideticom.com>
A race condition still exists when removing and re-creating md devices
in test cases. However, it is only seen on some setups.
The race condition was tracked down to a reference still being held
to the kobject by the rdev in the md_rdev_misc_wq which will be released
in rdev_delayed_delete().
md_alloc() waits for previous deletions by waiting on the md_misc_wq,
but the md_rdev_misc_wq may still be holding a reference to a recently
removed device.
To fix this, also flush the md_rdev_misc_wq in md_alloc().
Signed-off-by: David Sloan <david.sloan@eideticom.com>
[logang@deltatee.com: rewrote commit message]
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
drivers/md/md.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index afaf36b2f6ab..71d221601bf8 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5620,6 +5620,7 @@ struct mddev *md_alloc(dev_t dev, char *name)
* removed (mddev_delayed_delete).
*/
flush_workqueue(md_misc_wq);
+ flush_workqueue(md_rdev_misc_wq);
mutex_lock(&disks_mutex);
mddev = mddev_alloc(dev);
--
2.30.2
next prev parent reply other threads:[~2022-08-11 17:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 17:14 [PATCH 0/5] More fixups for raid5 Logan Gunthorpe
2022-08-11 17:14 ` Logan Gunthorpe [this message]
2022-08-11 17:46 ` [PATCH 1/5] md: Flush workqueue md_rdev_misc_wq in md_alloc() Song Liu
2022-08-11 17:14 ` [PATCH 2/5] md/raid5: Refactor raid5_get_active_stripe() Logan Gunthorpe
2022-08-29 22:23 ` Song Liu
2022-08-11 17:14 ` [PATCH 3/5] md/raid5: Drop extern on function declarations in raid5.h Logan Gunthorpe
2022-08-11 17:14 ` [PATCH 4/5] md/raid5: Cleanup prototype of raid5_get_active_stripe() Logan Gunthorpe
2022-08-11 17:14 ` [PATCH 5/5] md/raid5: Don't read ->active_stripes if it's not needed Logan Gunthorpe
2022-08-13 6:31 ` [PATCH 0/5] More fixups for raid5 Christoph Hellwig
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=20220811171417.147697-2-logang@deltatee.com \
--to=logang@deltatee.com \
--cc=David.Sloan@eideticom.com \
--cc=Martin.Oliveira@eideticom.com \
--cc=guoqing.jiang@linux.dev \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=sbates@raithlin.com \
--cc=song@kernel.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