This is a note to let you know that I've just added the patch titled md: md_open returns -EBUSY when entering racing area to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: md-md_open-returns-ebusy-when-entering-racing-area.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6a4db2a60306eb65bfb14ccc9fde035b74a4b4e7 Mon Sep 17 00:00:00 2001 From: Zhao Heming <heming.zhao@xxxxxxxx> Date: Sat, 3 Apr 2021 11:01:25 +0800 Subject: md: md_open returns -EBUSY when entering racing area From: Zhao Heming <heming.zhao@xxxxxxxx> 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. --- drivers/md/md.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7481,8 +7481,7 @@ static int md_open(struct block_device * /* 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); Patches currently in stable-queue which might be from heming.zhao@xxxxxxxx are queue-4.19/md-bitmap-wait-for-external-bitmap-writes-to-complete-during-tear-down.patch queue-4.19/md-factor-out-a-mddev_find_locked-helper-from-mddev_find.patch queue-4.19/md-cluster-fix-use-after-free-issue-when-removing-rdev.patch queue-4.19/md-md_open-returns-ebusy-when-entering-racing-area.patch