Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp694213pxb; Wed, 22 Sep 2021 10:41:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyewT6t48p5UmJup8hHikt+oxuBzssKJgcswjEqYVxg7a5ycKf7t5RUAvtg3JhSVQwfath X-Received: by 2002:a92:290f:: with SMTP id l15mr206954ilg.220.1632332501498; Wed, 22 Sep 2021 10:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632332501; cv=none; d=google.com; s=arc-20160816; b=a8CZeP8yzgDYdjB6L9o8TEvoIvYiSm/VNbMgNkjb4BDFNlZmPHST8+reXT0u6zVYNe nQcIUmY6WQkC0+HyglpwnJ2UhO4OPMiAmy17ZdUm0UqT4/ME4y+0ngQRO2bL5uRCHwt0 fg83VCjLc0x/UHR4XpWhFvwVKgP60v/y61jFmnoYivP6c+BZ/rT7jYJqh3Q+4dvQYMtu xRM0GyFQASZv/Wlc9Mk3waPf9GFNcLWqe4LIJeXJSpDRPbt2jeQIFvMQH4Ow8eUF6eum zP18wthIRoZ44Mcl4QZd2KiBNDFwioZkVnCigc3qYvTtt8Ax+AwtvfkdPC2uVwWkza8C gPhQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=P+wjbvfBuWtk4jFuBJ3sMrPTDi2tE+fy+MjarlqPFEo=; b=A8F1m7+PkRQg/1U1pZgz3In92cRqvAAmNdk/N63lo4OIr0k20DLwtMXfscNHVTZKxU JY2/nmqnrvU2+DANLurz8vQptJd4LqSHdjXXxi1oAQv4pyMxfg2KooXWxrjuV5EA0p9N pes2zyQHMq29Mk3nQshWNXp8HoVdsjv5HLN1BT8JxUEauVpZ+HnrvaVbfpHwE6WDZwl2 nej2bj5SiOrr0ysi/KRlCU5p4Ga6gvau6egqCrUN8trBHUKTnYnBTFXLh7Qp/egFoBp0 7tiAL+hlUY9odqkvso0DI/VrAHz3wenbC1pnCH7d2Io9DTy2e+WI9qisQWJ829Buaxco PfpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PRTLrJ8G; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 q25si3194184ios.80.2021.09.22.10.41.28; Wed, 22 Sep 2021 10:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PRTLrJ8G; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236837AbhIVRm4 (ORCPT + 99 others); Wed, 22 Sep 2021 13:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236815AbhIVRmz (ORCPT ); Wed, 22 Sep 2021 13:42:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A01D9C061574; Wed, 22 Sep 2021 10:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=P+wjbvfBuWtk4jFuBJ3sMrPTDi2tE+fy+MjarlqPFEo=; b=PRTLrJ8GeVU08BcQhuqfpDn4ss rYH1WcFN/58h3Zl2rpjfOXvUBjxpHTa/AKrLeo5x/P7UMoel4SmsBgqLGPjoi6mngTPMjKCi8FbAk QptNsKd1mQmSdLKsMB1YmrPbIGrkff9CIJl9B+5wEXfwj0He8D9G0/+tV5N9ZlPoy+YeGFNhLRwXC 6Gthxro7CPpER+XH28Cu+Mrwe8jCV2zlhlEsZSG+GuQmJI1qdg5AQ8GMazFbkHoi7gE9lKEkldrrT YCg2L1sY8IGlWW43JHcJ/WhL/zJEYDLjajT7Nat5YvFOVNK1SBxPQ9mwGUMCuG6MxURTeVJ6zpG/c Q8Bgeh1w==; Received: from [2001:4bb8:184:72db:3a8e:1992:6715:6960] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT6CZ-004zmi-KD; Wed, 22 Sep 2021 17:39:08 +0000 From: Christoph Hellwig To: Dan Williams , Vishal Verma , Dave Jiang Cc: Mike Snitzer , Matthew Wilcox , linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Ira Weiny Subject: [PATCH 3/3] block: warn if ->groups is set when calling add_disk Date: Wed, 22 Sep 2021 19:34:31 +0200 Message-Id: <20210922173431.2454024-4-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210922173431.2454024-1-hch@lst.de> References: <20210922173431.2454024-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The proper API is to pass the groups to device_add_disk, but the code used to also allow groups being set before calling *add_disk. Warn about that but keep the group pointer intact for now so that it can be removed again after a grace period. Fixes: 52b85909f85d ("block: fold register_disk into device_add_disk") Signed-off-by: Christoph Hellwig Reviewed-by: Ira Weiny Reviewed-by: Dan Williams --- block/genhd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/genhd.c b/block/genhd.c index 7b6e5e1cf9564..409cf608cc5bd 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -439,7 +439,8 @@ int device_add_disk(struct device *parent, struct gendisk *disk, dev_set_uevent_suppress(ddev, 1); ddev->parent = parent; - ddev->groups = groups; + if (!WARN_ON_ONCE(ddev->groups)) + ddev->groups = groups; dev_set_name(ddev, "%s", disk->disk_name); if (!(disk->flags & GENHD_FL_HIDDEN)) ddev->devt = MKDEV(disk->major, disk->first_minor); -- 2.30.2