Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scsi: target: iblock: Report space allocation errors
When a thin provisioned block device lacks free LBA it ends bio requests with BLK_STS_NOSPC. Currently iblock treats bio status as a boolean and terminates failed requests with LOGICAL UNIT COMMUNICATION FAILURE if the status is non-zero. Thus, initiators see space allocation errors as I/O errors. This commit modifies the iblock_req structure to store the status of the first failed bio instead of the total number of failed bios. The status is then used to set the specific sense reason. For BLK_STS_NOSPC the sense reason is set to TCM_SPACE_ALLOCATION_FAILED as per SBC-3 4.7.3.6. On Linux initiators: old: $ dd if=/dev/zero of=/dev/sda oflag=direct bs=4k count=1 dd: error writing '/dev/sda': I/O error new: $ dd if=/dev/zero of=/dev/sda oflag=direct bs=4k count=1 dd: error writing '/dev/sda': No space left on device Signed-off-by: Konstantin Shelekhin <k.shelekhin@yadro.com> Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
- Loading branch information