diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2009-11-16 13:48:38 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:01:47 -0500 |
commit | aa9fffbe2c4db4557248c5c626a85bf3c7867044 (patch) | |
tree | e719a15e185a35f09e489a5a9f2a72d73c598dd1 /include/scsi | |
parent | eff21490c91f981126f0ead3c081dde4f425d387 (diff) |
[SCSI] libosd: Error handling revamped
Administer some love to the osd_req_decode_sense function
* Fix a bad bug with osd_req_decode_sense(). If there was no scsi
residual, .i.e the request never reached the target, then all the
osd_sense_info members where garbage.
* Add grossly missing in/out_resid to osd_sense_info and fill them in
properly.
* Define an osd_err_priority enum which divides the possible errors into
7 categories in ascending severity. Each category is also assigned a
Linux return code translation.
Analyze the different osd/scsi/block returned errors and set the
proper osd_err_priority and Linux return code accordingly.
* extra check a few situations so not to get stuck with inconsistent
error view. Example an empty residual with an error code, and other
places ...
Lots of libosd's osd_req_decode_sense clients had this logic in some
form or another. Consolidate all these into one place that should
actually know about osd returns. Thous translating it to a more
abstract error.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/osd_initiator.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h index 3ec346e15dda..39d6d1097153 100644 --- a/include/scsi/osd_initiator.h +++ b/include/scsi/osd_initiator.h | |||
@@ -267,7 +267,7 @@ int osd_execute_request_async(struct osd_request *or, | |||
267 | * @bad_attr_list - List of failing attributes (optional) | 267 | * @bad_attr_list - List of failing attributes (optional) |
268 | * @max_attr - Size of @bad_attr_list. | 268 | * @max_attr - Size of @bad_attr_list. |
269 | * | 269 | * |
270 | * After execution, sense + return code can be analyzed using this function. The | 270 | * After execution, osd_request results are analyzed using this function. The |
271 | * return code is the final disposition on the error. So it is possible that a | 271 | * return code is the final disposition on the error. So it is possible that a |
272 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for | 272 | * CHECK_CONDITION was returned from target but this will return NO_ERROR, for |
273 | * example on recovered errors. All parameters are optional if caller does | 273 | * example on recovered errors. All parameters are optional if caller does |
@@ -276,7 +276,31 @@ int osd_execute_request_async(struct osd_request *or, | |||
276 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the | 276 | * of the SCSI_OSD_DPRINT_SENSE Kconfig value. Set @silent if you know the |
277 | * command would routinely fail, to not spam the dmsg file. | 277 | * command would routinely fail, to not spam the dmsg file. |
278 | */ | 278 | */ |
279 | |||
280 | /** | ||
281 | * osd_err_priority - osd categorized return codes in ascending severity. | ||
282 | * | ||
283 | * The categories are borrowed from the pnfs_osd_errno enum. | ||
284 | * See comments for translated Linux codes returned by osd_req_decode_sense. | ||
285 | */ | ||
286 | enum osd_err_priority { | ||
287 | OSD_ERR_PRI_NO_ERROR = 0, | ||
288 | /* Recoverable, caller should clear_highpage() all pages */ | ||
289 | OSD_ERR_PRI_CLEAR_PAGES = 1, /* -EFAULT */ | ||
290 | OSD_ERR_PRI_RESOURCE = 2, /* -ENOMEM */ | ||
291 | OSD_ERR_PRI_BAD_CRED = 3, /* -EINVAL */ | ||
292 | OSD_ERR_PRI_NO_ACCESS = 4, /* -EACCES */ | ||
293 | OSD_ERR_PRI_UNREACHABLE = 5, /* any other */ | ||
294 | OSD_ERR_PRI_NOT_FOUND = 6, /* -ENOENT */ | ||
295 | OSD_ERR_PRI_NO_SPACE = 7, /* -ENOSPC */ | ||
296 | OSD_ERR_PRI_EIO = 8, /* -EIO */ | ||
297 | }; | ||
298 | |||
279 | struct osd_sense_info { | 299 | struct osd_sense_info { |
300 | u64 out_resid; /* Zero on success otherwise out residual */ | ||
301 | u64 in_resid; /* Zero on success otherwise in residual */ | ||
302 | enum osd_err_priority osd_err_pri; | ||
303 | |||
280 | int key; /* one of enum scsi_sense_keys */ | 304 | int key; /* one of enum scsi_sense_keys */ |
281 | int additional_code ; /* enum osd_additional_sense_codes */ | 305 | int additional_code ; /* enum osd_additional_sense_codes */ |
282 | union { /* Sense specific information */ | 306 | union { /* Sense specific information */ |