[edk2-devel] [PATCH 0/1] UefiScsiLib: Set FUA bit for synchronous SCSI Write operations

Zurcher, Christopher J christopher.j.zurcher at intel.com
Sat Feb 22 02:11:51 UTC 2020


Some SCSI devices have very aggressive write caching implemented, causing
data to be lost if the system is shut down or rebooted soon after
receiving a successful write confirmation from the device. By setting the
FUA bit in the synchronous versions of the Write10/Write16 commands, the
write cache is skipped and data is forced directly to the disk.

The Asynchronous (WriteEx) commands will not have this bit set, allowing
performance-sensitive transactions to continue utilizing the write cache.

An alternative, more complicated solution would be to implement the
SYNCHRONIZE CACHE command and call it from ScsiDiskFlushBlocks, which
currently returns EFI_SUCCESS without flushing anything. Since the
SYNCHRONIZE CACHE command requires the caller to provide the specific
blocks to flush, and the BlockIO FlushBlocks function does not accept any
arguments, this would require keeping track of the write history inside the
ScsiDiskDxe driver.

I have not tested the asynchronous commands for this issue, so there is a
chance that resetting the system even after a call to FlushBlocksEx might
still result in lost data. Currently the ScsiDiskFlushBlocksEx command
waits for the BlockIo2 requests queue to empty, but does not ask the device
itself to flush anything. (EFI_SCSI_OP_SYNC_CACHE is defined in
IndustryStandard/Scsi.h but is not implemented anywhere.)

Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Liming Gao <liming.gao at intel.com>

Christopher J Zurcher (1):
  MdePkg/UefiScsiLib: Set FUA bit for synchronous SCSI Write operations

 MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

-- 
2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54720): https://edk2.groups.io/g/devel/message/54720
Mute This Topic: https://groups.io/mt/71464106/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list