summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorZhao Heming <heming.zhao@suse.com>2021-04-03 11:01:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-14 09:44:13 +0200
commit79c1bfae668d34db9b946a5de86d90a615cca0b1 (patch)
tree4759f36f3c40de1b240fd0dd2f273c976663469f /drivers/md
parentadb9bbf1a28499c6df7c58c09c6f68d8d355d5e5 (diff)
md: md_open returns -EBUSY when entering racing area
commit 6a4db2a60306eb65bfb14ccc9fde035b74a4b4e7 upstream. commit d3374825ce57 ("md: make devices disappear when they are no longer needed.") introduced protection between mddev creating & removing. The md_open shouldn't create mddev when all_mddevs list doesn't contain mddev. With currently code logic, there will be very easy to trigger soft lockup in non-preempt env. This patch changes md_open returning from -ERESTARTSYS to -EBUSY, which will break the infinitely retry when md_open enter racing area. This patch is partly fix soft lockup issue, full fix needs mddev_find is split into two functions: mddev_find & mddev_find_or_alloc. And md_open should call new mddev_find (it only does searching job). For more detail, please refer with Christoph's "split mddev_find" patch in later commits.
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9abdefd623e4..2f7d29711758 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7638,8 +7638,7 @@ static int md_open(struct block_device *bdev, fmode_t mode)
/* Wait until bdev->bd_disk is definitely gone */
if (work_pending(&mddev->del_work))
flush_workqueue(md_misc_wq);
- /* Then retry the open from the top */
- return -ERESTARTSYS;
+ return -EBUSY;
}
BUG_ON(mddev != bdev->bd_disk->private_data);