aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c69
1 files changed, 34 insertions, 35 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 2a00f812779a..28c7185f24bc 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -705,32 +705,10 @@ static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *act)
705 return ZFCP_ERP_SUCCEEDED; 705 return ZFCP_ERP_SUCCEEDED;
706} 706}
707 707
708static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *act, 708static void zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *act)
709 int close)
710{ 709{
711 int retval = ZFCP_ERP_SUCCEEDED;
712 struct zfcp_adapter *adapter = act->adapter; 710 struct zfcp_adapter *adapter = act->adapter;
713 711
714 if (close)
715 goto close_only;
716
717 retval = zfcp_erp_adapter_strategy_open_qdio(act);
718 if (retval != ZFCP_ERP_SUCCEEDED)
719 goto failed_qdio;
720
721 retval = zfcp_erp_adapter_strategy_open_fsf(act);
722 if (retval != ZFCP_ERP_SUCCEEDED)
723 goto failed_openfcp;
724
725 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &act->adapter->status);
726
727 return ZFCP_ERP_SUCCEEDED;
728
729 close_only:
730 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN,
731 &act->adapter->status);
732
733 failed_openfcp:
734 /* close queues to ensure that buffers are not accessed by adapter */ 712 /* close queues to ensure that buffers are not accessed by adapter */
735 zfcp_qdio_close(adapter); 713 zfcp_qdio_close(adapter);
736 zfcp_fsf_req_dismiss_all(adapter); 714 zfcp_fsf_req_dismiss_all(adapter);
@@ -738,27 +716,48 @@ static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *act,
738 /* all ports and units are closed */ 716 /* all ports and units are closed */
739 zfcp_erp_modify_adapter_status(adapter, 24, NULL, 717 zfcp_erp_modify_adapter_status(adapter, 24, NULL,
740 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR); 718 ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
741 failed_qdio: 719
742 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK | 720 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK |
743 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, 721 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status);
744 &act->adapter->status);
745 return retval;
746} 722}
747 723
748static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act) 724static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *act)
749{ 725{
750 int retval; 726 struct zfcp_adapter *adapter = act->adapter;
751 727
752 zfcp_erp_adapter_strategy_generic(act, 1); /* close */ 728 if (zfcp_erp_adapter_strategy_open_qdio(act)) {
753 if (act->status & ZFCP_STATUS_ERP_CLOSE_ONLY) 729 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK |
754 return ZFCP_ERP_EXIT; 730 ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED,
731 &adapter->status);
732 return ZFCP_ERP_FAILED;
733 }
755 734
756 retval = zfcp_erp_adapter_strategy_generic(act, 0); /* open */ 735 if (zfcp_erp_adapter_strategy_open_fsf(act)) {
736 zfcp_erp_adapter_strategy_close(act);
737 return ZFCP_ERP_FAILED;
738 }
739
740 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &adapter->status);
741
742 return ZFCP_ERP_SUCCEEDED;
743}
744
745static int zfcp_erp_adapter_strategy(struct zfcp_erp_action *act)
746{
747 struct zfcp_adapter *adapter = act->adapter;
748
749 if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_OPEN) {
750 zfcp_erp_adapter_strategy_close(act);
751 if (act->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
752 return ZFCP_ERP_EXIT;
753 }
757 754
758 if (retval == ZFCP_ERP_FAILED) 755 if (zfcp_erp_adapter_strategy_open(act)) {
759 ssleep(8); 756 ssleep(8);
757 return ZFCP_ERP_FAILED;
758 }
760 759
761 return retval; 760 return ZFCP_ERP_SUCCEEDED;
762} 761}
763 762
764static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act) 763static int zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *act)