public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	Alexander Atanasov <alexander.atanasov@virtuozzo.com>,
	Ming Lei <ming.lei@redhat.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 5.10 7/7] scsi: core: Always send batch on reset or error handling command
Date: Thu, 11 Jan 2024 10:52:56 +0100	[thread overview]
Message-ID: <20240111094700.571797003@linuxfoundation.org> (raw)
In-Reply-To: <20240111094700.222742213@linuxfoundation.org>

5.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Atanasov <alexander.atanasov@virtuozzo.com>

commit 066c5b46b6eaf2f13f80c19500dbb3b84baabb33 upstream.

In commit 8930a6c20791 ("scsi: core: add support for request batching") the
block layer bd->last flag was mapped to SCMD_LAST and used as an indicator
to send the batch for the drivers that implement this feature. However, the
error handling code was not updated accordingly.

scsi_send_eh_cmnd() is used to send error handling commands and request
sense. The problem is that request sense comes as a single command that
gets into the batch queue and times out. As a result the device goes
offline after several failed resets. This was observed on virtio_scsi
during a device resize operation.

[  496.316946] sd 0:0:4:0: [sdd] tag#117 scsi_eh_0: requesting sense
[  506.786356] sd 0:0:4:0: [sdd] tag#117 scsi_send_eh_cmnd timeleft: 0
[  506.787981] sd 0:0:4:0: [sdd] tag#117 abort

To fix this always set SCMD_LAST flag in scsi_send_eh_cmnd() and
scsi_reset_ioctl().

Fixes: 8930a6c20791 ("scsi: core: add support for request batching")
Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
Link: https://lore.kernel.org/r/20231215121008.2881653-1-alexander.atanasov@virtuozzo.com
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/scsi_error.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1069,6 +1069,7 @@ retry:
 
 	scsi_log_send(scmd);
 	scmd->scsi_done = scsi_eh_done;
+	scmd->flags |= SCMD_LAST;
 
 	/*
 	 * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
@@ -2361,6 +2362,7 @@ scsi_ioctl_reset(struct scsi_device *dev
 	scsi_init_command(dev, scmd);
 	scmd->request = rq;
 	scmd->cmnd = scsi_req(rq)->cmd;
+	scmd->flags |= SCMD_LAST;
 
 	scmd->scsi_done		= scsi_reset_provider_done_command;
 	memset(&scmd->sdb, 0, sizeof(scmd->sdb));



  parent reply	other threads:[~2024-01-11  9:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11  9:52 [PATCH 5.10 0/7] 5.10.207-rc1 review Greg Kroah-Hartman
2024-01-11  9:52 ` [PATCH 5.10 1/7] Revert "scsi: core: Always send batch on reset or error handling command" Greg Kroah-Hartman
2024-01-11  9:52 ` [PATCH 5.10 2/7] Revert "scsi: core: Use a structure member to track the SCSI command submitter" Greg Kroah-Hartman
2024-01-11  9:52 ` [PATCH 5.10 3/7] Revert "scsi: core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request" Greg Kroah-Hartman
2024-01-11  9:52 ` [PATCH 5.10 4/7] Revert "scsi: core: Make scsi_get_lba() return the LBA" Greg Kroah-Hartman
2024-01-11  9:52 ` [PATCH 5.10 5/7] Revert "scsi: core: Introduce scsi_get_sector()" Greg Kroah-Hartman
2024-01-11  9:52 ` [PATCH 5.10 6/7] Revert "scsi: core: Add scsi_prot_ref_tag() helper" Greg Kroah-Hartman
2024-01-11  9:52 ` Greg Kroah-Hartman [this message]
2024-01-11 13:10 ` [PATCH 5.10 0/7] 5.10.207-rc1 review Pavel Machek
2024-01-11 23:24 ` Florian Fainelli
2024-01-12  3:20 ` Slade Watkins
2024-01-12  3:28 ` Dominique Martinet
2024-01-12  4:36 ` Naresh Kamboju
2024-01-12 14:27 ` Jon Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240111094700.571797003@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.atanasov@virtuozzo.com \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox