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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 C3AADC352AA for ; Tue, 1 Oct 2019 19:20:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B0DD2133F for ; Tue, 1 Oct 2019 19:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569957630; bh=/XDOWSZO8LBOczsWfcTQRq3ckr2yyvmp39tOzvTyJ14=; h=Subject:To:Cc:From:Date:List-ID:From; b=Co+3sU39mPQFXv+r414YqHyL5d3UEO1m6VA4EHBsE5s4jiRP2GSldA67KoFg2cXIu HQTqGOnsXSsdHzq11uSikrRBHCQEwJTOGEHbtJCQDr5wRGTk3H1w0DqxR1dyWTzAoT O0G2Qx2/3r7MvNZS4rbtacBAQk8w8LCJ12SOH+A0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbfJATUa (ORCPT ); Tue, 1 Oct 2019 15:20:30 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:39431 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbfJATU3 (ORCPT ); Tue, 1 Oct 2019 15:20:29 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3810E224EE; Tue, 1 Oct 2019 15:20:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 01 Oct 2019 15:20:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=l6nNdZ ZM24Pkw5iL71ChNSglh+qjzyYS8aiVukaF1ZA=; b=mCCrTUdtjhyHooEZ5NA9+E MfhAbNdDWk/JKCYxsGN9nGYikFUMc7BvjOHfY6nHqnlfmu35zO02C7r+ndaIP38Z 7mvwpw2Nm6S7sKHP9zAyAoJi2tJH4B8SxcScGjt4OC1IomynUkuARx/GlI/oKAJA /2jq8gnN6TBxLP2945qeZ+apMob6LOoAW8nk1PKpOE62Z73bu9BBQK3CyDqG6gpu ZcaMU5Vu7g7cNMoIhkg2rVbqSP0rTtc+HCEmMXNv2rQWC6/P/8FE3UVta7mTeewo 77j+2Bq643NMiiIol5Ze27HiZdT89dVeisPv8dfrUbPNaLuQHC2r8rrSIxJtmjRA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrgeeggddufeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id CCA4B8006A; Tue, 1 Oct 2019 15:20:27 -0400 (EDT) Subject: FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 5.3-stable tree To: ming.lei@redhat.com, axboe@kernel.dk, bvanassche@acm.org, emilne@redhat.com, hare@suse.com, hch@lst.de, snitzer@redhat.com, stable@vger.kernel.org Cc: From: Date: Tue, 01 Oct 2019 21:14:42 +0200 Message-ID: <1569957282145249@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.3-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b7e9e1fb7a9227be34ad4a5e778022c3164494cf Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Thu, 25 Jul 2019 10:05:00 +0800 Subject: [PATCH] scsi: implement .cleanup_rq callback Implement .cleanup_rq() callback for freeing driver private part of the request. Then we can avoid to leak this part if the request isn't completed by SCSI, and freed by blk-mq or upper layer(such as dm-rq) finally. Cc: Ewan D. Milne Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Mike Snitzer Cc: dm-devel@redhat.com Cc: Fixes: 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback") Signed-off-by: Ming Lei Signed-off-by: Jens Axboe diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 11e64b50497f..4e88d7e9cf9a 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1089,6 +1089,18 @@ static void scsi_initialize_rq(struct request *rq) cmd->retries = 0; } +/* + * Only called when the request isn't completed by SCSI, and not freed by + * SCSI + */ +static void scsi_cleanup_rq(struct request *rq) +{ + if (rq->rq_flags & RQF_DONTPREP) { + scsi_mq_uninit_cmd(blk_mq_rq_to_pdu(rq)); + rq->rq_flags &= ~RQF_DONTPREP; + } +} + /* Add a command to the list used by the aacraid and dpt_i2o drivers */ void scsi_add_cmd_to_list(struct scsi_cmnd *cmd) { @@ -1821,6 +1833,7 @@ static const struct blk_mq_ops scsi_mq_ops = { .init_request = scsi_mq_init_request, .exit_request = scsi_mq_exit_request, .initialize_rq_fn = scsi_initialize_rq, + .cleanup_rq = scsi_cleanup_rq, .busy = scsi_mq_lld_busy, .map_queues = scsi_map_queues, };