aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorMark Haverkamp <markh@osdl.org>2006-03-27 12:43:55 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-04-13 11:13:18 -0400
commit31876f328f22435c21cfc27f0c871a4a4b22f9db (patch)
treedd0138f43655faac97ce6c87759d960d74a59262 /drivers/scsi
parent77d644d4d70c9ad5df51792575f43a950525c9aa (diff)
[SCSI] aacraid: Add timeout for events
Received from Mark Salyzyn Plug and play actions resulting from event sequences shall time out if they take longer than 30 seconds to complete. Signed-off-by: Mark Haverkamp <markh@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aacraid/aacraid.h1
-rw-r--r--drivers/scsi/aacraid/commsup.c37
2 files changed, 27 insertions, 11 deletions
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 51c96cac484e..c251789babb5 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -788,6 +788,7 @@ struct fsa_dev_info {
788 u64 size; 788 u64 size;
789 u32 type; 789 u32 type;
790 u32 config_waiting_on; 790 u32 config_waiting_on;
791 unsigned long config_waiting_stamp;
791 u16 queue_depth; 792 u16 queue_depth;
792 u8 config_needed; 793 u8 config_needed;
793 u8 valid; 794 u8 valid;
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index c7f80ec7abde..bed4e2dd1f3e 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -784,6 +784,7 @@ void aac_printf(struct aac_dev *dev, u32 val)
784 * dispatches it to the appropriate routine for handling. 784 * dispatches it to the appropriate routine for handling.
785 */ 785 */
786 786
787#define AIF_SNIFF_TIMEOUT (30*HZ)
787static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) 788static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
788{ 789{
789 struct hw_fib * hw_fib = fibptr->hw_fib; 790 struct hw_fib * hw_fib = fibptr->hw_fib;
@@ -837,6 +838,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
837 if (device) { 838 if (device) {
838 dev->fsa_dev[container].config_needed = CHANGE; 839 dev->fsa_dev[container].config_needed = CHANGE;
839 dev->fsa_dev[container].config_waiting_on = AifEnConfigChange; 840 dev->fsa_dev[container].config_waiting_on = AifEnConfigChange;
841 dev->fsa_dev[container].config_waiting_stamp = jiffies;
840 scsi_device_put(device); 842 scsi_device_put(device);
841 } 843 }
842 } 844 }
@@ -849,13 +851,15 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
849 if (container != (u32)-1) { 851 if (container != (u32)-1) {
850 if (container >= dev->maximum_num_containers) 852 if (container >= dev->maximum_num_containers)
851 break; 853 break;
852 if (dev->fsa_dev[container].config_waiting_on == 854 if ((dev->fsa_dev[container].config_waiting_on ==
853 le32_to_cpu(*(u32 *)aifcmd->data)) 855 le32_to_cpu(*(u32 *)aifcmd->data)) &&
856 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
854 dev->fsa_dev[container].config_waiting_on = 0; 857 dev->fsa_dev[container].config_waiting_on = 0;
855 } else for (container = 0; 858 } else for (container = 0;
856 container < dev->maximum_num_containers; ++container) { 859 container < dev->maximum_num_containers; ++container) {
857 if (dev->fsa_dev[container].config_waiting_on == 860 if ((dev->fsa_dev[container].config_waiting_on ==
858 le32_to_cpu(*(u32 *)aifcmd->data)) 861 le32_to_cpu(*(u32 *)aifcmd->data)) &&
862 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
859 dev->fsa_dev[container].config_waiting_on = 0; 863 dev->fsa_dev[container].config_waiting_on = 0;
860 } 864 }
861 break; 865 break;
@@ -872,6 +876,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
872 dev->fsa_dev[container].config_needed = ADD; 876 dev->fsa_dev[container].config_needed = ADD;
873 dev->fsa_dev[container].config_waiting_on = 877 dev->fsa_dev[container].config_waiting_on =
874 AifEnConfigChange; 878 AifEnConfigChange;
879 dev->fsa_dev[container].config_waiting_stamp = jiffies;
875 break; 880 break;
876 881
877 /* 882 /*
@@ -884,6 +889,7 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
884 dev->fsa_dev[container].config_needed = DELETE; 889 dev->fsa_dev[container].config_needed = DELETE;
885 dev->fsa_dev[container].config_waiting_on = 890 dev->fsa_dev[container].config_waiting_on =
886 AifEnConfigChange; 891 AifEnConfigChange;
892 dev->fsa_dev[container].config_waiting_stamp = jiffies;
887 break; 893 break;
888 894
889 /* 895 /*
@@ -894,11 +900,13 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
894 container = le32_to_cpu(((u32 *)aifcmd->data)[1]); 900 container = le32_to_cpu(((u32 *)aifcmd->data)[1]);
895 if (container >= dev->maximum_num_containers) 901 if (container >= dev->maximum_num_containers)
896 break; 902 break;
897 if (dev->fsa_dev[container].config_waiting_on) 903 if (dev->fsa_dev[container].config_waiting_on &&
904 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
898 break; 905 break;
899 dev->fsa_dev[container].config_needed = CHANGE; 906 dev->fsa_dev[container].config_needed = CHANGE;
900 dev->fsa_dev[container].config_waiting_on = 907 dev->fsa_dev[container].config_waiting_on =
901 AifEnConfigChange; 908 AifEnConfigChange;
909 dev->fsa_dev[container].config_waiting_stamp = jiffies;
902 break; 910 break;
903 911
904 case AifEnConfigChange: 912 case AifEnConfigChange:
@@ -913,13 +921,15 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
913 if (container != (u32)-1) { 921 if (container != (u32)-1) {
914 if (container >= dev->maximum_num_containers) 922 if (container >= dev->maximum_num_containers)
915 break; 923 break;
916 if (dev->fsa_dev[container].config_waiting_on == 924 if ((dev->fsa_dev[container].config_waiting_on ==
917 le32_to_cpu(*(u32 *)aifcmd->data)) 925 le32_to_cpu(*(u32 *)aifcmd->data)) &&
926 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
918 dev->fsa_dev[container].config_waiting_on = 0; 927 dev->fsa_dev[container].config_waiting_on = 0;
919 } else for (container = 0; 928 } else for (container = 0;
920 container < dev->maximum_num_containers; ++container) { 929 container < dev->maximum_num_containers; ++container) {
921 if (dev->fsa_dev[container].config_waiting_on == 930 if ((dev->fsa_dev[container].config_waiting_on ==
922 le32_to_cpu(*(u32 *)aifcmd->data)) 931 le32_to_cpu(*(u32 *)aifcmd->data)) &&
932 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT))
923 dev->fsa_dev[container].config_waiting_on = 0; 933 dev->fsa_dev[container].config_waiting_on = 0;
924 } 934 }
925 break; 935 break;
@@ -946,6 +956,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
946 dev->fsa_dev[container].config_waiting_on = 956 dev->fsa_dev[container].config_waiting_on =
947 AifEnContainerChange; 957 AifEnContainerChange;
948 dev->fsa_dev[container].config_needed = ADD; 958 dev->fsa_dev[container].config_needed = ADD;
959 dev->fsa_dev[container].config_waiting_stamp =
960 jiffies;
949 } 961 }
950 } 962 }
951 if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero)) 963 if ((((u32 *)aifcmd->data)[1] == cpu_to_le32(AifJobCtrZero))
@@ -961,6 +973,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
961 dev->fsa_dev[container].config_waiting_on = 973 dev->fsa_dev[container].config_waiting_on =
962 AifEnContainerChange; 974 AifEnContainerChange;
963 dev->fsa_dev[container].config_needed = DELETE; 975 dev->fsa_dev[container].config_needed = DELETE;
976 dev->fsa_dev[container].config_waiting_stamp =
977 jiffies;
964 } 978 }
965 } 979 }
966 break; 980 break;
@@ -969,8 +983,9 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
969 device_config_needed = NOTHING; 983 device_config_needed = NOTHING;
970 for (container = 0; container < dev->maximum_num_containers; 984 for (container = 0; container < dev->maximum_num_containers;
971 ++container) { 985 ++container) {
972 if ((dev->fsa_dev[container].config_waiting_on == 0) 986 if ((dev->fsa_dev[container].config_waiting_on == 0) &&
973 && (dev->fsa_dev[container].config_needed != NOTHING)) { 987 (dev->fsa_dev[container].config_needed != NOTHING) &&
988 time_before(jiffies, dev->fsa_dev[container].config_waiting_stamp + AIF_SNIFF_TIMEOUT)) {
974 device_config_needed = 989 device_config_needed =
975 dev->fsa_dev[container].config_needed; 990 dev->fsa_dev[container].config_needed;
976 dev->fsa_dev[container].config_needed = NOTHING; 991 dev->fsa_dev[container].config_needed = NOTHING;