Skip to content
Snippets Groups Projects
Commit a805fda5 authored by Daniel Wagner's avatar Daniel Wagner Committed by Cheng Jian
Browse files

block: Suppress uevent for hidden device when removed


stable inclusion
from linux-4.19.184
commit 4c083481b30a17568273deed595736e091d17a65

--------------------------------

[ Upstream commit 9ec491447b90ad6a4056a9656b13f0b3a1e83043 ]

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: default avatarDaniel Wagner <dwagner@suse.de>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMartin Wilck <mwilck@suse.com>
Link: https://lore.kernel.org/r/20210311151917.136091-1-dwagner@suse.de


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarCheng Jian <cj.chengjian@huawei.com>
parent bae8f263
No related branches found
No related tags found
No related merge requests found
...@@ -622,10 +622,8 @@ static void register_disk(struct device *parent, struct gendisk *disk) ...@@ -622,10 +622,8 @@ static void register_disk(struct device *parent, struct gendisk *disk)
disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj); disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj);
disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj); disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);
if (disk->flags & GENHD_FL_HIDDEN) { if (disk->flags & GENHD_FL_HIDDEN)
dev_set_uevent_suppress(ddev, 0);
return; return;
}
/* No minors to use for partitions */ /* No minors to use for partitions */
if (!disk_part_scan_enabled(disk)) if (!disk_part_scan_enabled(disk))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment