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 52610ECE587 for ; Tue, 1 Oct 2019 19:20:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D3202133F for ; Tue, 1 Oct 2019 19:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569957631; bh=kuTSz4N6XGxAb0+6AIBcM2xLIAj/DkIxCNkdFzr1E7M=; h=Subject:To:Cc:From:Date:List-ID:From; b=jLqp7UCKGLTYOh4HvliMD4/JgT+wI3G+kdaKXiy0b3hhFfIEr4pNhLYtXFL/ZlwS5 BzHzz5h7xogmRT5UFSx+SPhZxfjL5/JZNp7ieVbTAtYQwMRstp6hpPcHGPpbNltl+O OPeIK9O7PJnux+9bHMYPFKQlJcA/9nQogGctHGZk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726912AbfJATUa (ORCPT ); Tue, 1 Oct 2019 15:20:30 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:43073 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbfJATUa (ORCPT ); Tue, 1 Oct 2019 15:20:30 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0C62E22237; Tue, 1 Oct 2019 15:20:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 01 Oct 2019 15:20:30 -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=O00gOj sdKhbuKMCI1d5UvaRL7rRDnYcd2/9unqMPr3Q=; b=VaF4mrM4z1Jw4OjJ0Y2WTy 4qf7bqNat/ewFlW8K5+K8iOjO+dhugoYs3alaGBgsrgSyYJ4ZUG+BKA/UJ9o8RgO QijdTr7RY75jWBJ8RRnEbtAiAmm6CYHmRPiYYYYrNK6TueO7FdcxOdIuDtK9i+0E DB1FC/DnYvrNDt2YRVsPSyljenTVOY+valh1nCKlGOL/xntn8BWnD9WPxB+RmBzd BGhc/VcxSRJWXQTahcrPqJyypoAX9VM6a5J2g+vBGAoJ7Iw1RHqeFxIC9/45Nuz0 ZbIgUNSE0JkZEL+Tgtxa+b3XREXSJuxcTvC+CPQO86k6xkFy1GX8kovyYKeiSK4Q == 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 7B93F8005B; Tue, 1 Oct 2019 15:20:29 -0400 (EDT) Subject: FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 5.2-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:44 +0200 Message-ID: <156995728498230@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.2-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, };