mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-18 16:44:33 +00:00
md: Flush workqueue md_rdev_misc_wq in md_alloc()
commit 5e8daf906f
upstream.
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>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
80653a6e6e
commit
1c44109c30
1 changed files with 1 additions and 0 deletions
|
@ -5683,6 +5683,7 @@ static int md_alloc(dev_t dev, char *name)
|
|||
* completely removed (mddev_delayed_delete).
|
||||
*/
|
||||
flush_workqueue(md_misc_wq);
|
||||
flush_workqueue(md_rdev_misc_wq);
|
||||
|
||||
mutex_lock(&disks_mutex);
|
||||
error = -EEXIST;
|
||||
|
|
Loading…
Reference in a new issue