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 B9947ECE587 for ; Tue, 1 Oct 2019 17:02:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 91BA82054F for ; Tue, 1 Oct 2019 17:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569949372; bh=zsIkkATo7q7jNruaP+cxBtHN6HwQqjhF6uID5DFzngs=; h=Subject:To:Cc:From:Date:List-ID:From; b=HjmltcXyNKiHi3s/6sF2MHucuhQjUQoFI7sfrB4LlGPISmfiZiP3DQ0zTQ/TZ3/5q wcLEU0gEQtymHUNHRIuv+gxBA3UmHYHjpUvqtOelimL85kFZtK4zs62vKe61R7O4Eq xbEHzxgmt7Cmu+jFkgrtB6Rf12pqxxPRbPBNgd7A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728581AbfJARCv (ORCPT ); Tue, 1 Oct 2019 13:02:51 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:60713 "EHLO wout5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728546AbfJARCu (ORCPT ); Tue, 1 Oct 2019 13:02:50 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id F187A576; Tue, 1 Oct 2019 13:02:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 01 Oct 2019 13:02:49 -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=mRo19F G3YSfSqgOAl8k9vcYo/3luvuQ0dRH8sAMaLwM=; b=eVTces1aga8cLSGd2mgMVX Z+tzx6v4FZOgYIGwKzX/mZDfZzsPUKeztb9t8lr+lmsNwe3QamIsrly4vWTKBlWm tG3oY8aX+1h8pu+z/O0ZP4KbK/Q23lB0T2YodBJDKzt4RUYml8owTwliIgoXe230 Itl90MnrFcpek9KjDoxwj676rPsEFLivrICNvrs95622Rm/pYj53xbDMNuyq5sHu Am39qKIu2TXHGGgp7XAWNWJyodIH5RQ4KfbqjiGoux1ZMm+GfBYyD7C/JmJKS+I0 UWk4rzeyCPevxv9wqt9VCurHEevfTRttBbaWFMrZwu5czcSUz7KKRZzN/I/RP8vg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrgeeggddutdejucetufdoteggodetrfdotf 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 4C5818005C; Tue, 1 Oct 2019 13:02:47 -0400 (EDT) Subject: FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 4.19-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 19:02:45 +0200 Message-ID: <1569949365193105@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 4.19-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, };