diff options
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r-- | drivers/scsi/scsi_error.c | 131 |
1 files changed, 64 insertions, 67 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ebaca4ca4a13..547e85aa414f 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -62,7 +62,7 @@ void scsi_eh_wakeup(struct Scsi_Host *shost) | |||
62 | * @shost: SCSI host to invoke error handling on. | 62 | * @shost: SCSI host to invoke error handling on. |
63 | * | 63 | * |
64 | * Schedule SCSI EH without scmd. | 64 | * Schedule SCSI EH without scmd. |
65 | **/ | 65 | */ |
66 | void scsi_schedule_eh(struct Scsi_Host *shost) | 66 | void scsi_schedule_eh(struct Scsi_Host *shost) |
67 | { | 67 | { |
68 | unsigned long flags; | 68 | unsigned long flags; |
@@ -86,7 +86,7 @@ EXPORT_SYMBOL_GPL(scsi_schedule_eh); | |||
86 | * | 86 | * |
87 | * Return value: | 87 | * Return value: |
88 | * 0 on failure. | 88 | * 0 on failure. |
89 | **/ | 89 | */ |
90 | int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) | 90 | int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) |
91 | { | 91 | { |
92 | struct Scsi_Host *shost = scmd->device->host; | 92 | struct Scsi_Host *shost = scmd->device->host; |
@@ -121,7 +121,7 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag) | |||
121 | * This should be turned into an inline function. Each scsi command | 121 | * This should be turned into an inline function. Each scsi command |
122 | * has its own timer, and as it is added to the queue, we set up the | 122 | * has its own timer, and as it is added to the queue, we set up the |
123 | * timer. When the command completes, we cancel the timer. | 123 | * timer. When the command completes, we cancel the timer. |
124 | **/ | 124 | */ |
125 | void scsi_add_timer(struct scsi_cmnd *scmd, int timeout, | 125 | void scsi_add_timer(struct scsi_cmnd *scmd, int timeout, |
126 | void (*complete)(struct scsi_cmnd *)) | 126 | void (*complete)(struct scsi_cmnd *)) |
127 | { | 127 | { |
@@ -155,7 +155,7 @@ void scsi_add_timer(struct scsi_cmnd *scmd, int timeout, | |||
155 | * Return value: | 155 | * Return value: |
156 | * 1 if we were able to detach the timer. 0 if we blew it, and the | 156 | * 1 if we were able to detach the timer. 0 if we blew it, and the |
157 | * timer function has already started to run. | 157 | * timer function has already started to run. |
158 | **/ | 158 | */ |
159 | int scsi_delete_timer(struct scsi_cmnd *scmd) | 159 | int scsi_delete_timer(struct scsi_cmnd *scmd) |
160 | { | 160 | { |
161 | int rtn; | 161 | int rtn; |
@@ -181,7 +181,7 @@ int scsi_delete_timer(struct scsi_cmnd *scmd) | |||
181 | * only in that the normal completion handling might run, but if the | 181 | * only in that the normal completion handling might run, but if the |
182 | * normal completion function determines that the timer has already | 182 | * normal completion function determines that the timer has already |
183 | * fired, then it mustn't do anything. | 183 | * fired, then it mustn't do anything. |
184 | **/ | 184 | */ |
185 | void scsi_times_out(struct scsi_cmnd *scmd) | 185 | void scsi_times_out(struct scsi_cmnd *scmd) |
186 | { | 186 | { |
187 | enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); | 187 | enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); |
@@ -224,7 +224,7 @@ void scsi_times_out(struct scsi_cmnd *scmd) | |||
224 | * | 224 | * |
225 | * Return value: | 225 | * Return value: |
226 | * 0 when dev was taken offline by error recovery. 1 OK to proceed. | 226 | * 0 when dev was taken offline by error recovery. 1 OK to proceed. |
227 | **/ | 227 | */ |
228 | int scsi_block_when_processing_errors(struct scsi_device *sdev) | 228 | int scsi_block_when_processing_errors(struct scsi_device *sdev) |
229 | { | 229 | { |
230 | int online; | 230 | int online; |
@@ -245,7 +245,7 @@ EXPORT_SYMBOL(scsi_block_when_processing_errors); | |||
245 | * scsi_eh_prt_fail_stats - Log info on failures. | 245 | * scsi_eh_prt_fail_stats - Log info on failures. |
246 | * @shost: scsi host being recovered. | 246 | * @shost: scsi host being recovered. |
247 | * @work_q: Queue of scsi cmds to process. | 247 | * @work_q: Queue of scsi cmds to process. |
248 | **/ | 248 | */ |
249 | static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, | 249 | static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, |
250 | struct list_head *work_q) | 250 | struct list_head *work_q) |
251 | { | 251 | { |
@@ -295,7 +295,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost, | |||
295 | * Notes: | 295 | * Notes: |
296 | * When a deferred error is detected the current command has | 296 | * When a deferred error is detected the current command has |
297 | * not been executed and needs retrying. | 297 | * not been executed and needs retrying. |
298 | **/ | 298 | */ |
299 | static int scsi_check_sense(struct scsi_cmnd *scmd) | 299 | static int scsi_check_sense(struct scsi_cmnd *scmd) |
300 | { | 300 | { |
301 | struct scsi_sense_hdr sshdr; | 301 | struct scsi_sense_hdr sshdr; |
@@ -398,7 +398,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
398 | * queued during error recovery. the main difference here is that we | 398 | * queued during error recovery. the main difference here is that we |
399 | * don't allow for the possibility of retries here, and we are a lot | 399 | * don't allow for the possibility of retries here, and we are a lot |
400 | * more restrictive about what we consider acceptable. | 400 | * more restrictive about what we consider acceptable. |
401 | **/ | 401 | */ |
402 | static int scsi_eh_completed_normally(struct scsi_cmnd *scmd) | 402 | static int scsi_eh_completed_normally(struct scsi_cmnd *scmd) |
403 | { | 403 | { |
404 | /* | 404 | /* |
@@ -452,7 +452,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd) | |||
452 | /** | 452 | /** |
453 | * scsi_eh_done - Completion function for error handling. | 453 | * scsi_eh_done - Completion function for error handling. |
454 | * @scmd: Cmd that is done. | 454 | * @scmd: Cmd that is done. |
455 | **/ | 455 | */ |
456 | static void scsi_eh_done(struct scsi_cmnd *scmd) | 456 | static void scsi_eh_done(struct scsi_cmnd *scmd) |
457 | { | 457 | { |
458 | struct completion *eh_action; | 458 | struct completion *eh_action; |
@@ -469,7 +469,7 @@ static void scsi_eh_done(struct scsi_cmnd *scmd) | |||
469 | /** | 469 | /** |
470 | * scsi_try_host_reset - ask host adapter to reset itself | 470 | * scsi_try_host_reset - ask host adapter to reset itself |
471 | * @scmd: SCSI cmd to send hsot reset. | 471 | * @scmd: SCSI cmd to send hsot reset. |
472 | **/ | 472 | */ |
473 | static int scsi_try_host_reset(struct scsi_cmnd *scmd) | 473 | static int scsi_try_host_reset(struct scsi_cmnd *scmd) |
474 | { | 474 | { |
475 | unsigned long flags; | 475 | unsigned long flags; |
@@ -498,7 +498,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd) | |||
498 | /** | 498 | /** |
499 | * scsi_try_bus_reset - ask host to perform a bus reset | 499 | * scsi_try_bus_reset - ask host to perform a bus reset |
500 | * @scmd: SCSI cmd to send bus reset. | 500 | * @scmd: SCSI cmd to send bus reset. |
501 | **/ | 501 | */ |
502 | static int scsi_try_bus_reset(struct scsi_cmnd *scmd) | 502 | static int scsi_try_bus_reset(struct scsi_cmnd *scmd) |
503 | { | 503 | { |
504 | unsigned long flags; | 504 | unsigned long flags; |
@@ -533,7 +533,7 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd) | |||
533 | * unreliable for a given host, then the host itself needs to put a | 533 | * unreliable for a given host, then the host itself needs to put a |
534 | * timer on it, and set the host back to a consistent state prior to | 534 | * timer on it, and set the host back to a consistent state prior to |
535 | * returning. | 535 | * returning. |
536 | **/ | 536 | */ |
537 | static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) | 537 | static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) |
538 | { | 538 | { |
539 | int rtn; | 539 | int rtn; |
@@ -568,7 +568,7 @@ static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | |||
568 | * author of the low-level driver wishes this operation to be timed, | 568 | * author of the low-level driver wishes this operation to be timed, |
569 | * they can provide this facility themselves. helper functions in | 569 | * they can provide this facility themselves. helper functions in |
570 | * scsi_error.c can be supplied to make this easier to do. | 570 | * scsi_error.c can be supplied to make this easier to do. |
571 | **/ | 571 | */ |
572 | static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | 572 | static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) |
573 | { | 573 | { |
574 | /* | 574 | /* |
@@ -601,7 +601,7 @@ static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) | |||
601 | * sent must be one that does not transfer any data. If @sense_bytes != 0 | 601 | * sent must be one that does not transfer any data. If @sense_bytes != 0 |
602 | * @cmnd is ignored and this functions sets up a REQUEST_SENSE command | 602 | * @cmnd is ignored and this functions sets up a REQUEST_SENSE command |
603 | * and cmnd buffers to read @sense_bytes into @scmd->sense_buffer. | 603 | * and cmnd buffers to read @sense_bytes into @scmd->sense_buffer. |
604 | **/ | 604 | */ |
605 | void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | 605 | void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, |
606 | unsigned char *cmnd, int cmnd_size, unsigned sense_bytes) | 606 | unsigned char *cmnd, int cmnd_size, unsigned sense_bytes) |
607 | { | 607 | { |
@@ -625,7 +625,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | |||
625 | 625 | ||
626 | if (sense_bytes) { | 626 | if (sense_bytes) { |
627 | scmd->request_bufflen = min_t(unsigned, | 627 | scmd->request_bufflen = min_t(unsigned, |
628 | sizeof(scmd->sense_buffer), sense_bytes); | 628 | SCSI_SENSE_BUFFERSIZE, sense_bytes); |
629 | sg_init_one(&ses->sense_sgl, scmd->sense_buffer, | 629 | sg_init_one(&ses->sense_sgl, scmd->sense_buffer, |
630 | scmd->request_bufflen); | 630 | scmd->request_bufflen); |
631 | scmd->request_buffer = &ses->sense_sgl; | 631 | scmd->request_buffer = &ses->sense_sgl; |
@@ -657,7 +657,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | |||
657 | * Zero the sense buffer. The scsi spec mandates that any | 657 | * Zero the sense buffer. The scsi spec mandates that any |
658 | * untransferred sense data should be interpreted as being zero. | 658 | * untransferred sense data should be interpreted as being zero. |
659 | */ | 659 | */ |
660 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | 660 | memset(scmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); |
661 | } | 661 | } |
662 | EXPORT_SYMBOL(scsi_eh_prep_cmnd); | 662 | EXPORT_SYMBOL(scsi_eh_prep_cmnd); |
663 | 663 | ||
@@ -667,7 +667,7 @@ EXPORT_SYMBOL(scsi_eh_prep_cmnd); | |||
667 | * @ses: saved information from a coresponding call to scsi_prep_eh_cmnd | 667 | * @ses: saved information from a coresponding call to scsi_prep_eh_cmnd |
668 | * | 668 | * |
669 | * Undo any damage done by above scsi_prep_eh_cmnd(). | 669 | * Undo any damage done by above scsi_prep_eh_cmnd(). |
670 | **/ | 670 | */ |
671 | void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) | 671 | void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) |
672 | { | 672 | { |
673 | /* | 673 | /* |
@@ -697,7 +697,7 @@ EXPORT_SYMBOL(scsi_eh_restore_cmnd); | |||
697 | * | 697 | * |
698 | * Return value: | 698 | * Return value: |
699 | * SUCCESS or FAILED or NEEDS_RETRY | 699 | * SUCCESS or FAILED or NEEDS_RETRY |
700 | **/ | 700 | */ |
701 | static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | 701 | static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, |
702 | int cmnd_size, int timeout, unsigned sense_bytes) | 702 | int cmnd_size, int timeout, unsigned sense_bytes) |
703 | { | 703 | { |
@@ -765,7 +765,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | |||
765 | * Some hosts automatically obtain this information, others require | 765 | * Some hosts automatically obtain this information, others require |
766 | * that we obtain it on our own. This function will *not* return until | 766 | * that we obtain it on our own. This function will *not* return until |
767 | * the command either times out, or it completes. | 767 | * the command either times out, or it completes. |
768 | **/ | 768 | */ |
769 | static int scsi_request_sense(struct scsi_cmnd *scmd) | 769 | static int scsi_request_sense(struct scsi_cmnd *scmd) |
770 | { | 770 | { |
771 | return scsi_send_eh_cmnd(scmd, NULL, 0, SENSE_TIMEOUT, ~0); | 771 | return scsi_send_eh_cmnd(scmd, NULL, 0, SENSE_TIMEOUT, ~0); |
@@ -779,10 +779,10 @@ static int scsi_request_sense(struct scsi_cmnd *scmd) | |||
779 | * Notes: | 779 | * Notes: |
780 | * We don't want to use the normal command completion while we are are | 780 | * We don't want to use the normal command completion while we are are |
781 | * still handling errors - it may cause other commands to be queued, | 781 | * still handling errors - it may cause other commands to be queued, |
782 | * and that would disturb what we are doing. thus we really want to | 782 | * and that would disturb what we are doing. Thus we really want to |
783 | * keep a list of pending commands for final completion, and once we | 783 | * keep a list of pending commands for final completion, and once we |
784 | * are ready to leave error handling we handle completion for real. | 784 | * are ready to leave error handling we handle completion for real. |
785 | **/ | 785 | */ |
786 | void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) | 786 | void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) |
787 | { | 787 | { |
788 | scmd->device->host->host_failed--; | 788 | scmd->device->host->host_failed--; |
@@ -794,7 +794,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd); | |||
794 | /** | 794 | /** |
795 | * scsi_eh_get_sense - Get device sense data. | 795 | * scsi_eh_get_sense - Get device sense data. |
796 | * @work_q: Queue of commands to process. | 796 | * @work_q: Queue of commands to process. |
797 | * @done_q: Queue of proccessed commands.. | 797 | * @done_q: Queue of processed commands. |
798 | * | 798 | * |
799 | * Description: | 799 | * Description: |
800 | * See if we need to request sense information. if so, then get it | 800 | * See if we need to request sense information. if so, then get it |
@@ -802,7 +802,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd); | |||
802 | * | 802 | * |
803 | * Notes: | 803 | * Notes: |
804 | * This has the unfortunate side effect that if a shost adapter does | 804 | * This has the unfortunate side effect that if a shost adapter does |
805 | * not automatically request sense information, that we end up shutting | 805 | * not automatically request sense information, we end up shutting |
806 | * it down before we request it. | 806 | * it down before we request it. |
807 | * | 807 | * |
808 | * All drivers should request sense information internally these days, | 808 | * All drivers should request sense information internally these days, |
@@ -810,7 +810,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd); | |||
810 | * | 810 | * |
811 | * XXX: Long term this code should go away, but that needs an audit of | 811 | * XXX: Long term this code should go away, but that needs an audit of |
812 | * all LLDDs first. | 812 | * all LLDDs first. |
813 | **/ | 813 | */ |
814 | int scsi_eh_get_sense(struct list_head *work_q, | 814 | int scsi_eh_get_sense(struct list_head *work_q, |
815 | struct list_head *done_q) | 815 | struct list_head *done_q) |
816 | { | 816 | { |
@@ -858,11 +858,11 @@ EXPORT_SYMBOL_GPL(scsi_eh_get_sense); | |||
858 | 858 | ||
859 | /** | 859 | /** |
860 | * scsi_eh_tur - Send TUR to device. | 860 | * scsi_eh_tur - Send TUR to device. |
861 | * @scmd: Scsi cmd to send TUR | 861 | * @scmd: &scsi_cmnd to send TUR |
862 | * | 862 | * |
863 | * Return value: | 863 | * Return value: |
864 | * 0 - Device is ready. 1 - Device NOT ready. | 864 | * 0 - Device is ready. 1 - Device NOT ready. |
865 | **/ | 865 | */ |
866 | static int scsi_eh_tur(struct scsi_cmnd *scmd) | 866 | static int scsi_eh_tur(struct scsi_cmnd *scmd) |
867 | { | 867 | { |
868 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; | 868 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; |
@@ -887,17 +887,17 @@ retry_tur: | |||
887 | } | 887 | } |
888 | 888 | ||
889 | /** | 889 | /** |
890 | * scsi_eh_abort_cmds - abort canceled commands. | 890 | * scsi_eh_abort_cmds - abort pending commands. |
891 | * @shost: scsi host being recovered. | 891 | * @work_q: &list_head for pending commands. |
892 | * @eh_done_q: list_head for processed commands. | 892 | * @done_q: &list_head for processed commands. |
893 | * | 893 | * |
894 | * Decription: | 894 | * Decription: |
895 | * Try and see whether or not it makes sense to try and abort the | 895 | * Try and see whether or not it makes sense to try and abort the |
896 | * running command. this only works out to be the case if we have one | 896 | * running command. This only works out to be the case if we have one |
897 | * command that has timed out. if the command simply failed, it makes | 897 | * command that has timed out. If the command simply failed, it makes |
898 | * no sense to try and abort the command, since as far as the shost | 898 | * no sense to try and abort the command, since as far as the shost |
899 | * adapter is concerned, it isn't running. | 899 | * adapter is concerned, it isn't running. |
900 | **/ | 900 | */ |
901 | static int scsi_eh_abort_cmds(struct list_head *work_q, | 901 | static int scsi_eh_abort_cmds(struct list_head *work_q, |
902 | struct list_head *done_q) | 902 | struct list_head *done_q) |
903 | { | 903 | { |
@@ -931,11 +931,11 @@ static int scsi_eh_abort_cmds(struct list_head *work_q, | |||
931 | 931 | ||
932 | /** | 932 | /** |
933 | * scsi_eh_try_stu - Send START_UNIT to device. | 933 | * scsi_eh_try_stu - Send START_UNIT to device. |
934 | * @scmd: Scsi cmd to send START_UNIT | 934 | * @scmd: &scsi_cmnd to send START_UNIT |
935 | * | 935 | * |
936 | * Return value: | 936 | * Return value: |
937 | * 0 - Device is ready. 1 - Device NOT ready. | 937 | * 0 - Device is ready. 1 - Device NOT ready. |
938 | **/ | 938 | */ |
939 | static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | 939 | static int scsi_eh_try_stu(struct scsi_cmnd *scmd) |
940 | { | 940 | { |
941 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; | 941 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; |
@@ -956,13 +956,14 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
956 | 956 | ||
957 | /** | 957 | /** |
958 | * scsi_eh_stu - send START_UNIT if needed | 958 | * scsi_eh_stu - send START_UNIT if needed |
959 | * @shost: scsi host being recovered. | 959 | * @shost: &scsi host being recovered. |
960 | * @eh_done_q: list_head for processed commands. | 960 | * @work_q: &list_head for pending commands. |
961 | * @done_q: &list_head for processed commands. | ||
961 | * | 962 | * |
962 | * Notes: | 963 | * Notes: |
963 | * If commands are failing due to not ready, initializing command required, | 964 | * If commands are failing due to not ready, initializing command required, |
964 | * try revalidating the device, which will end up sending a start unit. | 965 | * try revalidating the device, which will end up sending a start unit. |
965 | **/ | 966 | */ |
966 | static int scsi_eh_stu(struct Scsi_Host *shost, | 967 | static int scsi_eh_stu(struct Scsi_Host *shost, |
967 | struct list_head *work_q, | 968 | struct list_head *work_q, |
968 | struct list_head *done_q) | 969 | struct list_head *done_q) |
@@ -1008,14 +1009,15 @@ static int scsi_eh_stu(struct Scsi_Host *shost, | |||
1008 | /** | 1009 | /** |
1009 | * scsi_eh_bus_device_reset - send bdr if needed | 1010 | * scsi_eh_bus_device_reset - send bdr if needed |
1010 | * @shost: scsi host being recovered. | 1011 | * @shost: scsi host being recovered. |
1011 | * @eh_done_q: list_head for processed commands. | 1012 | * @work_q: &list_head for pending commands. |
1013 | * @done_q: &list_head for processed commands. | ||
1012 | * | 1014 | * |
1013 | * Notes: | 1015 | * Notes: |
1014 | * Try a bus device reset. still, look to see whether we have multiple | 1016 | * Try a bus device reset. Still, look to see whether we have multiple |
1015 | * devices that are jammed or not - if we have multiple devices, it | 1017 | * devices that are jammed or not - if we have multiple devices, it |
1016 | * makes no sense to try bus_device_reset - we really would need to try | 1018 | * makes no sense to try bus_device_reset - we really would need to try |
1017 | * a bus_reset instead. | 1019 | * a bus_reset instead. |
1018 | **/ | 1020 | */ |
1019 | static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, | 1021 | static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, |
1020 | struct list_head *work_q, | 1022 | struct list_head *work_q, |
1021 | struct list_head *done_q) | 1023 | struct list_head *done_q) |
@@ -1063,9 +1065,10 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, | |||
1063 | 1065 | ||
1064 | /** | 1066 | /** |
1065 | * scsi_eh_bus_reset - send a bus reset | 1067 | * scsi_eh_bus_reset - send a bus reset |
1066 | * @shost: scsi host being recovered. | 1068 | * @shost: &scsi host being recovered. |
1067 | * @eh_done_q: list_head for processed commands. | 1069 | * @work_q: &list_head for pending commands. |
1068 | **/ | 1070 | * @done_q: &list_head for processed commands. |
1071 | */ | ||
1069 | static int scsi_eh_bus_reset(struct Scsi_Host *shost, | 1072 | static int scsi_eh_bus_reset(struct Scsi_Host *shost, |
1070 | struct list_head *work_q, | 1073 | struct list_head *work_q, |
1071 | struct list_head *done_q) | 1074 | struct list_head *done_q) |
@@ -1122,7 +1125,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost, | |||
1122 | * scsi_eh_host_reset - send a host reset | 1125 | * scsi_eh_host_reset - send a host reset |
1123 | * @work_q: list_head for processed commands. | 1126 | * @work_q: list_head for processed commands. |
1124 | * @done_q: list_head for processed commands. | 1127 | * @done_q: list_head for processed commands. |
1125 | **/ | 1128 | */ |
1126 | static int scsi_eh_host_reset(struct list_head *work_q, | 1129 | static int scsi_eh_host_reset(struct list_head *work_q, |
1127 | struct list_head *done_q) | 1130 | struct list_head *done_q) |
1128 | { | 1131 | { |
@@ -1157,8 +1160,7 @@ static int scsi_eh_host_reset(struct list_head *work_q, | |||
1157 | * scsi_eh_offline_sdevs - offline scsi devices that fail to recover | 1160 | * scsi_eh_offline_sdevs - offline scsi devices that fail to recover |
1158 | * @work_q: list_head for processed commands. | 1161 | * @work_q: list_head for processed commands. |
1159 | * @done_q: list_head for processed commands. | 1162 | * @done_q: list_head for processed commands. |
1160 | * | 1163 | */ |
1161 | **/ | ||
1162 | static void scsi_eh_offline_sdevs(struct list_head *work_q, | 1164 | static void scsi_eh_offline_sdevs(struct list_head *work_q, |
1163 | struct list_head *done_q) | 1165 | struct list_head *done_q) |
1164 | { | 1166 | { |
@@ -1191,7 +1193,7 @@ static void scsi_eh_offline_sdevs(struct list_head *work_q, | |||
1191 | * is woken. In cases where the error code indicates an error that | 1193 | * is woken. In cases where the error code indicates an error that |
1192 | * doesn't require the error handler read (i.e. we don't need to | 1194 | * doesn't require the error handler read (i.e. we don't need to |
1193 | * abort/reset), this function should return SUCCESS. | 1195 | * abort/reset), this function should return SUCCESS. |
1194 | **/ | 1196 | */ |
1195 | int scsi_decide_disposition(struct scsi_cmnd *scmd) | 1197 | int scsi_decide_disposition(struct scsi_cmnd *scmd) |
1196 | { | 1198 | { |
1197 | int rtn; | 1199 | int rtn; |
@@ -1372,7 +1374,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) | |||
1372 | * | 1374 | * |
1373 | * If scsi_allocate_request() fails for what ever reason, we | 1375 | * If scsi_allocate_request() fails for what ever reason, we |
1374 | * completely forget to lock the door. | 1376 | * completely forget to lock the door. |
1375 | **/ | 1377 | */ |
1376 | static void scsi_eh_lock_door(struct scsi_device *sdev) | 1378 | static void scsi_eh_lock_door(struct scsi_device *sdev) |
1377 | { | 1379 | { |
1378 | unsigned char cmnd[MAX_COMMAND_SIZE]; | 1380 | unsigned char cmnd[MAX_COMMAND_SIZE]; |
@@ -1396,7 +1398,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev) | |||
1396 | * Notes: | 1398 | * Notes: |
1397 | * When we entered the error handler, we blocked all further i/o to | 1399 | * When we entered the error handler, we blocked all further i/o to |
1398 | * this device. we need to 'reverse' this process. | 1400 | * this device. we need to 'reverse' this process. |
1399 | **/ | 1401 | */ |
1400 | static void scsi_restart_operations(struct Scsi_Host *shost) | 1402 | static void scsi_restart_operations(struct Scsi_Host *shost) |
1401 | { | 1403 | { |
1402 | struct scsi_device *sdev; | 1404 | struct scsi_device *sdev; |
@@ -1440,9 +1442,9 @@ static void scsi_restart_operations(struct Scsi_Host *shost) | |||
1440 | /** | 1442 | /** |
1441 | * scsi_eh_ready_devs - check device ready state and recover if not. | 1443 | * scsi_eh_ready_devs - check device ready state and recover if not. |
1442 | * @shost: host to be recovered. | 1444 | * @shost: host to be recovered. |
1443 | * @eh_done_q: list_head for processed commands. | 1445 | * @work_q: &list_head for pending commands. |
1444 | * | 1446 | * @done_q: &list_head for processed commands. |
1445 | **/ | 1447 | */ |
1446 | void scsi_eh_ready_devs(struct Scsi_Host *shost, | 1448 | void scsi_eh_ready_devs(struct Scsi_Host *shost, |
1447 | struct list_head *work_q, | 1449 | struct list_head *work_q, |
1448 | struct list_head *done_q) | 1450 | struct list_head *done_q) |
@@ -1458,8 +1460,7 @@ EXPORT_SYMBOL_GPL(scsi_eh_ready_devs); | |||
1458 | /** | 1460 | /** |
1459 | * scsi_eh_flush_done_q - finish processed commands or retry them. | 1461 | * scsi_eh_flush_done_q - finish processed commands or retry them. |
1460 | * @done_q: list_head of processed commands. | 1462 | * @done_q: list_head of processed commands. |
1461 | * | 1463 | */ |
1462 | **/ | ||
1463 | void scsi_eh_flush_done_q(struct list_head *done_q) | 1464 | void scsi_eh_flush_done_q(struct list_head *done_q) |
1464 | { | 1465 | { |
1465 | struct scsi_cmnd *scmd, *next; | 1466 | struct scsi_cmnd *scmd, *next; |
@@ -1513,7 +1514,7 @@ EXPORT_SYMBOL(scsi_eh_flush_done_q); | |||
1513 | * scsi_finish_cmd() called for it. we do all of the retry stuff | 1514 | * scsi_finish_cmd() called for it. we do all of the retry stuff |
1514 | * here, so when we restart the host after we return it should have an | 1515 | * here, so when we restart the host after we return it should have an |
1515 | * empty queue. | 1516 | * empty queue. |
1516 | **/ | 1517 | */ |
1517 | static void scsi_unjam_host(struct Scsi_Host *shost) | 1518 | static void scsi_unjam_host(struct Scsi_Host *shost) |
1518 | { | 1519 | { |
1519 | unsigned long flags; | 1520 | unsigned long flags; |
@@ -1540,7 +1541,7 @@ static void scsi_unjam_host(struct Scsi_Host *shost) | |||
1540 | * Notes: | 1541 | * Notes: |
1541 | * This is the main error handling loop. This is run as a kernel thread | 1542 | * This is the main error handling loop. This is run as a kernel thread |
1542 | * for every SCSI host and handles all error handling activity. | 1543 | * for every SCSI host and handles all error handling activity. |
1543 | **/ | 1544 | */ |
1544 | int scsi_error_handler(void *data) | 1545 | int scsi_error_handler(void *data) |
1545 | { | 1546 | { |
1546 | struct Scsi_Host *shost = data; | 1547 | struct Scsi_Host *shost = data; |
@@ -1769,7 +1770,7 @@ EXPORT_SYMBOL(scsi_reset_provider); | |||
1769 | * | 1770 | * |
1770 | * Return value: | 1771 | * Return value: |
1771 | * 1 if valid sense data information found, else 0; | 1772 | * 1 if valid sense data information found, else 0; |
1772 | **/ | 1773 | */ |
1773 | int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, | 1774 | int scsi_normalize_sense(const u8 *sense_buffer, int sb_len, |
1774 | struct scsi_sense_hdr *sshdr) | 1775 | struct scsi_sense_hdr *sshdr) |
1775 | { | 1776 | { |
@@ -1819,14 +1820,12 @@ int scsi_command_normalize_sense(struct scsi_cmnd *cmd, | |||
1819 | struct scsi_sense_hdr *sshdr) | 1820 | struct scsi_sense_hdr *sshdr) |
1820 | { | 1821 | { |
1821 | return scsi_normalize_sense(cmd->sense_buffer, | 1822 | return scsi_normalize_sense(cmd->sense_buffer, |
1822 | sizeof(cmd->sense_buffer), sshdr); | 1823 | SCSI_SENSE_BUFFERSIZE, sshdr); |
1823 | } | 1824 | } |
1824 | EXPORT_SYMBOL(scsi_command_normalize_sense); | 1825 | EXPORT_SYMBOL(scsi_command_normalize_sense); |
1825 | 1826 | ||
1826 | /** | 1827 | /** |
1827 | * scsi_sense_desc_find - search for a given descriptor type in | 1828 | * scsi_sense_desc_find - search for a given descriptor type in descriptor sense data format. |
1828 | * descriptor sense data format. | ||
1829 | * | ||
1830 | * @sense_buffer: byte array of descriptor format sense data | 1829 | * @sense_buffer: byte array of descriptor format sense data |
1831 | * @sb_len: number of valid bytes in sense_buffer | 1830 | * @sb_len: number of valid bytes in sense_buffer |
1832 | * @desc_type: value of descriptor type to find | 1831 | * @desc_type: value of descriptor type to find |
@@ -1837,7 +1836,7 @@ EXPORT_SYMBOL(scsi_command_normalize_sense); | |||
1837 | * | 1836 | * |
1838 | * Return value: | 1837 | * Return value: |
1839 | * pointer to start of (first) descriptor if found else NULL | 1838 | * pointer to start of (first) descriptor if found else NULL |
1840 | **/ | 1839 | */ |
1841 | const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len, | 1840 | const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len, |
1842 | int desc_type) | 1841 | int desc_type) |
1843 | { | 1842 | { |
@@ -1865,9 +1864,7 @@ const u8 * scsi_sense_desc_find(const u8 * sense_buffer, int sb_len, | |||
1865 | EXPORT_SYMBOL(scsi_sense_desc_find); | 1864 | EXPORT_SYMBOL(scsi_sense_desc_find); |
1866 | 1865 | ||
1867 | /** | 1866 | /** |
1868 | * scsi_get_sense_info_fld - attempts to get information field from | 1867 | * scsi_get_sense_info_fld - get information field from sense data (either fixed or descriptor format) |
1869 | * sense data (either fixed or descriptor format) | ||
1870 | * | ||
1871 | * @sense_buffer: byte array of sense data | 1868 | * @sense_buffer: byte array of sense data |
1872 | * @sb_len: number of valid bytes in sense_buffer | 1869 | * @sb_len: number of valid bytes in sense_buffer |
1873 | * @info_out: pointer to 64 integer where 8 or 4 byte information | 1870 | * @info_out: pointer to 64 integer where 8 or 4 byte information |
@@ -1875,7 +1872,7 @@ EXPORT_SYMBOL(scsi_sense_desc_find); | |||
1875 | * | 1872 | * |
1876 | * Return value: | 1873 | * Return value: |
1877 | * 1 if information field found, 0 if not found. | 1874 | * 1 if information field found, 0 if not found. |
1878 | **/ | 1875 | */ |
1879 | int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len, | 1876 | int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len, |
1880 | u64 * info_out) | 1877 | u64 * info_out) |
1881 | { | 1878 | { |