]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: sd: Don't check if a write for REQ_ATOMIC
authorJohn Garry <john.g.garry@oracle.com>
Mon, 5 Aug 2024 11:33:14 +0000 (11:33 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 12 Aug 2024 22:03:38 +0000 (18:03 -0400)
Flag REQ_ATOMIC can only be set for writes, so don't check if the operation
is also a write in sd_setup_read_write_cmnd().

Fixes: bf4ae8f2e640 ("scsi: sd: Atomic write support")
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240805113315.1048591-2-john.g.garry@oracle.com
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c

index adeaa8ab995167674909b496d2c4804d73e872c5..e90a2e4ab318275fcc470e0d4ff862b81ebc9ce7 100644 (file)
@@ -1382,7 +1382,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
        if (protect && sdkp->protection_type == T10_PI_TYPE2_PROTECTION) {
                ret = sd_setup_rw32_cmnd(cmd, write, lba, nr_blocks,
                                         protect | fua, dld);
-       } else if (rq->cmd_flags & REQ_ATOMIC && write) {
+       } else if (rq->cmd_flags & REQ_ATOMIC) {
                ret = sd_setup_atomic_cmnd(cmd, lba, nr_blocks,
                                sdkp->use_atomic_write_boundary,
                                protect | fua);