All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled
@ 2020-12-07 22:10 Ewan D. Milne
  2020-12-09 17:51 ` Christoph Hellwig
  2021-01-08  4:19 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Ewan D. Milne @ 2020-12-07 22:10 UTC (permalink / raw)
  To: linux-scsi

The block layer code will split a large zeroout request into multiple bios
and if WRITE SAME is disabled because the storage device reports that it
does not support it (or support the length used), we can get an error message
from the block layer despite the setting of RQF_QUIET on the first request.
This is because more than one request may have already been submitted.

Fix this by setting RQF_QUIET when BLK_STS_TARGET is returned to fail the
request early, we don't need to log a message because we did not actually
submit the command to the device, and the block layer code will handle the
error by submitting individual write bios.

Signed-off-by: Ewan D. Milne <emilne@redhat.com>
---
 drivers/scsi/sd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b1267f1f3a89..1032905bbe76 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -874,8 +874,10 @@ static blk_status_t sd_setup_write_zeroes_cmnd(struct scsi_cmnd *cmd)
 		}
 	}
 
-	if (sdp->no_write_same)
+	if (sdp->no_write_same) {
+		rq->rq_flags |= RQF_QUIET;
 		return BLK_STS_TARGET;
+	}
 
 	if (sdkp->ws16 || lba > 0xffffffff || nr_blocks > 0xffff)
 		return sd_setup_write_same16_cmnd(cmd, false);
-- 
2.18.1


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

* Re: [PATCH] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled
  2020-12-07 22:10 [PATCH] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled Ewan D. Milne
@ 2020-12-09 17:51 ` Christoph Hellwig
  2021-01-08  4:19 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-12-09 17:51 UTC (permalink / raw)
  To: Ewan D. Milne; +Cc: linux-scsi

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCH] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled
  2020-12-07 22:10 [PATCH] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled Ewan D. Milne
  2020-12-09 17:51 ` Christoph Hellwig
@ 2021-01-08  4:19 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-01-08  4:19 UTC (permalink / raw)
  To: Ewan D. Milne, linux-scsi; +Cc: Martin K . Petersen

On Mon, 7 Dec 2020 17:10:21 -0500, Ewan D. Milne wrote:

> The block layer code will split a large zeroout request into multiple bios
> and if WRITE SAME is disabled because the storage device reports that it
> does not support it (or support the length used), we can get an error message
> from the block layer despite the setting of RQF_QUIET on the first request.
> This is because more than one request may have already been submitted.
> 
> Fix this by setting RQF_QUIET when BLK_STS_TARGET is returned to fail the
> request early, we don't need to log a message because we did not actually
> submit the command to the device, and the block layer code will handle the
> error by submitting individual write bios.

Applied to 5.11/scsi-fixes, thanks!

[1/1] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled
      https://git.kernel.org/mkp/scsi/c/e5cc9002caaf

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-01-08  4:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 22:10 [PATCH] scsi: sd: suppress suprious block errors when WRITE SAME is being disabled Ewan D. Milne
2020-12-09 17:51 ` Christoph Hellwig
2021-01-08  4:19 ` Martin K. Petersen

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.