Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1130737pxb; Thu, 4 Mar 2021 04:14:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXwL1jYLDyQ0XOJkA8/vWK8YvjEf+SRBOB9c5d1JBNiNiQAsFdVfn1yWbSJzGcTS5q3vn0 X-Received: by 2002:a17:906:a94b:: with SMTP id hh11mr3881106ejb.459.1614860067774; Thu, 04 Mar 2021 04:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614860067; cv=none; d=google.com; s=arc-20160816; b=kbGtoBvo++NOAiGJHsMFJix4fRSDT5AHWNt1HBMhZwyHoD6v+QgDyVLDQBerl73TDE 9avN/2Ym/+EvUZTByrUz0dEE3li3Edh73SiuPLlpYkGvut0W/rU16ooS9uq4/we7tRqc zOPZEVStbQEgZS9kZaYwXAB6L2wjRPa7ySBdobpeqFB15izGSL8D2DsYwVicpaoXTMX+ 6blbWHptld6dzpKu+7+VvM205xcdaoFVV88th0LH4nwm05Afq/MSGSKm13H/koXpedgv jBKzI3a2Cx+/zh7DCDSIejgvgX1417F2ncBpH4mC5vyASbGRkmjZOnvnsGZAb9HZxi4q jPow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UZv+P1RSSk4/Oa7/uY1uCnZhE0+lhCrZJ2ZOfe1xOLg=; b=vt6+Y2ACqacVYvqY/9jTVG6UBycPCvQOs/UJu/QKBz6pX/Q1fY55zb/lNWUiMq5emB 5H57V4lYWaxPNmvH7TWBjLP9e33QSUREIbRUin1wV+LMlkrcpO5Usn4Ya/QyRr1KOKKJ 2uzNBYEiQEovVymj8Xj+CUVaQ2lL7gPxR00KD62chX5uZvT8BkFqVQj+t43kxBlFn2Rj C9kJ9NtF2sk6wdOYhaMHyQaogIkK8UZSIOrBWpY48MwfUKx7wcWF6Q93/Nv+7YZ0K1X0 ebUH3pacx31o1uGynYvpGHEfxgLrIwsxo9aIRHK2pNt4TRi8lQrAnUAyD7s7D2Y5cO3D nDjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si17197926edr.491.2021.03.04.04.14.05; Thu, 04 Mar 2021 04:14:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1580559AbhCCSeZ (ORCPT + 99 others); Wed, 3 Mar 2021 13:34:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:44472 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235354AbhCCRNo (ORCPT ); Wed, 3 Mar 2021 12:13:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C4462AEB3; Wed, 3 Mar 2021 17:12:02 +0000 (UTC) From: Daniel Wagner To: linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jens Axboe , Christoph Hellwig , Martin Wilck , Daniel Wagner Subject: [PATCH] block: Suppress uevent for hidden device when removed Date: Wed, 3 Mar 2021 18:12:01 +0100 Message-Id: <20210303171201.8432-1-dwagner@suse.de> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 again before calling device_del() which will write trigger uevents. Signed-off-by: Daniel Wagner --- block/genhd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index c55e8f0fced1..ab9ed355bdef 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -731,6 +731,9 @@ void del_gendisk(struct gendisk *disk) if (!sysfs_deprecated) sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk))); pm_runtime_set_memalloc_noio(disk_to_dev(disk), false); + + if (disk->flags & GENHD_FL_HIDDEN) + dev_set_uevent_suppress(disk_to_dev(disk), 1); device_del(disk_to_dev(disk)); } EXPORT_SYMBOL(del_gendisk); -- 2.30.1