Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3288479rwb; Sat, 12 Nov 2022 02:59:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VvXaz7bevc/GTO2aFhyAz2/NYvZYUrRh8gY8u9R5OvuRChyVDhedh2ts2eQ4Y8mfk+V+0 X-Received: by 2002:a17:902:7449:b0:186:de87:7ffd with SMTP id e9-20020a170902744900b00186de877ffdmr6149524plt.94.1668250740191; Sat, 12 Nov 2022 02:59:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668250740; cv=none; d=google.com; s=arc-20160816; b=OKt69zPiG/3+hxVKeub/X0Jwa0DL51rpkrE+I3Aeaiv7vr10mghz8FKvBBg9DXB2qZ VXM35pIAFWe8rNOwK2NlWGXMfJkGGR2eNn2enrLetLuaGiJhIqY+83JIkjk0s3vtoNaq ImWBYHqUmkFQROJSIfMqKFqCzA32fpwjq/s3iTfgSahbfdnyvTswT3YlQ9TmydxYDlc6 QBGPM9lrOefZMlmOu3QqRtUNV/NNtatWX9pNsXJ5X0nZxjtkUpodEpM74Hv2MYM50HvA 4eP+vWmSRjJVLlc/RmWK/ZYbNWmgCtwn2veHGakuNxxHvAREHPyX2Kzh7pWHljgEOqxo /Frw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=J5M5VpHU4kjUOr0VfR2hWcuBCxSkyE/0yieEo8BiUVc=; b=sq0hWDGnnndI9yXRsC7dxhBaxkDL2mRm7AEEuZ/GM7a/k+3p2ItotPqO6Xv9JAN/JS 5eQ/dDJjSD4rVMG2eyBZbNLiZregppwcVDa4lHMloWL0uIeK5fRPnURUiOk74SA/mX93 ZxxvljHwaxycJAugdZtTTfkJyqqoxNwt5IGpvEgU04AFQHCaLtDL8JdqQRvf0mO+iJQ7 0cZYFIP0UV8y6caCWLHSloVE56vaPe6/08Zs2pOCNy4ZNpf0LVv1NWw8agQ/Te3hOMf/ yy+pM6G4dwAihNoqwscgTqvGiV7VH5eCSpqubrVg1NtFnO3X6igN8npuscAg4+zwcbNJ 2R+Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a170902aa4400b00176d89d640asi4520793plr.440.2022.11.12.02.58.48; Sat, 12 Nov 2022 02:59:00 -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 S234866AbiKLKop (ORCPT + 90 others); Sat, 12 Nov 2022 05:44:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbiKLKon (ORCPT ); Sat, 12 Nov 2022 05:44:43 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46830140F9; Sat, 12 Nov 2022 02:44:42 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4N8XJN2h3nz4f3jZK; Sat, 12 Nov 2022 18:44:36 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP4 (Coremail) with SMTP id gCh0CgC329gWeW9j+BWaAQ--.8709S3; Sat, 12 Nov 2022 18:44:39 +0800 (CST) Subject: Re: [PATCH] blk-mq: only unregister sysfs when registration succeeded To: Liu Shixin , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, "yukuai (C)" References: <20221112110754.1109979-1-liushixin2@huawei.com> From: Yu Kuai Message-ID: <607beb5b-8d54-b795-8a05-76352d7ed863@huaweicloud.com> Date: Sat, 12 Nov 2022 18:44:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20221112110754.1109979-1-liushixin2@huawei.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgC329gWeW9j+BWaAQ--.8709S3 X-Coremail-Antispam: 1UD129KBjvdXoWrZw1DJrW3AFW3KF43Aw4fKrg_yoWftwc_Wa y0kFy8Kan8GrnIkw12kFy8ZrySkay8XF47GrZrXFZFy3WkXFZ5GwsI9r18Xw43Ga1xuFsx tr1DA34rWr1IqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb78YFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kEwV A0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x02 67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0E wIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E74 80Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0 I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04 k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY 1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU1CPfJUUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 Hi, ?? 2022/11/12 19:07, Liu Shixin ะด??: > kobject_del() must not be called if kobject_add() has not been called. > Hence only unregister sysfs when registration succeeded. > From what I see, the blk_queue_registered() from caller blk_unregister_queue() can already prevent that. QUEUE_FLAG_REGISTERED will only be set if blk_register_queue() succeed. Thanks, Kuai > Signed-off-by: Liu Shixin > --- > block/blk-mq-sysfs.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c > index 93997d297d42..63f2df2500d9 100644 > --- a/block/blk-mq-sysfs.c > +++ b/block/blk-mq-sysfs.c > @@ -279,6 +279,8 @@ void blk_mq_sysfs_unregister(struct gendisk *disk) > unsigned long i; > > lockdep_assert_held(&q->sysfs_dir_lock); > + if (!q->mq_sysfs_init_done) > + return; > > queue_for_each_hw_ctx(q, hctx, i) > blk_mq_unregister_hctx(hctx); >