]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commitdiff
scsi: sd: Do not attempt to configure discard unless LBPME is set
authorMartin K. Petersen <martin.petersen@oracle.com>
Sat, 17 Aug 2024 00:53:10 +0000 (20:53 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 17 Aug 2024 01:16:49 +0000 (21:16 -0400)
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/20240817005325.3319384-1-martin.petersen@oracle.com
Fixes: f874d7210d88 ("scsi: sd: Keep the discard mode stable")
Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Tested-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c

index 699f4f9674d98f67acbbf05f4a5398e8fcac0366..dad3991397cf9a77777107a511b71587fc2ac805 100644 (file)
@@ -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)