Reply with LUN busy when there is a read/write error from backend

Signed-off-by: Utkarsh Mani Tripathi <utkarsh.tripathi@mayadata.io>
This commit is contained in:
Utkarsh Mani Tripathi
2019-11-18 16:30:46 +05:30
parent a8cc3e6db2
commit 3b8e996a6c
2 changed files with 5 additions and 3 deletions

View File

@@ -153,7 +153,7 @@ write:
if err != nil {
log.Error(err)
key = MEDIUM_ERROR
asc = ASC_READ_ERROR
asc = ASC_WRITE_ERROR
goto sense
}
log.Debugf("write data at 0x%x for length %d", offset, len(wbuf))
@@ -172,7 +172,7 @@ write:
if ((opcode != api.WRITE_6) && (scb[1]&0x8 != 0)) || (pg.Data[0]&0x04 == 0) {
if err = bs.DataSync(int64(offset), tl); err != nil {
key = MEDIUM_ERROR
asc = ASC_READ_ERROR
asc = ASC_WRITE_ERROR
goto sense
}
}

View File

@@ -459,7 +459,9 @@ func SBCReadWrite(host int, cmd *api.SCSICommand) api.SAMStat {
err, key, asc = bsPerformCommand(dev.Storage, cmd)
if err != nil {
goto sense
log.Errorf("Error from backend: %v", err)
BuildSenseData(cmd, key, asc)
return api.SAMStatBusy
} else {
return api.SAMStatGood
}