public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Chris Bainbridge <chris.bainbridge@gmail.com>
Cc: fengli@smartx.com, hch@lst.de, martin.petersen@oracle.com,
	axboe@kernel.dk, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [REGRESSION] critical target error, bisected
Date: Thu, 15 Aug 2024 23:56:01 -0400	[thread overview]
Message-ID: <yq1ikw1qg49.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <Zrog4DYXrirhJE7P@debian.local> (Chris Bainbridge's message of "Mon, 12 Aug 2024 15:49:04 +0100")


Chris,

> [  195.647081] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_OK cmd_age=0s
> [  195.647093] sd 0:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current]
> [  195.647096] sd 0:0:0:0: [sda] tag#0 Add. Sense: Invalid command operation code
> [  195.647099] sd 0:0:0:0: [sda] tag#0 CDB: Write same(16) 93 08 00 00 00 00 04 dd 42 f8 00 00 2d 48 00 00
> [  195.647101] critical target error, dev sda, sector 81609464 op 0x3:(DISCARD) flags 0x800 phys_seg 1 prio class 0

I would appreciate if you could test the following patch.

Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

From dcbe0126551fedef94fd8334288e5b2bb6059475 Mon Sep 17 00:00:00 2001
From: "Martin K. Petersen" <martin.petersen@oracle.com>
Date: Tue, 13 Aug 2024 03:58:27 -0400
Subject: [PATCH] scsi: sd: Do not attempt to configure discard unless LBPME is
 set

Commit f874d7210d88 ("scsi: sd: Keep the discard mode stable")
attempted to address an issue where one mode of discard operation got
configured prior to the device completing full discovery.
Unfortunately this change assumed discard was always enabled on the
device.

Do not attempt to configure discard unless LBPME is set.

Fixes: f874d7210d88 ("scsi: sd: Keep the discard mode stable")
Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 699f4f9674d9..966fc717d235 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3308,6 +3308,9 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
 
 static unsigned int sd_discard_mode(struct scsi_disk *sdkp)
 {
+	if (!sdkp->lbpme)
+		return SD_LBP_DISABLE;
+
 	if (!sdkp->lbpvpd) {
 		/* LBP VPD page not provided */
 		if (sdkp->max_unmap_blocks)

  parent reply	other threads:[~2024-08-16  3:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 14:49 [REGRESSION] critical target error, bisected Chris Bainbridge
2024-08-13  2:09 ` Martin K. Petersen
2024-08-13  2:21   ` Martin K. Petersen
2024-08-16  3:56 ` Martin K. Petersen [this message]
2024-08-16  6:08   ` Chris Bainbridge
2024-08-16  7:59   ` Shinichiro Kawasaki
2024-08-16  8:06     ` hch
2024-08-17  0:51     ` Martin K. Petersen
2024-08-16  8:21   ` John Garry
2024-08-17  0:53   ` [PATCH] scsi: sd: Do not attempt to configure discard unless LBPME is set Martin K. Petersen
2024-08-17  1:28     ` Martin K. Petersen

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=yq1ikw1qg49.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=chris.bainbridge@gmail.com \
    --cc=fengli@smartx.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@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