All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Jaegeuk Kim <jaegeuk@kernel.org>,
	Avri Altman <avri.altman@wdc.com>,
	Bart Van Assche <bvanassche@acm.org>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>
Subject: [PATCH 7/8] scsi: Retry unaligned zoned writes
Date: Mon,  9 Jan 2023 15:27:37 -0800	[thread overview]
Message-ID: <20230109232738.169886-8-bvanassche@acm.org> (raw)
In-Reply-To: <20230109232738.169886-1-bvanassche@acm.org>

From ZBC-2: "The device server terminates with CHECK CONDITION status, with
the sense key set to ILLEGAL REQUEST, and the additional sense code set to
UNALIGNED WRITE COMMAND a write command, other than an entire medium write
same command, that specifies: a) the starting LBA in a sequential write
required zone set to a value that is not equal to the write pointer for that
sequential write required zone; or b) an ending LBA that is not equal to the
last logical block within a physical block (see SBC-5)."

I am not aware of any other conditions that may trigger the UNALIGNED
WRITE COMMAND response.

Retry unaligned writes in preparation of removing zone locking.

Increase the number of retries for write commands sent to a sequential
zone to the maximum number of outstanding commands.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_error.c | 7 +++++++
 drivers/scsi/sd.c         | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index a7960ad2d386..e17f36b0b18a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -676,6 +676,13 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)
 		fallthrough;
 
 	case ILLEGAL_REQUEST:
+		/*
+		 * Unaligned write command. Retry immediately if pipelining
+		 * zoned writes has been enabled.
+		 */
+		if (sshdr.asc == 0x21 && sshdr.ascq == 0x04 &&
+		    blk_queue_pipeline_zoned_writes(sdev->request_queue))
+			return NEEDS_RETRY;
 		if (sshdr.asc == 0x20 || /* Invalid command operation code */
 		    sshdr.asc == 0x21 || /* Logical block address out of range */
 		    sshdr.asc == 0x22 || /* Invalid function */
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 47dafe6b8a66..cd90b54a6597 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1207,6 +1207,9 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
 	cmd->transfersize = sdp->sector_size;
 	cmd->underflow = nr_blocks << 9;
 	cmd->allowed = sdkp->max_retries;
+	if (blk_queue_pipeline_zoned_writes(rq->q) &&
+	    blk_rq_is_seq_zone_write(rq))
+		cmd->allowed += rq->q->nr_requests;
 	cmd->sdb.length = nr_blocks * sdp->sector_size;
 
 	SCSI_LOG_HLQUEUE(1,

  parent reply	other threads:[~2023-01-09 23:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 23:27 [PATCH 0/8] Enable zoned write pipelining for UFS devices Bart Van Assche
2023-01-09 23:27 ` [PATCH 1/8] block: Document blk_queue_zone_is_seq() and blk_rq_zone_is_seq() Bart Van Assche
2023-01-09 23:36   ` Damien Le Moal
2023-01-09 23:27 ` [PATCH 2/8] block: Introduce the blk_rq_is_seq_zone_write() function Bart Van Assche
2023-01-09 23:38   ` Damien Le Moal
2023-01-09 23:52     ` Bart Van Assche
2023-01-10  9:52       ` Niklas Cassel
2023-01-10 11:54         ` Damien Le Moal
2023-01-10 12:13           ` Niklas Cassel
2023-01-10 12:41             ` Damien Le Moal
2023-01-09 23:27 ` [PATCH 3/8] block: Introduce a request queue flag for pipelining zoned writes Bart Van Assche
2023-01-09 23:27 ` [PATCH 4/8] block/mq-deadline: Only use zone locking if necessary Bart Van Assche
2023-01-09 23:46   ` Damien Le Moal
2023-01-09 23:51     ` Bart Van Assche
2023-01-09 23:56       ` Damien Le Moal
2023-01-10  0:19         ` Bart Van Assche
2023-01-10  0:32           ` Damien Le Moal
2023-01-10  0:38             ` Jens Axboe
2023-01-10  0:41               ` Jens Axboe
2023-01-10  0:44                 ` Bart Van Assche
2023-01-10  0:48                   ` Jens Axboe
2023-01-10  0:56                     ` Bart Van Assche
2023-01-10  1:03                       ` Jens Axboe
2023-01-10  1:17                         ` Bart Van Assche
2023-01-10  1:48                           ` Jens Axboe
2023-01-10  2:24                     ` Damien Le Moal
2023-01-10  3:00                       ` Jens Axboe
2023-01-09 23:27 ` [PATCH 5/8] block/null_blk: Refactor null_queue_rq() Bart Van Assche
2023-01-09 23:27 ` [PATCH 6/8] block/null_blk: Add support for pipelining zoned writes Bart Van Assche
2023-01-09 23:27 ` Bart Van Assche [this message]
2023-01-09 23:51   ` [PATCH 7/8] scsi: Retry unaligned " Damien Le Moal
2023-01-09 23:55     ` Bart Van Assche
2023-01-09 23:27 ` [PATCH 8/8] scsi: ufs: Enable zoned write pipelining Bart Van Assche
2023-01-10  9:16   ` Avri Altman
2023-01-10 17:42     ` Bart Van Assche
2023-01-10 12:23   ` Bean Huo
2023-01-10 17:41     ` Bart Van Assche

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=20230109232738.169886-8-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 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.