Skip to contentSkip to conversation

md/raid1: drop the redundant sysfs_unlink_rdev()

PATCH Applied [email protected] 2 participants 2 messages Nov 1 – Nov 21 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md/raid1: drop the redundant sysfs_unlink_rdev()

raid1_reshape() unlinks the old "rd{d}" link, assigns the new raid_disk, then unlinks again. The second call targets "rd{d2}", a slot that has no sysfs link yet, so it is a no-op; sysfs_link_rdev() below creates it.

---

drivers/md/raid1.c +0 -1
index 894efb50c6d5..25b80ad52f00 100644
@@ -3351,7 +3351,6 @@ static int raid1_reshape(struct mddev *mddev)
 		if (rdev && rdev->raid_disk != d2) {
 			sysfs_unlink_rdev(mddev, rdev);
 			rdev->raid_disk = d2;
-			sysfs_unlink_rdev(mddev, rdev);
 			if (sysfs_link_rdev(mddev, rdev))
 				pr_warn("md/raid1:%s: cannot register rd%d\n",
 					mdname(mddev), rdev->raid_disk);
maintainer Applied
#1 lore raw

Hi,

Quoted 6 lines · 在 2026/11/1 20:09, [email protected] 写道:

raid1_reshape() unlinks the old "rd{d}" link, assigns the new raid_disk, then unlinks again. The second call targets "rd{d2}", a slot that has no sysfs link yet, so it is a no-op; sysfs_link_rdev() below creates it.

Applied, btw, patch format is a bit strange.

Signature · 2 lines
Thanks,
Kuai