* [PATCH v2] block: Suppress uevent for hidden device when removed
@ 2021-03-11 15:19 Daniel Wagner
2021-03-11 15:54 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Wagner @ 2021-03-11 15:19 UTC (permalink / raw)
To: linux-block
Cc: linux-kernel, Jens Axboe, Christoph Hellwig, Martin Wilck, 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.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
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(-)
diff --git a/block/genhd.c b/block/genhd.c
index c55e8f0fced1..8c8f543572e6 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -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);
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] block: Suppress uevent for hidden device when removed
2021-03-11 15:19 [PATCH v2] block: Suppress uevent for hidden device when removed Daniel Wagner
@ 2021-03-11 15:54 ` Christoph Hellwig
2021-03-11 16:06 ` Martin Wilck
2021-03-11 18:48 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-03-11 15:54 UTC (permalink / raw)
To: Daniel Wagner
Cc: linux-block, linux-kernel, Jens Axboe, Christoph Hellwig, Martin Wilck
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] block: Suppress uevent for hidden device when removed
2021-03-11 15:19 [PATCH v2] block: Suppress uevent for hidden device when removed Daniel Wagner
2021-03-11 15:54 ` Christoph Hellwig
@ 2021-03-11 16:06 ` Martin Wilck
2021-03-11 18:48 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Martin Wilck @ 2021-03-11 16:06 UTC (permalink / raw)
To: Daniel Wagner, linux-block; +Cc: linux-kernel, Jens Axboe, Christoph Hellwig
On Thu, 2021-03-11 at 16:19 +0100, Daniel Wagner wrote:
> 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.
>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Martin Wilck <mwilck@suse.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] block: Suppress uevent for hidden device when removed
2021-03-11 15:19 [PATCH v2] block: Suppress uevent for hidden device when removed Daniel Wagner
2021-03-11 15:54 ` Christoph Hellwig
2021-03-11 16:06 ` Martin Wilck
@ 2021-03-11 18:48 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-03-11 18:48 UTC (permalink / raw)
To: Daniel Wagner, linux-block; +Cc: linux-kernel, Christoph Hellwig, Martin Wilck
On 3/11/21 8:19 AM, Daniel Wagner wrote:
> 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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-11 18:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 15:19 [PATCH v2] block: Suppress uevent for hidden device when removed Daniel Wagner
2021-03-11 15:54 ` Christoph Hellwig
2021-03-11 16:06 ` Martin Wilck
2021-03-11 18:48 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).