Skip to contentSkip to conversation

block: Suppress uevent for hidden device when removed

PATCH Applied Daniel Wagner 4 participants 4 messages Mar 11, 2021 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block: Suppress uevent for hidden device when removed

register_disk() suppress uevents for devices with the GENHD_FL_HIDDEN but enables uevents at the end again in order to announce disk after possible partitions are created.

When the device is removed the uevents are still on and user land sees 'remove' messages for devices which were never 'add'ed to the system.

KERNEL[95481.571887] remove /devices/virtual/nvme-fabrics/ctl/nvme5/nvme0c5n1 (block)

Let's suppress the uevents for GENHD_FL_HIDDEN by not enabling the uevents at all.

---

This version behaves in the same way as v1, that is I don't see any other effects than the expected missing uevent remove event.

v2:
- never enable the uevents for GENHD_FL_HIDDEN
instead adding another test add del_gendisk()

 block/genhd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
block/genhd.c +1 -3
index c55e8f0fced1..8c8f543572e6 100644
@@ -534,10 +534,8 @@ static void register_disk(struct device *parent, struct gendisk *disk,
 		kobject_create_and_add("holders", &ddev->kobj);
 	disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
 
-	if (disk->flags & GENHD_FL_HIDDEN) {
-		dev_set_uevent_suppress(ddev, 0);
+	if (disk->flags & GENHD_FL_HIDDEN)
 		return;
-	}
 
 	disk_scan_partitions(disk);
 
Signature · 1 line
2.29.2
Reviewed-by on v2 1/1
#2 lore raw
In reply to Daniel Wagner
Quoted 8 lines · Daniel Wagner

register_disk() suppress uevents for devices with the GENHD_FL_HIDDEN but enables uevents at the end again in order to announce disk after possible partitions are created.

When the device is removed the uevents are still on and user land sees
'remove' messages for devices which were never 'add'ed to the system.

Quoted 7 lines

  KERNEL[95481.571887] remove   /devices/virtual/nvme- fabrics/ctl/nvme5/nvme0c5n1 (block)

Let's suppress the uevents for GENHD_FL_HIDDEN by not enabling the uevents at all.

maintainer Applied
#3 lore raw
In reply to Daniel Wagner
Quoted 11 lines · Daniel Wagner

register_disk() suppress uevents for devices with the GENHD_FL_HIDDEN but enables uevents at the end again in order to announce disk after possible partitions are created.

When the device is removed the uevents are still on and user land sees 'remove' messages for devices which were never 'add'ed to the system.

KERNEL[95481.571887] remove /devices/virtual/nvme-fabrics/ctl/nvme5/nvme0c5n1 (block)

Let's suppress the uevents for GENHD_FL_HIDDEN by not enabling the uevents at all.

Applied, thanks.

Signature · 1 line
Jens Axboe