Message ID | 20221115141054.1051801-2-yukuai1@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2740452wru; Tue, 15 Nov 2022 05:53:23 -0800 (PST) X-Google-Smtp-Source: AA0mqf5fRoKsvtHhOefkZsdMIUP7n1S1FRUsJexIZYnDwhUGeyP816SSNlsBQl2354g//YfXt5Zw X-Received: by 2002:a65:58cc:0:b0:46e:c9d0:96c with SMTP id e12-20020a6558cc000000b0046ec9d0096cmr15699852pgu.586.1668520402987; Tue, 15 Nov 2022 05:53:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668520402; cv=none; d=google.com; s=arc-20160816; b=GkCNdtufoEH8izrOfYeXHnOOBitR4r8iJyDOyE/qU56vIAtyMWNst7Md3GaW/tOsEb AYH4sqrH9h/yWQdDPFHvYmUZI1BK9i7gxXvTwiXNCl4WRRbXJ+cL3S05dnTaKSLo1URW Ai2l/Mf5lrJREWqASd7WQscKo5fub4lFZlbqPxfaC30qF1GdVoTU1Y9c3GpiwSAog10E KXFdGNdeWyL0CPwt8YcQpaMlGsy5IUa4vmxmJeQAnvPVS6rOBV88wfYA2hfRFe++712v yuCpAYz/ednQcXai7iE/Hv/OXLlbr+cVDdJQFMPfddQbSLyaVzbNped7jyzP4ZeQHmLt YigA== 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; bh=Nq+3fXwTJfsP28E0DsZBSKvQ4mu+U5PpiKqApb32+q0=; b=jzC9U3a8NhIPLmoL3JpSf3+z58IryPw8rmxEM3WGWCIx96jYQ4i2bCSpLSX3ilu0mP I3XequdkN3JpORIHNoX0Cs1PZcv8DYs3ZVojJ/7ualZKgsdYD3kaSyU3PzsRtZ0pkAxO sTsleYeoAQZhSE6jOJmXUTnYeuajTC7Z0BsGN9roYdwkPwuuwQUU+qzfusSm7oAClG8r M8tuRdrOmHWFFhnB0yBzcGWCN1snacyknlJg2OPy6wEykHVQW3bwmWtcYxI8N6K+OeP0 D+yj/T0DCOY8jQqf//M0H464oHtgkFzs9LJmM9D5RGjlfGcHNJmHBTz4qMQbdGHULL3o at3w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020a170902ec9100b0017f9b980fadsi13852187plg.446.2022.11.15.05.53.09; Tue, 15 Nov 2022 05:53:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbiKONtn (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Tue, 15 Nov 2022 08:49:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbiKONtg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 15 Nov 2022 08:49:36 -0500 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C1F624969; Tue, 15 Nov 2022 05:49:33 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NBSGG3Cs4z4f3vdk; Tue, 15 Nov 2022 21:49:26 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgBni9jnmHNjrPFIAg--.61645S5; Tue, 15 Nov 2022 21:49:29 +0800 (CST) From: Yu Kuai <yukuai1@huaweicloud.com> To: hch@lst.de, axboe@kernel.dk, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com Subject: [PATCH v3 01/10] block: clear ->slave_dir when dropping the main slave_dir reference Date: Tue, 15 Nov 2022 22:10:45 +0800 Message-Id: <20221115141054.1051801-2-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221115141054.1051801-1-yukuai1@huaweicloud.com> References: <20221115141054.1051801-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgBni9jnmHNjrPFIAg--.61645S5 X-Coremail-Antispam: 1UD129KBjvdXoWrtrykCw4kWry3Xw4rXr45GFg_yoWkZrcEka s3C3Wkuws7Gw1ag3ZFkr1rZr40vw4YvayUuFZrXF9xGa4UJrn3J3WkWr4rAFn3GFWkK343 AF1qvFy7Crs7CjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb6AFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGwA2048vs2IY02 0Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM2 8EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AI xVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20x vE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xv r2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2IY04 v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8 JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbec_DUUUUU= = X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749570450237066580?= X-GMAIL-MSGID: =?utf-8?q?1749570450237066580?= |
Series |
fix delayed holder tracking
|
|
Commit Message
Yu Kuai
Nov. 15, 2022, 2:10 p.m. UTC
From: Christoph Hellwig <hch@lst.de> Zero out the pointer to ->slave_dir so that the holder code doesn't incorrectly treat the object as alive when add_disk failed or after del_gendisk was called. Fixes: 89f871af1b26 ("dm: delay registering the gendisk") Reported-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- block/genhd.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
On Tue, Nov 15 2022 at 9:10P -0500, Yu Kuai <yukuai1@huaweicloud.com> wrote: > From: Christoph Hellwig <hch@lst.de> > > Zero out the pointer to ->slave_dir so that the holder code doesn't > incorrectly treat the object as alive when add_disk failed or after > del_gendisk was called. > > Fixes: 89f871af1b26 ("dm: delay registering the gendisk") > Reported-by: Yu Kuai <yukuai3@huawei.com> > Signed-off-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Mike Snitzer <snitzer@kernel.org>
diff --git a/block/genhd.c b/block/genhd.c index 74026ce31405..e9501c66ba4d 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -530,6 +530,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, rq_qos_exit(disk->queue); out_put_slave_dir: kobject_put(disk->slave_dir); + disk->slave_dir = NULL; out_put_holder_dir: kobject_put(disk->part0->bd_holder_dir); out_del_integrity: @@ -634,6 +635,7 @@ void del_gendisk(struct gendisk *disk) kobject_put(disk->part0->bd_holder_dir); kobject_put(disk->slave_dir); + disk->slave_dir = NULL; part_stat_set_all(disk->part0, 0); disk->part0->bd_stamp = 0;