diff options
| author | Martin K. Petersen <[email protected]> | 2024-08-16 20:53:10 -0400 |
|---|---|---|
| committer | Martin K. Petersen <[email protected]> | 2024-08-16 21:16:49 -0400 |
| commit | cbaac68987b8699397df29413b33bd51f5255255 (patch) | |
| tree | 460ad206a5c952ece54c18bb3e6bf82372dd67d0 | |
| parent | cd612b57c3672487ae8565855eaf9e83862eccc5 (diff) | |
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 enabled.
Link: https://lore.kernel.org/r/[email protected]
Fixes: f874d7210d88 ("scsi: sd: Keep the discard mode stable")
Reported-by: Chris Bainbridge <[email protected]>
Tested-by: Chris Bainbridge <[email protected]>
Tested-by: Shin'ichiro Kawasaki <[email protected]>
Tested-by: John Garry <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
| -rw-r--r-- | drivers/scsi/sd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 699f4f9674d9..dad3991397cf 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_FULL; + if (!sdkp->lbpvpd) { /* LBP VPD page not provided */ if (sdkp->max_unmap_blocks) |