Re: [PATCH 2/2] md: split mddev_find

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/4/21 12:15 AM, Christoph Hellwig wrote:
Split mddev_find into a simple mddev_find that just finds an existing
mddev by the unit number, and a more complicated mddev_find that deals
with find or allocating a mddev.

... ...
Fixes: d3374825ce57 ("md: make devices disappear when they are no longer needed.")
Reported-by: Zhao Heming <heming.zhao@xxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
  drivers/md/md.c | 24 +++++++++++++++++++-----
  1 file changed, 19 insertions(+), 5 deletions(-)

... ...
@@ -6530,11 +6546,9 @@ static void autorun_devices(int part)
md_probe(dev);
  		mddev = mddev_find(dev);
-		if (!mddev || !mddev->gendisk) {
-			if (mddev)
-				mddev_put(mddev);
+		if (!mddev)
  			break;
-		}
+
  		if (mddev_lock(mddev))
  			pr_warn("md: %s locked, cannot run\n", mdname(mddev));
  		else if (mddev->raid_disks || mddev->major_version


autorun_devices use md_probe (when create_on_open is ture) to create mddev & gendisk,
mddev_find is only need to do finding job there.

looks good to me.
Reviewed-by: Heming Zhao <heming.zhao@xxxxxxxx>

Thanks,
Heming




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux