diff --git a/drivers/md/md.c b/drivers/md/md.c index a970fdd0ce8c08ddaf48690dedc4f670cfe112a0..f5dfa503fb6feef12d8f506e623c373ab76aec9e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7768,7 +7768,8 @@ static int md_open(struct block_device *bdev, fmode_t mode) */ mddev_put(mddev); /* Wait until bdev->bd_disk is definitely gone */ - flush_workqueue(md_misc_wq); + if (work_pending(&mddev->del_work)) + flush_workqueue(md_misc_wq); /* Then retry the open from the top */ return -ERESTARTSYS; }