On Thu, Apr 1, 2021 at 6:03 AM heming.zhao@xxxxxxxx <heming.zhao@xxxxxxxx> wrote: > > On 4/1/21 2:17 PM, Christoph Hellwig wrote: > > On Thu, Apr 01, 2021 at 09:34:56AM +0800, Zhao Heming wrote: > >> 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. > > > > As mention below, please don't make this even more of a mess than it > > needs to. We can just pick the two patches doing this from the series > > I sent: > > > > Hi, > > I already got your meaning on previously email. > I sent v2 patch for Song's review comment. My patch is bugfix, it may need > to back port into branch maintenance. > > Your attachment patch files is partly my patch. > The left part is in md_open (response [PATCH 01/15] md: remove the code to flush > an old instance in md_open) > I still think you directly use bdev->bd_disk->private_data as mddev pointer is not safe. > Hi Christoph and Heming, Trying to understand the whole picture here. Please let me know if I misunderstood anything. IIUC, the primary goal of Christoph's set is to get rid of the ERESTARTSYS hack from md, and eventually move bd_mutext. 02/15 to 07/15 of this set cleans up code in md.c, and they are not very important for the rest of the set (is this correct?). Heming, you mentioned "the solution may simply return -EBUSY (instead of -ENODEV) to fail the open path". Could you please show the code? Maybe that would be enough to unblock the second half of Christoph's set (08/15 to 15/15)? Once this part is resolved, the bug fix (this patch thread) and the clean up (Christoph's 02 - 07) should be easier. Would this work? Thanks, Song