Commit a9d6ceb8 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by James Bottomley

[SCSI] return ENOSPC on thin provisioning failure

When the thin provisioning hard threshold is reached we
should return ENOSPC to inform upper layers about this fact.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 87f14e65
...@@ -2318,6 +2318,9 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) ...@@ -2318,6 +2318,9 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes)
case -ETIMEDOUT: case -ETIMEDOUT:
error_type = "timeout"; error_type = "timeout";
break; break;
case -ENOSPC:
error_type = "critical space allocation";
break;
case -EIO: case -EIO:
default: default:
error_type = "I/O"; error_type = "I/O";
......
...@@ -354,11 +354,16 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) ...@@ -354,11 +354,16 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
return SUCCESS; return SUCCESS;
/* these are not supported */ /* these are not supported */
case DATA_PROTECT:
if (sshdr.asc == 0x27 && sshdr.ascq == 0x07) {
/* Thin provisioning hard threshold reached */
set_host_byte(scmd, DID_ALLOC_FAILURE);
return SUCCESS;
}
case COPY_ABORTED: case COPY_ABORTED:
case VOLUME_OVERFLOW: case VOLUME_OVERFLOW:
case MISCOMPARE: case MISCOMPARE:
case BLANK_CHECK: case BLANK_CHECK:
case DATA_PROTECT:
set_host_byte(scmd, DID_TARGET_FAILURE); set_host_byte(scmd, DID_TARGET_FAILURE);
return SUCCESS; return SUCCESS;
......
...@@ -726,6 +726,7 @@ EXPORT_SYMBOL(scsi_release_buffers); ...@@ -726,6 +726,7 @@ EXPORT_SYMBOL(scsi_release_buffers);
* -ENOLINK temporary transport failure * -ENOLINK temporary transport failure
* -EREMOTEIO permanent target failure, do not retry * -EREMOTEIO permanent target failure, do not retry
* -EBADE permanent nexus failure, retry on other path * -EBADE permanent nexus failure, retry on other path
* -ENOSPC No write space available
* -EIO unspecified I/O error * -EIO unspecified I/O error
*/ */
static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result)
...@@ -744,6 +745,10 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) ...@@ -744,6 +745,10 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result)
set_host_byte(cmd, DID_OK); set_host_byte(cmd, DID_OK);
error = -EBADE; error = -EBADE;
break; break;
case DID_ALLOC_FAILURE:
set_host_byte(cmd, DID_OK);
error = -ENOSPC;
break;
default: default:
error = -EIO; error = -EIO;
break; break;
......
...@@ -457,6 +457,7 @@ static inline int scsi_is_wlun(unsigned int lun) ...@@ -457,6 +457,7 @@ static inline int scsi_is_wlun(unsigned int lun)
* other paths */ * other paths */
#define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other #define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other
* paths might yield different results */ * paths might yield different results */
#define DID_ALLOC_FAILURE 0x12 /* Space allocation on the device failed */
#define DRIVER_OK 0x00 /* Driver status */ #define DRIVER_OK 0x00 /* Driver status */
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment