Skip to content

Commit cbaac68

Browse files
scsi: sd: Do not attempt to configure discard unless LBPME is set
Commit f874d72 ("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: f874d72 ("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]>
1 parent cd612b5 commit cbaac68

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/scsi/sd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,9 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
33083308

33093309
static unsigned int sd_discard_mode(struct scsi_disk *sdkp)
33103310
{
3311+
if (!sdkp->lbpme)
3312+
return SD_LBP_FULL;
3313+
33113314
if (!sdkp->lbpvpd) {
33123315
/* LBP VPD page not provided */
33133316
if (sdkp->max_unmap_blocks)

0 commit comments

Comments
 (0)