All of lore.kernel.org
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 4.19-stable tree
@ 2019-10-01 17:02 gregkh
  2019-10-01 23:55 ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2019-10-01 17:02 UTC (permalink / raw)
  To: ming.lei, axboe, bvanassche, emilne, hare, hch, snitzer, stable; +Cc: stable


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 <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From b7e9e1fb7a9227be34ad4a5e778022c3164494cf Mon Sep 17 00:00:00 2001
From: Ming Lei <ming.lei@redhat.com>
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 <emilne@redhat.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: dm-devel@redhat.com
Cc: <stable@vger.kernel.org>
Fixes: 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

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,
 };


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 4.19-stable tree
  2019-10-01 17:02 FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 4.19-stable tree gregkh
@ 2019-10-01 23:55 ` Sasha Levin
  2019-10-03  7:52   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2019-10-01 23:55 UTC (permalink / raw)
  To: gregkh; +Cc: ming.lei, axboe, bvanassche, emilne, hare, hch, snitzer, stable

On Tue, Oct 01, 2019 at 07:02:45PM +0200, gregkh@linuxfoundation.org wrote:
>
>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 <stable@vger.kernel.org>.

I saw that it was also dropped from 5.3/5.2 for build errors. To resolve
those I took 226b4fc75c78 ("blk-mq: add callback of .cleanup_rq") which
is also tagged for stable.

For 4.19 there were some context changes due to the removal of the
legacy IO code (6a23e05c2fe3c ("dm: remove legacy request-based IO
path") et al).

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 4.19-stable tree
  2019-10-01 23:55 ` Sasha Levin
@ 2019-10-03  7:52   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2019-10-03  7:52 UTC (permalink / raw)
  To: Sasha Levin
  Cc: ming.lei, axboe, bvanassche, emilne, hare, hch, snitzer, stable

On Tue, Oct 01, 2019 at 07:55:09PM -0400, Sasha Levin wrote:
> On Tue, Oct 01, 2019 at 07:02:45PM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > 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 <stable@vger.kernel.org>.
> 
> I saw that it was also dropped from 5.3/5.2 for build errors. To resolve
> those I took 226b4fc75c78 ("blk-mq: add callback of .cleanup_rq") which
> is also tagged for stable.
> 
> For 4.19 there were some context changes due to the removal of the
> legacy IO code (6a23e05c2fe3c ("dm: remove legacy request-based IO
> path") et al).

Ah, I missed that dependancy, thanks for fixing this all up.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-03  7:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 17:02 FAILED: patch "[PATCH] scsi: implement .cleanup_rq callback" failed to apply to 4.19-stable tree gregkh
2019-10-01 23:55 ` Sasha Levin
2019-10-03  7:52   ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.