diff options
| author | Hannes Reinecke <hare@suse.de> | 2013-07-01 09:16:25 -0400 |
|---|---|---|
| committer | James Bottomley <JBottomley@Parallels.com> | 2013-08-23 12:43:54 -0400 |
| commit | a9d6ceb838755c24dde8a0ca02c3378926fc63db (patch) | |
| tree | 8239e44e9bee3029e31ee1ac04b14b73f5f500d1 | |
| parent | 87f14e658f664a17dcdb38d3f6ae70642fcdc263 (diff) | |
[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: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
| -rw-r--r-- | block/blk-core.c | 3 | ||||
| -rw-r--r-- | drivers/scsi/scsi_error.c | 7 | ||||
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 5 | ||||
| -rw-r--r-- | include/scsi/scsi.h | 1 |
4 files changed, 15 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 93a18d1d3da8..68ce4d53a528 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -2318,6 +2318,9 @@ bool blk_update_request(struct request *req, int error, unsigned int nr_bytes) | |||
| 2318 | case -ETIMEDOUT: | 2318 | case -ETIMEDOUT: |
| 2319 | error_type = "timeout"; | 2319 | error_type = "timeout"; |
| 2320 | break; | 2320 | break; |
| 2321 | case -ENOSPC: | ||
| 2322 | error_type = "critical space allocation"; | ||
| 2323 | break; | ||
| 2321 | case -EIO: | 2324 | case -EIO: |
| 2322 | default: | 2325 | default: |
| 2323 | error_type = "I/O"; | 2326 | error_type = "I/O"; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 7be5229ed3a4..1b1298ce0e71 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
| @@ -354,11 +354,16 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
| 354 | return SUCCESS; | 354 | return SUCCESS; |
| 355 | 355 | ||
| 356 | /* these are not supported */ | 356 | /* these are not supported */ |
| 357 | case DATA_PROTECT: | ||
| 358 | if (sshdr.asc == 0x27 && sshdr.ascq == 0x07) { | ||
| 359 | /* Thin provisioning hard threshold reached */ | ||
| 360 | set_host_byte(scmd, DID_ALLOC_FAILURE); | ||
| 361 | return SUCCESS; | ||
| 362 | } | ||
| 357 | case COPY_ABORTED: | 363 | case COPY_ABORTED: |
| 358 | case VOLUME_OVERFLOW: | 364 | case VOLUME_OVERFLOW: |
| 359 | case MISCOMPARE: | 365 | case MISCOMPARE: |
| 360 | case BLANK_CHECK: | 366 | case BLANK_CHECK: |
| 361 | case DATA_PROTECT: | ||
| 362 | set_host_byte(scmd, DID_TARGET_FAILURE); | 367 | set_host_byte(scmd, DID_TARGET_FAILURE); |
| 363 | return SUCCESS; | 368 | return SUCCESS; |
| 364 | 369 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e2af8ae0d0ca..49020d52d685 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
| @@ -726,6 +726,7 @@ EXPORT_SYMBOL(scsi_release_buffers); | |||
| 726 | * -ENOLINK temporary transport failure | 726 | * -ENOLINK temporary transport failure |
| 727 | * -EREMOTEIO permanent target failure, do not retry | 727 | * -EREMOTEIO permanent target failure, do not retry |
| 728 | * -EBADE permanent nexus failure, retry on other path | 728 | * -EBADE permanent nexus failure, retry on other path |
| 729 | * -ENOSPC No write space available | ||
| 729 | * -EIO unspecified I/O error | 730 | * -EIO unspecified I/O error |
| 730 | */ | 731 | */ |
| 731 | static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) | 732 | 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 | set_host_byte(cmd, DID_OK); | 745 | set_host_byte(cmd, DID_OK); |
| 745 | error = -EBADE; | 746 | error = -EBADE; |
| 746 | break; | 747 | break; |
| 748 | case DID_ALLOC_FAILURE: | ||
| 749 | set_host_byte(cmd, DID_OK); | ||
| 750 | error = -ENOSPC; | ||
| 751 | break; | ||
| 747 | default: | 752 | default: |
| 748 | error = -EIO; | 753 | error = -EIO; |
| 749 | break; | 754 | break; |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index e4cd3e975538..d0387d84dd68 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
| @@ -457,6 +457,7 @@ static inline int scsi_is_wlun(unsigned int lun) | |||
| 457 | * other paths */ | 457 | * other paths */ |
| 458 | #define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other | 458 | #define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other |
| 459 | * paths might yield different results */ | 459 | * paths might yield different results */ |
| 460 | #define DID_ALLOC_FAILURE 0x12 /* Space allocation on the device failed */ | ||
| 460 | #define DRIVER_OK 0x00 /* Driver status */ | 461 | #define DRIVER_OK 0x00 /* Driver status */ |
| 461 | 462 | ||
| 462 | /* | 463 | /* |
