diff options
Diffstat (limited to 'drivers/s390/scsi')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 14 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 4 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 94 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 110 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_scsi.c | 2 |
5 files changed, 110 insertions, 114 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index c218b5c944a6..5e84c5aa7779 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -996,6 +996,20 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
996 | spin_lock_init(&adapter->fsf_req_list_lock); | 996 | spin_lock_init(&adapter->fsf_req_list_lock); |
997 | INIT_LIST_HEAD(&adapter->fsf_req_list_head); | 997 | INIT_LIST_HEAD(&adapter->fsf_req_list_head); |
998 | 998 | ||
999 | /* initialize debug locks */ | ||
1000 | |||
1001 | spin_lock_init(&adapter->erp_dbf_lock); | ||
1002 | spin_lock_init(&adapter->hba_dbf_lock); | ||
1003 | spin_lock_init(&adapter->san_dbf_lock); | ||
1004 | spin_lock_init(&adapter->scsi_dbf_lock); | ||
1005 | |||
1006 | /* initialize error recovery stuff */ | ||
1007 | |||
1008 | rwlock_init(&adapter->erp_lock); | ||
1009 | sema_init(&adapter->erp_ready_sem, 0); | ||
1010 | INIT_LIST_HEAD(&adapter->erp_ready_head); | ||
1011 | INIT_LIST_HEAD(&adapter->erp_running_head); | ||
1012 | |||
999 | /* initialize abort lock */ | 1013 | /* initialize abort lock */ |
1000 | rwlock_init(&adapter->abort_lock); | 1014 | rwlock_init(&adapter->abort_lock); |
1001 | 1015 | ||
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 826fb3b00605..95599719f8ab 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -926,7 +926,6 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |||
926 | char dbf_name[DEBUG_MAX_NAME_LEN]; | 926 | char dbf_name[DEBUG_MAX_NAME_LEN]; |
927 | 927 | ||
928 | /* debug feature area which records recovery activity */ | 928 | /* debug feature area which records recovery activity */ |
929 | spin_lock_init(&adapter->erp_dbf_lock); | ||
930 | sprintf(dbf_name, "zfcp_%s_erp", zfcp_get_busid_by_adapter(adapter)); | 929 | sprintf(dbf_name, "zfcp_%s_erp", zfcp_get_busid_by_adapter(adapter)); |
931 | adapter->erp_dbf = debug_register(dbf_name, dbfsize, 2, | 930 | adapter->erp_dbf = debug_register(dbf_name, dbfsize, 2, |
932 | sizeof(struct zfcp_erp_dbf_record)); | 931 | sizeof(struct zfcp_erp_dbf_record)); |
@@ -936,7 +935,6 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |||
936 | debug_set_level(adapter->erp_dbf, 3); | 935 | debug_set_level(adapter->erp_dbf, 3); |
937 | 936 | ||
938 | /* debug feature area which records HBA (FSF and QDIO) conditions */ | 937 | /* debug feature area which records HBA (FSF and QDIO) conditions */ |
939 | spin_lock_init(&adapter->hba_dbf_lock); | ||
940 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); | 938 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); |
941 | adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1, | 939 | adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1, |
942 | sizeof(struct zfcp_hba_dbf_record)); | 940 | sizeof(struct zfcp_hba_dbf_record)); |
@@ -947,7 +945,6 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |||
947 | debug_set_level(adapter->hba_dbf, 3); | 945 | debug_set_level(adapter->hba_dbf, 3); |
948 | 946 | ||
949 | /* debug feature area which records SAN command failures and recovery */ | 947 | /* debug feature area which records SAN command failures and recovery */ |
950 | spin_lock_init(&adapter->san_dbf_lock); | ||
951 | sprintf(dbf_name, "zfcp_%s_san", zfcp_get_busid_by_adapter(adapter)); | 948 | sprintf(dbf_name, "zfcp_%s_san", zfcp_get_busid_by_adapter(adapter)); |
952 | adapter->san_dbf = debug_register(dbf_name, dbfsize, 1, | 949 | adapter->san_dbf = debug_register(dbf_name, dbfsize, 1, |
953 | sizeof(struct zfcp_san_dbf_record)); | 950 | sizeof(struct zfcp_san_dbf_record)); |
@@ -958,7 +955,6 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |||
958 | debug_set_level(adapter->san_dbf, 6); | 955 | debug_set_level(adapter->san_dbf, 6); |
959 | 956 | ||
960 | /* debug feature area which records SCSI command failures and recovery */ | 957 | /* debug feature area which records SCSI command failures and recovery */ |
961 | spin_lock_init(&adapter->scsi_dbf_lock); | ||
962 | sprintf(dbf_name, "zfcp_%s_scsi", zfcp_get_busid_by_adapter(adapter)); | 958 | sprintf(dbf_name, "zfcp_%s_scsi", zfcp_get_busid_by_adapter(adapter)); |
963 | adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1, | 959 | adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1, |
964 | sizeof(struct zfcp_scsi_dbf_record)); | 960 | sizeof(struct zfcp_scsi_dbf_record)); |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 023f4e558ae4..ee7314d8c2da 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -1071,11 +1071,6 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter) | |||
1071 | 1071 | ||
1072 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); | 1072 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); |
1073 | 1073 | ||
1074 | rwlock_init(&adapter->erp_lock); | ||
1075 | INIT_LIST_HEAD(&adapter->erp_ready_head); | ||
1076 | INIT_LIST_HEAD(&adapter->erp_running_head); | ||
1077 | sema_init(&adapter->erp_ready_sem, 0); | ||
1078 | |||
1079 | retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); | 1074 | retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); |
1080 | if (retval < 0) { | 1075 | if (retval < 0) { |
1081 | ZFCP_LOG_NORMAL("error: creation of erp thread failed for " | 1076 | ZFCP_LOG_NORMAL("error: creation of erp thread failed for " |
@@ -2248,29 +2243,26 @@ zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *erp_action) | |||
2248 | return retval; | 2243 | return retval; |
2249 | } | 2244 | } |
2250 | 2245 | ||
2251 | /* | ||
2252 | * function: zfcp_fsf_init | ||
2253 | * | ||
2254 | * purpose: initializes FSF operation for the specified adapter | ||
2255 | * | ||
2256 | * returns: 0 - succesful initialization of FSF operation | ||
2257 | * !0 - failed to initialize FSF operation | ||
2258 | */ | ||
2259 | static int | 2246 | static int |
2260 | zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) | 2247 | zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) |
2261 | { | 2248 | { |
2262 | int xconfig, xport; | 2249 | int retval; |
2263 | 2250 | ||
2264 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | 2251 | if ((atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, |
2265 | &erp_action->adapter->status)) { | 2252 | &erp_action->adapter->status)) && |
2253 | (erp_action->adapter->adapter_features & | ||
2254 | FSF_FEATURE_HBAAPI_MANAGEMENT)) { | ||
2266 | zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); | 2255 | zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); |
2267 | atomic_set(&erp_action->adapter->erp_counter, 0); | 2256 | atomic_set(&erp_action->adapter->erp_counter, 0); |
2268 | return ZFCP_ERP_FAILED; | 2257 | return ZFCP_ERP_FAILED; |
2269 | } | 2258 | } |
2270 | 2259 | ||
2271 | xconfig = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action); | 2260 | retval = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action); |
2272 | xport = zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); | 2261 | if (retval == ZFCP_ERP_FAILED) |
2273 | if ((xconfig == ZFCP_ERP_FAILED) || (xport == ZFCP_ERP_FAILED)) | 2262 | return ZFCP_ERP_FAILED; |
2263 | |||
2264 | retval = zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); | ||
2265 | if (retval == ZFCP_ERP_FAILED) | ||
2274 | return ZFCP_ERP_FAILED; | 2266 | return ZFCP_ERP_FAILED; |
2275 | 2267 | ||
2276 | return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); | 2268 | return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); |
@@ -2359,41 +2351,29 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
2359 | static int | 2351 | static int |
2360 | zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) | 2352 | zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) |
2361 | { | 2353 | { |
2362 | int retval = ZFCP_ERP_SUCCEEDED; | 2354 | int ret; |
2363 | int retries; | 2355 | int retries; |
2364 | int sleep; | 2356 | int sleep; |
2365 | struct zfcp_adapter *adapter = erp_action->adapter; | 2357 | struct zfcp_adapter *adapter = erp_action->adapter; |
2366 | 2358 | ||
2367 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); | 2359 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); |
2368 | 2360 | ||
2369 | for (retries = 0; ; retries++) { | 2361 | retries = 0; |
2370 | ZFCP_LOG_DEBUG("Doing exchange port data\n"); | 2362 | do { |
2363 | write_lock(&adapter->erp_lock); | ||
2371 | zfcp_erp_action_to_running(erp_action); | 2364 | zfcp_erp_action_to_running(erp_action); |
2365 | write_unlock(&adapter->erp_lock); | ||
2372 | zfcp_erp_timeout_init(erp_action); | 2366 | zfcp_erp_timeout_init(erp_action); |
2373 | if (zfcp_fsf_exchange_port_data(erp_action, adapter, NULL)) { | 2367 | ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL); |
2374 | retval = ZFCP_ERP_FAILED; | 2368 | if (ret == -EOPNOTSUPP) { |
2375 | debug_text_event(adapter->erp_dbf, 5, "a_fstx_xf"); | 2369 | debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp"); |
2376 | ZFCP_LOG_INFO("error: initiation of exchange of " | 2370 | return ZFCP_ERP_SUCCEEDED; |
2377 | "port data failed for adapter %s\n", | 2371 | } else if (ret) { |
2378 | zfcp_get_busid_by_adapter(adapter)); | 2372 | debug_text_event(adapter->erp_dbf, 3, "a_xport_failed"); |
2379 | break; | 2373 | return ZFCP_ERP_FAILED; |
2380 | } | 2374 | } |
2381 | debug_text_event(adapter->erp_dbf, 6, "a_fstx_xok"); | 2375 | debug_text_event(adapter->erp_dbf, 6, "a_xport_ok"); |
2382 | ZFCP_LOG_DEBUG("Xchange underway\n"); | ||
2383 | 2376 | ||
2384 | /* | ||
2385 | * Why this works: | ||
2386 | * Both the normal completion handler as well as the timeout | ||
2387 | * handler will do an 'up' when the 'exchange port data' | ||
2388 | * request completes or times out. Thus, the signal to go on | ||
2389 | * won't be lost utilizing this semaphore. | ||
2390 | * Furthermore, this 'adapter_reopen' action is | ||
2391 | * guaranteed to be the only action being there (highest action | ||
2392 | * which prevents other actions from being created). | ||
2393 | * Resulting from that, the wake signal recognized here | ||
2394 | * _must_ be the one belonging to the 'exchange port | ||
2395 | * data' request. | ||
2396 | */ | ||
2397 | down(&adapter->erp_ready_sem); | 2377 | down(&adapter->erp_ready_sem); |
2398 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | 2378 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { |
2399 | ZFCP_LOG_INFO("error: exchange of port data " | 2379 | ZFCP_LOG_INFO("error: exchange of port data " |
@@ -2401,29 +2381,19 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) | |||
2401 | zfcp_get_busid_by_adapter(adapter)); | 2381 | zfcp_get_busid_by_adapter(adapter)); |
2402 | break; | 2382 | break; |
2403 | } | 2383 | } |
2404 | |||
2405 | if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | 2384 | if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, |
2406 | &adapter->status)) | 2385 | &adapter->status)) |
2407 | break; | 2386 | break; |
2408 | 2387 | ||
2409 | ZFCP_LOG_DEBUG("host connection still initialising... " | 2388 | if (retries < ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES) { |
2410 | "waiting and retrying...\n"); | 2389 | sleep = ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP; |
2411 | /* sleep a little bit before retry */ | 2390 | retries++; |
2412 | sleep = retries < ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES ? | 2391 | } else |
2413 | ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP : | 2392 | sleep = ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP; |
2414 | ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP; | 2393 | schedule_timeout(sleep); |
2415 | msleep(jiffies_to_msecs(sleep)); | 2394 | } while (1); |
2416 | } | ||
2417 | |||
2418 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | ||
2419 | &adapter->status)) { | ||
2420 | ZFCP_LOG_INFO("error: exchange of port data for " | ||
2421 | "adapter %s failed\n", | ||
2422 | zfcp_get_busid_by_adapter(adapter)); | ||
2423 | retval = ZFCP_ERP_FAILED; | ||
2424 | } | ||
2425 | 2395 | ||
2426 | return retval; | 2396 | return ZFCP_ERP_SUCCEEDED; |
2427 | } | 2397 | } |
2428 | 2398 | ||
2429 | /* | 2399 | /* |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 3b0fc1163f5f..59587951c847 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -554,6 +554,17 @@ static void | |||
554 | zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter, | 554 | zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter, |
555 | struct fsf_link_down_info *link_down) | 555 | struct fsf_link_down_info *link_down) |
556 | { | 556 | { |
557 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | ||
558 | &adapter->status)) | ||
559 | return; | ||
560 | |||
561 | atomic_set_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status); | ||
562 | |||
563 | if (link_down == NULL) { | ||
564 | zfcp_erp_adapter_reopen(adapter, 0); | ||
565 | return; | ||
566 | } | ||
567 | |||
557 | switch (link_down->error_code) { | 568 | switch (link_down->error_code) { |
558 | case FSF_PSQ_LINK_NO_LIGHT: | 569 | case FSF_PSQ_LINK_NO_LIGHT: |
559 | ZFCP_LOG_NORMAL("The local link to adapter %s is down " | 570 | ZFCP_LOG_NORMAL("The local link to adapter %s is down " |
@@ -634,20 +645,15 @@ zfcp_fsf_link_down_info_eval(struct zfcp_adapter *adapter, | |||
634 | link_down->explanation_code, | 645 | link_down->explanation_code, |
635 | link_down->vendor_specific_code); | 646 | link_down->vendor_specific_code); |
636 | 647 | ||
637 | if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | 648 | switch (link_down->error_code) { |
638 | &adapter->status)) { | 649 | case FSF_PSQ_LINK_NO_LIGHT: |
639 | atomic_set_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | 650 | case FSF_PSQ_LINK_WRAP_PLUG: |
640 | &adapter->status); | 651 | case FSF_PSQ_LINK_NO_FCP: |
641 | switch (link_down->error_code) { | 652 | case FSF_PSQ_LINK_FIRMWARE_UPDATE: |
642 | case FSF_PSQ_LINK_NO_LIGHT: | 653 | zfcp_erp_adapter_reopen(adapter, 0); |
643 | case FSF_PSQ_LINK_WRAP_PLUG: | 654 | break; |
644 | case FSF_PSQ_LINK_NO_FCP: | 655 | default: |
645 | case FSF_PSQ_LINK_FIRMWARE_UPDATE: | 656 | zfcp_erp_adapter_failed(adapter); |
646 | zfcp_erp_adapter_reopen(adapter, 0); | ||
647 | break; | ||
648 | default: | ||
649 | zfcp_erp_adapter_failed(adapter); | ||
650 | } | ||
651 | } | 657 | } |
652 | } | 658 | } |
653 | 659 | ||
@@ -919,30 +925,36 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req) | |||
919 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: | 925 | case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: |
920 | ZFCP_LOG_INFO("Physical link to adapter %s is down\n", | 926 | ZFCP_LOG_INFO("Physical link to adapter %s is down\n", |
921 | zfcp_get_busid_by_adapter(adapter)); | 927 | zfcp_get_busid_by_adapter(adapter)); |
928 | zfcp_fsf_link_down_info_eval(adapter, | ||
929 | (struct fsf_link_down_info *) | ||
930 | &status_buffer->payload); | ||
922 | break; | 931 | break; |
923 | case FSF_STATUS_READ_SUB_FDISC_FAILED: | 932 | case FSF_STATUS_READ_SUB_FDISC_FAILED: |
924 | ZFCP_LOG_INFO("Local link to adapter %s is down " | 933 | ZFCP_LOG_INFO("Local link to adapter %s is down " |
925 | "due to failed FDISC login\n", | 934 | "due to failed FDISC login\n", |
926 | zfcp_get_busid_by_adapter(adapter)); | 935 | zfcp_get_busid_by_adapter(adapter)); |
936 | zfcp_fsf_link_down_info_eval(adapter, | ||
937 | (struct fsf_link_down_info *) | ||
938 | &status_buffer->payload); | ||
927 | break; | 939 | break; |
928 | case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: | 940 | case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: |
929 | ZFCP_LOG_INFO("Local link to adapter %s is down " | 941 | ZFCP_LOG_INFO("Local link to adapter %s is down " |
930 | "due to firmware update on adapter\n", | 942 | "due to firmware update on adapter\n", |
931 | zfcp_get_busid_by_adapter(adapter)); | 943 | zfcp_get_busid_by_adapter(adapter)); |
944 | zfcp_fsf_link_down_info_eval(adapter, NULL); | ||
932 | break; | 945 | break; |
933 | default: | 946 | default: |
934 | ZFCP_LOG_INFO("Local link to adapter %s is down " | 947 | ZFCP_LOG_INFO("Local link to adapter %s is down " |
935 | "due to unknown reason\n", | 948 | "due to unknown reason\n", |
936 | zfcp_get_busid_by_adapter(adapter)); | 949 | zfcp_get_busid_by_adapter(adapter)); |
950 | zfcp_fsf_link_down_info_eval(adapter, NULL); | ||
937 | }; | 951 | }; |
938 | zfcp_fsf_link_down_info_eval(adapter, | ||
939 | (struct fsf_link_down_info *) &status_buffer->payload); | ||
940 | break; | 952 | break; |
941 | 953 | ||
942 | case FSF_STATUS_READ_LINK_UP: | 954 | case FSF_STATUS_READ_LINK_UP: |
943 | ZFCP_LOG_NORMAL("Local link to adapter %s was replugged. " | 955 | ZFCP_LOG_NORMAL("Local link to adapter %s was replugged. " |
944 | "Restarting operations on this adapter\n", | 956 | "Restarting operations on this adapter\n", |
945 | zfcp_get_busid_by_adapter(adapter)); | 957 | zfcp_get_busid_by_adapter(adapter)); |
946 | /* All ports should be marked as ready to run again */ | 958 | /* All ports should be marked as ready to run again */ |
947 | zfcp_erp_modify_adapter_status(adapter, | 959 | zfcp_erp_modify_adapter_status(adapter, |
948 | ZFCP_STATUS_COMMON_RUNNING, | 960 | ZFCP_STATUS_COMMON_RUNNING, |
@@ -2191,13 +2203,10 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2191 | return -EOPNOTSUPP; | 2203 | return -EOPNOTSUPP; |
2192 | } | 2204 | } |
2193 | 2205 | ||
2194 | timer = kmalloc(sizeof(struct timer_list), GFP_KERNEL); | ||
2195 | if (!timer) | ||
2196 | return -ENOMEM; | ||
2197 | |||
2198 | /* setup new FSF request */ | 2206 | /* setup new FSF request */ |
2199 | retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, | 2207 | retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, |
2200 | 0, 0, &lock_flags, &fsf_req); | 2208 | erp_action ? ZFCP_REQ_AUTO_CLEANUP : 0, |
2209 | 0, &lock_flags, &fsf_req); | ||
2201 | if (retval < 0) { | 2210 | if (retval < 0) { |
2202 | ZFCP_LOG_INFO("error: Out of resources. Could not create an " | 2211 | ZFCP_LOG_INFO("error: Out of resources. Could not create an " |
2203 | "exchange port data request for" | 2212 | "exchange port data request for" |
@@ -2205,25 +2214,33 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2205 | zfcp_get_busid_by_adapter(adapter)); | 2214 | zfcp_get_busid_by_adapter(adapter)); |
2206 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | 2215 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, |
2207 | lock_flags); | 2216 | lock_flags); |
2208 | goto out; | 2217 | return retval; |
2209 | } | ||
2210 | |||
2211 | if (erp_action) { | ||
2212 | erp_action->fsf_req = fsf_req; | ||
2213 | fsf_req->erp_action = erp_action; | ||
2214 | } | 2218 | } |
2215 | 2219 | ||
2216 | if (data) | 2220 | if (data) |
2217 | fsf_req->data = (unsigned long) data; | 2221 | fsf_req->data = (unsigned long) data; |
2218 | 2222 | ||
2219 | sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); | 2223 | sbale = zfcp_qdio_sbale_req(fsf_req, fsf_req->sbal_curr, 0); |
2220 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; | 2224 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
2221 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; | 2225 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
2222 | 2226 | ||
2223 | init_timer(timer); | 2227 | if (erp_action) { |
2224 | timer->function = zfcp_fsf_request_timeout_handler; | 2228 | erp_action->fsf_req = fsf_req; |
2225 | timer->data = (unsigned long) adapter; | 2229 | fsf_req->erp_action = erp_action; |
2226 | timer->expires = ZFCP_FSF_REQUEST_TIMEOUT; | 2230 | timer = &erp_action->timer; |
2231 | } else { | ||
2232 | timer = kmalloc(sizeof(struct timer_list), GFP_ATOMIC); | ||
2233 | if (!timer) { | ||
2234 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | ||
2235 | lock_flags); | ||
2236 | zfcp_fsf_req_free(fsf_req); | ||
2237 | return -ENOMEM; | ||
2238 | } | ||
2239 | init_timer(timer); | ||
2240 | timer->function = zfcp_fsf_request_timeout_handler; | ||
2241 | timer->data = (unsigned long) adapter; | ||
2242 | timer->expires = ZFCP_FSF_REQUEST_TIMEOUT; | ||
2243 | } | ||
2227 | 2244 | ||
2228 | retval = zfcp_fsf_req_send(fsf_req, timer); | 2245 | retval = zfcp_fsf_req_send(fsf_req, timer); |
2229 | if (retval) { | 2246 | if (retval) { |
@@ -2233,23 +2250,22 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action, | |||
2233 | zfcp_fsf_req_free(fsf_req); | 2250 | zfcp_fsf_req_free(fsf_req); |
2234 | if (erp_action) | 2251 | if (erp_action) |
2235 | erp_action->fsf_req = NULL; | 2252 | erp_action->fsf_req = NULL; |
2253 | else | ||
2254 | kfree(timer); | ||
2236 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | 2255 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, |
2237 | lock_flags); | 2256 | lock_flags); |
2238 | goto out; | 2257 | return retval; |
2239 | } | 2258 | } |
2240 | 2259 | ||
2241 | ZFCP_LOG_DEBUG("Exchange Port Data request initiated (adapter %s)\n", | 2260 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, lock_flags); |
2242 | zfcp_get_busid_by_adapter(adapter)); | ||
2243 | |||
2244 | write_unlock_irqrestore(&adapter->request_queue.queue_lock, | ||
2245 | lock_flags); | ||
2246 | 2261 | ||
2247 | wait_event(fsf_req->completion_wq, | 2262 | if (!erp_action) { |
2248 | fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); | 2263 | wait_event(fsf_req->completion_wq, |
2249 | del_timer_sync(timer); | 2264 | fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); |
2250 | zfcp_fsf_req_free(fsf_req); | 2265 | del_timer_sync(timer); |
2251 | out: | 2266 | zfcp_fsf_req_free(fsf_req); |
2252 | kfree(timer); | 2267 | kfree(timer); |
2268 | } | ||
2253 | return retval; | 2269 | return retval; |
2254 | } | 2270 | } |
2255 | 2271 | ||
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 3dcd1bfba3b4..66608d13a634 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -179,7 +179,7 @@ zfcp_scsi_slave_alloc(struct scsi_device *sdp) | |||
179 | struct zfcp_adapter *adapter; | 179 | struct zfcp_adapter *adapter; |
180 | struct zfcp_unit *unit; | 180 | struct zfcp_unit *unit; |
181 | unsigned long flags; | 181 | unsigned long flags; |
182 | int retval = -ENODEV; | 182 | int retval = -ENXIO; |
183 | 183 | ||
184 | adapter = (struct zfcp_adapter *) sdp->host->hostdata[0]; | 184 | adapter = (struct zfcp_adapter *) sdp->host->hostdata[0]; |
185 | if (!adapter) | 185 | if (!adapter) |