Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp443884pxf; Thu, 11 Mar 2021 07:21:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4iff9MfoSdTpWHB3CtOnc/zFV8tHIo7gsMwMExBMbTIO9Xn8g+I1WEUT+RHtexqzwACLg X-Received: by 2002:a05:6402:170f:: with SMTP id y15mr9077454edu.127.1615476085601; Thu, 11 Mar 2021 07:21:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615476085; cv=none; d=google.com; s=arc-20160816; b=JCS08Rr5BEBW2GsA+1WVMayLgYJwq4Zuv/VKZhco/RGOKR8xXPhyDY1RoJaeEDHc9h D5+Jw3juUd+2gFpWblt9vUFIk/vJWE1VYm7qM6Hp7rCkN/nXKrTUIi6MVLa+BwT9KdZU 8w/Oz1uIJsuYxWxBAlYRYzEy7hXA1p4FqTbiT+Sy7fYq++tR1e/v+7N6Umk6LjQRW+V5 peCzMC8G7x5b88T8l320RnYIpvC8diIkYLFlUP37QNbRXNSyD/4A8iCxYUjF78sqjvB5 pR/XI+nc6Z8Up/2mckORrRBkuo14qNm1PznXlOvktrarV49qvlKTdYDtDaNINCxRLAQP xJdw== 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=caEp0w0obgIosu4mMe93zi7KRsUVi1kKERPmuqtwVUU=; b=dgRF0g/RwfCmeZGO1FEp8ZXOJwHkN72olM6EjFjsETvm2awshVkurL+PZtv9ac3AJQ /v/Q8ZOy7lisLfOaCKK2Co/cc2mTkATg6nM/quMyALRW4e7oDxUyhY7MZZDWDmPtx/vC Tv5J95kjFw+TabfUANOjqgHjN/yfKS/2A0MfbcfVQXHsNs6cUpUOTo0Yc0IFfOkqSiJ/ pFHCBnRneaUtCCPQvI79mfYmx7zbWqqZsBubAyc93dAVJCNCKtHLKBHAGbyDsV5U0EQM Jlh0NvVs99GOQrBumXcl6Bo30UaRvy0pF3HlREkEcCrkKNdwWdMWj5mOZcAbUcQScN8T anow== 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 pk15si1974006ejb.315.2021.03.11.07.21.01; Thu, 11 Mar 2021 07:21:25 -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 S233869AbhCKPUB (ORCPT + 99 others); Thu, 11 Mar 2021 10:20:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:40866 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233968AbhCKPTc (ORCPT ); Thu, 11 Mar 2021 10:19:32 -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 3560CAD74; Thu, 11 Mar 2021 15:19:30 +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 v2] block: Suppress uevent for hidden device when removed Date: Thu, 11 Mar 2021 16:19:17 +0100 Message-Id: <20210311151917.136091-1-dwagner@suse.de> X-Mailer: git-send-email 2.29.2 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 by not enabling the uevents at all. Signed-off-by: Daniel Wagner --- 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