Skip to content

Commit a7dff6f

Browse files
dlsloangregkh
authored andcommitted
md: Flush workqueue md_rdev_misc_wq in md_alloc()
[ Upstream commit 5e8daf9 ] 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 <[email protected]> [[email protected]: rewrote commit message] Signed-off-by: Logan Gunthorpe <[email protected]> Signed-off-by: Song Liu <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 0b70580 commit a7dff6f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/md/md.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5651,6 +5651,7 @@ static int md_alloc(dev_t dev, char *name)
56515651
* removed (mddev_delayed_delete).
56525652
*/
56535653
flush_workqueue(md_misc_wq);
5654+
flush_workqueue(md_rdev_misc_wq);
56545655

56555656
mutex_lock(&disks_mutex);
56565657
mddev = mddev_alloc(dev);

0 commit comments

Comments
 (0)