From patchwork Sat Oct 22 16:07:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 7899 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1257674wrr; Sat, 22 Oct 2022 08:47:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+NUZoK1v3hQA3k2TYMYgPepQi9jLpuh8zXddi8Jd6Z5Ko+Q4HykACyV3obS59q4A+qnIa X-Received: by 2002:a17:907:1b22:b0:741:8809:b4e6 with SMTP id mp34-20020a1709071b2200b007418809b4e6mr20614843ejc.84.1666453636254; Sat, 22 Oct 2022 08:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666453636; cv=none; d=google.com; s=arc-20160816; b=NX2g6Q4A0TS7DbKaceS+9fRqrIXLCU8xmi4MeW9ca5sfLxBw/KUErc+fX5JTQjXI/0 U5CWLQxSRv4Aefh9BeWbXQcLRBGK57Uo0C3rasb4V+jsjm/hbpejb5tc7CrogaLTXXY/ w+cokO4pidV/cir53nXJ9oygeSsrm3t9BszhDCYmhw1DIyIal2CNSBtE3PuEYjxxAatP MgQk2HhA1PrimDLkvPM3VVfcVWEu77NCLREfAqJuH68gCGaLpgUEUqYHXARZAWo1cOSU mQs2q0I90LqxfuoGl34L0L+jj5N7E5Tazn51y3dKaBj7kvUXE0IUffmmRf45pzbsjSsx On4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=W2US2sanTHCvEvekg5xOsEe4hlPklqoA7akEgbfkwXk=; b=TkvvKJfJARPoPHNoLXWemlDn3f1BAofTSztIzvvlV0rt6VPzfXoXuKM8jYTgh1Mfuk Fr3qApmif8GYZ0gTv4bOV22iptYLc4/Zj7lmk03eVFDsDVEdWxxyK9SQYPRA9CZHGyJO +iyBXBfWjIr4Ob1BWHPUdfJ8d86L7tQbyYROuA6+z4tjtQRSBnVVYbF36EWgp8ImCGa7 yCfwX3PYI68U193YzCgbxo/f0P2++5lICwxyjBQ4GcpCO2cwz7v0vrkC+PP9g1LzrqOb CSlfMd74Xf1vqCttIGZfPFd2z4azH1Ooo1zCctGcpK07pLgB78q4hcsNFa9/0bdeimdI +QDQ== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xf13-20020a17090731cd00b00788361f96a2si25721138ejb.776.2022.10.22.08.46.51; Sat, 22 Oct 2022 08:47:16 -0700 (PDT) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbiJVPgy (ORCPT + 99 others); Sat, 22 Oct 2022 11:36:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiJVPgx (ORCPT ); Sat, 22 Oct 2022 11:36:53 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D33927173; Sat, 22 Oct 2022 08:36:52 -0700 (PDT) Received: from fraeml736-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MvljN1C7qz67Q9H; Sat, 22 Oct 2022 23:33:28 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml736-chm.china.huawei.com (10.206.15.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 22 Oct 2022 17:36:49 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 22 Oct 2022 16:36:47 +0100 From: John Garry To: CC: , , , John Garry Subject: [PATCH] blk-mq: Properly init bios from blk_mq_alloc_request_hctx() Date: Sun, 23 Oct 2022 00:07:26 +0800 Message-ID: <1666454846-11749-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,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?1747403288326704216?= X-GMAIL-MSGID: =?utf-8?q?1747403288326704216?= Function blk_mq_alloc_request_hctx() is missing zeroing/init of rq->bio, biotail, __sector, and __data_len members, which blk_mq_alloc_request() has. Move init'ing of those members to common blk_mq_rq_ctx_init(). Fixes: 1f5bd336b9150 ("blk-mq: add blk_mq_alloc_request_hctx") Suggested-by: Bart Van Assche Signed-off-by: John Garry diff --git a/block/blk-mq.c b/block/blk-mq.c index 8070b6c10e8d..260adeb2e455 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -402,6 +402,10 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, } } + rq->__data_len = 0; + rq->__sector = (sector_t) -1; + rq->bio = rq->biotail = NULL; + return rq; } @@ -591,9 +595,6 @@ struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf, if (!rq) goto out_queue_exit; } - rq->__data_len = 0; - rq->__sector = (sector_t) -1; - rq->bio = rq->biotail = NULL; return rq; out_queue_exit: blk_queue_exit(q);