]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: sd: Keep the discard mode stable
authorLi Feng <fengli@smartx.com>
Thu, 18 Jul 2024 08:07:22 +0000 (16:07 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 3 Aug 2024 01:58:41 +0000 (21:58 -0400)
commitf874d7210d882cb1c58a8e3da66f61cdc63cd4b4
tree63208500bf81ed9285fa8a5fc5d4df524eff5dcd
parentffed586b8c4f1fdb772ee350e229863f145defb5
scsi: sd: Keep the discard mode stable

There is a scenario where a large number of discard commands are issued
when the iscsi initiator connects to the target and then performs a session
rescan operation. There is a time window, most of the commands are in UNMAP
mode, and some discard commands become WRITE SAME with UNMAP.

The discard mode has been negotiated during the SCSI probe. If the mode is
temporarily changed from UNMAP to WRITE SAME with UNMAP, an I/O ERROR may
occur because the target may not implement WRITE SAME with UNMAP. Keep the
discard mode stable to fix this issue.

Signed-off-by: Li Feng <fengli@smartx.com>
Link: https://lore.kernel.org/r/20240718080751.313102-2-fengli@smartx.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c