From patchwork Tue Nov 15 14:10:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 1672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2740327wru; Tue, 15 Nov 2022 05:53:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf4cz3AGisJsJvCzOKnmrYqIRyZEKecD5DHy1mt3S8ctCvh9k/dDACqTvzlL03K011PZxOSm X-Received: by 2002:a05:6402:1641:b0:461:a130:ea33 with SMTP id s1-20020a056402164100b00461a130ea33mr15412957edx.51.1668520386011; Tue, 15 Nov 2022 05:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668520386; cv=none; d=google.com; s=arc-20160816; b=WzaIRn2MAgVWFBqQr7BfRrNtrcvHJ+AdOGEzl3iCRgZOxyoHLZpQ/IAXx2B+SzlmVC udKa9I+j3xefGrckJGFQo/aKrr4vtfRMFhTX/PEiMtaRSoCGvSSeDuic/9+MfRXyNeL0 TzkLLv79XDaFNqlxUI66+TcEghA7dpf4BM6vqS6gENxPMiHEV3majo9Veyrc4vE08syd OT8Y8US4NN4AmSZKHXGEcOoPR8oJ/0imYwFJfSu1A8p1ROSOSAlxsO4zOPkK2rkLmAwJ ZBo3Grb8rSA/kg9HRc3b1ccHsqcZGuqEgZazvbLiA0JQW/81urZ8abI5hAoWEgrcq1p/ 7qSw== 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=kR9xAFgBz/W15nlRRTVPEzOTLugRl9GvUwP8YIdhIWE=; b=cUSAFpEEGgIE8PTeAiqnk7rs2wEINqYguDIDuHZcGWiRO1J4Zq4WmAxmfC2WVShU+3 hmuq1vEztPlYEB5GVHnl0JRgmvL2uM4B5BnRbs40Y5R/+j6yGpHVUAGAoyrHlwpue9Rc L7kM+Fm+wBHJmKSVTIPVjlUlo1OuY26xHvAO/xyOLPpWIJApokwTGLQBGyOTP6Rj8pk+ r+cesZz9TkGoATAPUiG/H8rKYVHPE1nQ1oZhLX1Bw1QaAUy26ukRe1xqboFPL4ZHLgUM 8c+FRh9CZdEyH/upGCrLsyg+EAm9ctNCmNYvA3vZ50vUa4NGmuIiv5Cww/XhTu9SIu4W PP4A== 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 l26-20020a056402029a00b00461acb2deebsi11009363edv.198.2022.11.15.05.52.42; Tue, 15 Nov 2022 05:53:06 -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 S238367AbiKONti (ORCPT + 99 others); Tue, 15 Nov 2022 08:49:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbiKONtg (ORCPT ); Tue, 15 Nov 2022 08:49:36 -0500 Received: from dggsgout12.his.huawei.com (unknown [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F442497F; Tue, 15 Nov 2022 05:49:33 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4NBSGG0jBXz4f41hZ; 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--.61645S4; Tue, 15 Nov 2022 21:49:29 +0800 (CST) From: Yu Kuai 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 00/10] fix delayed holder tracking Date: Tue, 15 Nov 2022 22:10:44 +0800 Message-Id: <20221115141054.1051801-1-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgBni9jnmHNjrPFIAg--.61645S4 X-Coremail-Antispam: 1UD129KBjvJXoWruFyUZr1fuw1DAw17Jw1rXrb_yoW8JF48pF ZxWa4fKFyUurWIqa13Aw17XFyrGan7K3WxJry7Kr1Fqry5Cry5ZF1xtF18tFyUGrZ7trnr Xry7t3yfGw4vk3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvY14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0J UdHUDUUUUU= 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749570431952811200?= X-GMAIL-MSGID: =?utf-8?q?1749570431952811200?= From: Yu Kuai Hi all, this series tries to fix the delayed holder tracking that is only used by dm by moving it into dm, where we can track the lifetimes much better. v2 is from Christoph, here I send v3 with some additional fixes. Changes since v2: - add patch 5 8 and 10 to this series. - rewrite last cleanup patch from v2. Changes since v1: - don't blow away ->bd_holder_dir in del_gendisk or add_disk failure as the holder unregistration references it - add an extra cleanup patch Christoph Hellwig (6): block: clear ->slave_dir when dropping the main slave_dir reference dm: remove free_table_devices dm: cleanup open_table_device dm: cleanup close_table_device dm: track per-add_disk holder relations in DM block: remove delayed holder registration Yu Kuai (4): dm: make sure create and remove dm device won't race with open and close table block: fix use after free for bd_holder_dir block: store the holder kobject in bd_holder_disk block: don't allow a disk link holder to itself block/genhd.c | 6 +- block/holder.c | 103 +++++++++++++----------------- drivers/md/dm.c | 138 ++++++++++++++++++++++++----------------- include/linux/blkdev.h | 5 -- 4 files changed, 126 insertions(+), 126 deletions(-)