From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C591C43445 for ; Tue, 14 Jul 2020 14:43:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3181A2064B for ; Tue, 14 Jul 2020 14:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594737802; bh=5BqS2uKoCv8IZQb/gAzETBypxxWJHQ1jqkWzuhumoAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=u1viPw0e/mcR718Niv60BIhLnpesMjSsy8S1u/uXhbI8Jd1PheEtnl2T/syT3Nn3C dXqZaCGByG5DDUs0CeswgZu4UxyBkh71EwbvrF1ztFymFxXEJCWl95d8aFM7xTCn6X CaBZ9JS6EN04SQM1OUVZhW3sgADa9+d/eSnd8LQ0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729055AbgGNOjl (ORCPT ); Tue, 14 Jul 2020 10:39:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729019AbgGNOjg (ORCPT ); Tue, 14 Jul 2020 10:39:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6E632255F; Tue, 14 Jul 2020 14:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594737575; bh=5BqS2uKoCv8IZQb/gAzETBypxxWJHQ1jqkWzuhumoAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wtWAZJMhwOb1BitKu5lJTQ7sr5KaX/Jzxh4YL33aTluxAlo9SKXy7r3S62/qXu/XO 5BCpMCSs3mc88mVRb8I6DeYtcAojC5H5QUQV/kSxq9o6ii5nkgyGBsu1/r3beTFNnx Eq8VGCFi8oLmHHE6bCOXKVbhl566C8QnDlGME1DA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Johannes Thumshirn , Mike Snitzer , Sasha Levin , dm-devel@redhat.com Subject: [PATCH AUTOSEL 5.4 17/18] dm: use bio_uninit instead of bio_disassociate_blkg Date: Tue, 14 Jul 2020 10:39:13 -0400 Message-Id: <20200714143914.4035489-17-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200714143914.4035489-1-sashal@kernel.org> References: <20200714143914.4035489-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit 382761dc6312965a11f82f2217e16ec421bf17ae ] bio_uninit is the proper API to clean up a BIO that has been allocated on stack or inside a structure that doesn't come from the BIO allocator. Switch dm to use that instead of bio_disassociate_blkg, which really is an implementation detail. Note that the bio_uninit calls are also moved to the two callers of __send_empty_flush, so that they better pair with the bio_init calls used to initialize them. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 1e6e0c970e190..6d6b96a1c5103 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1436,9 +1436,6 @@ static int __send_empty_flush(struct clone_info *ci) BUG_ON(bio_has_data(ci->bio)); while ((ti = dm_table_get_target(ci->map, target_nr++))) __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); - - bio_disassociate_blkg(ci->bio); - return 0; } @@ -1626,6 +1623,7 @@ static blk_qc_t __split_and_process_bio(struct mapped_device *md, ci.bio = &flush_bio; ci.sector_count = 0; error = __send_empty_flush(&ci); + bio_uninit(ci.bio); /* dec_pending submits any data associated with flush */ } else if (bio_op(bio) == REQ_OP_ZONE_RESET) { ci.bio = bio; @@ -1700,6 +1698,7 @@ static blk_qc_t __process_bio(struct mapped_device *md, struct dm_table *map, ci.bio = &flush_bio; ci.sector_count = 0; error = __send_empty_flush(&ci); + bio_uninit(ci.bio); /* dec_pending submits any data associated with flush */ } else { struct dm_target_io *tio; -- 2.25.1