Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] zfcp: fix handling of port boxed and lun boxed fsf states

From: Maxim Shchetynin <maxim@de.ibm.com>

Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Andreas Herrmann and committed by
James Bottomley
d736a27b cd8a383e

+75 -28
+1
drivers/s390/scsi/zfcp_def.h
··· 490 490 #define ZFCP_STATUS_COMMON_CLOSING 0x02000000 491 491 #define ZFCP_STATUS_COMMON_ERP_INUSE 0x01000000 492 492 #define ZFCP_STATUS_COMMON_ACCESS_DENIED 0x00800000 493 + #define ZFCP_STATUS_COMMON_ACCESS_BOXED 0x00400000 493 494 494 495 /* adapter status */ 495 496 #define ZFCP_STATUS_ADAPTER_QDIOUP 0x00000002
+58 -10
drivers/s390/scsi/zfcp_erp.c
··· 3482 3482 } 3483 3483 3484 3484 /* 3485 + * function: zfcp_erp_port_boxed 3486 + * 3487 + * purpose: 3488 + */ 3489 + void 3490 + zfcp_erp_port_boxed(struct zfcp_port *port) 3491 + { 3492 + struct zfcp_adapter *adapter = port->adapter; 3493 + unsigned long flags; 3494 + 3495 + debug_text_event(adapter->erp_dbf, 3, "p_access_boxed"); 3496 + debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); 3497 + read_lock_irqsave(&zfcp_data.config_lock, flags); 3498 + zfcp_erp_modify_port_status(port, 3499 + ZFCP_STATUS_COMMON_ACCESS_BOXED, 3500 + ZFCP_SET); 3501 + read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3502 + zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); 3503 + } 3504 + 3505 + /* 3506 + * function: zfcp_erp_unit_boxed 3507 + * 3508 + * purpose: 3509 + */ 3510 + void 3511 + zfcp_erp_unit_boxed(struct zfcp_unit *unit) 3512 + { 3513 + struct zfcp_adapter *adapter = unit->port->adapter; 3514 + 3515 + debug_text_event(adapter->erp_dbf, 3, "u_access_boxed"); 3516 + debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3517 + zfcp_erp_modify_unit_status(unit, 3518 + ZFCP_STATUS_COMMON_ACCESS_BOXED, 3519 + ZFCP_SET); 3520 + zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); 3521 + } 3522 + 3523 + /* 3485 3524 * function: zfcp_erp_port_access_denied 3486 3525 * 3487 3526 * purpose: ··· 3531 3492 struct zfcp_adapter *adapter = port->adapter; 3532 3493 unsigned long flags; 3533 3494 3534 - debug_text_event(adapter->erp_dbf, 3, "p_access_block"); 3495 + debug_text_event(adapter->erp_dbf, 3, "p_access_denied"); 3535 3496 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); 3536 3497 read_lock_irqsave(&zfcp_data.config_lock, flags); 3537 - zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED | 3538 - ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 3498 + zfcp_erp_modify_port_status(port, 3499 + ZFCP_STATUS_COMMON_ERP_FAILED | 3500 + ZFCP_STATUS_COMMON_ACCESS_DENIED, 3501 + ZFCP_SET); 3539 3502 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3540 3503 } 3541 3504 ··· 3551 3510 { 3552 3511 struct zfcp_adapter *adapter = unit->port->adapter; 3553 3512 3554 - debug_text_event(adapter->erp_dbf, 3, "u_access_block"); 3513 + debug_text_event(adapter->erp_dbf, 3, "u_access_denied"); 3555 3514 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3556 - zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_ERP_FAILED | 3557 - ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 3515 + zfcp_erp_modify_unit_status(unit, 3516 + ZFCP_STATUS_COMMON_ERP_FAILED | 3517 + ZFCP_STATUS_COMMON_ACCESS_DENIED, 3518 + ZFCP_SET); 3558 3519 } 3559 3520 3560 3521 /* ··· 3570 3527 struct zfcp_port *port; 3571 3528 unsigned long flags; 3572 3529 3573 - debug_text_event(adapter->erp_dbf, 3, "a_access_unblock"); 3530 + debug_text_event(adapter->erp_dbf, 3, "a_access_recover"); 3574 3531 debug_event(adapter->erp_dbf, 3, &adapter->name, 8); 3575 3532 3576 3533 read_lock_irqsave(&zfcp_data.config_lock, flags); ··· 3593 3550 struct zfcp_adapter *adapter = port->adapter; 3594 3551 struct zfcp_unit *unit; 3595 3552 3596 - debug_text_event(adapter->erp_dbf, 3, "p_access_unblock"); 3553 + debug_text_event(adapter->erp_dbf, 3, "p_access_recover"); 3597 3554 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); 3598 3555 3599 3556 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 3557 + &port->status) && 3558 + !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, 3600 3559 &port->status)) { 3601 3560 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 3602 3561 list_for_each_entry(unit, &port->unit_list_head, list) ··· 3625 3580 { 3626 3581 struct zfcp_adapter *adapter = unit->port->adapter; 3627 3582 3628 - debug_text_event(adapter->erp_dbf, 3, "u_access_unblock"); 3583 + debug_text_event(adapter->erp_dbf, 3, "u_access_recover"); 3629 3584 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3630 3585 3631 - if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &unit->status)) 3586 + if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 3587 + &unit->status) && 3588 + !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, 3589 + &unit->status)) 3632 3590 return; 3633 3591 3634 3592 ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx "
+2
drivers/s390/scsi/zfcp_ext.h
··· 171 171 172 172 extern int zfcp_test_link(struct zfcp_port *); 173 173 174 + extern void zfcp_erp_port_boxed(struct zfcp_port *); 175 + extern void zfcp_erp_unit_boxed(struct zfcp_unit *); 174 176 extern void zfcp_erp_port_access_denied(struct zfcp_port *); 175 177 extern void zfcp_erp_unit_access_denied(struct zfcp_unit *); 176 178 extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *);
+14 -18
drivers/s390/scsi/zfcp_fsf.c
··· 1228 1228 zfcp_get_busid_by_unit(unit)); 1229 1229 debug_text_event(new_fsf_req->adapter->erp_dbf, 2, 1230 1230 "fsf_s_pboxed"); 1231 - zfcp_erp_port_reopen(unit->port, 0); 1231 + zfcp_erp_port_boxed(unit->port); 1232 1232 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1233 1233 | ZFCP_STATUS_FSFREQ_RETRY; 1234 1234 break; ··· 1240 1240 unit->fcp_lun, unit->port->wwpn, 1241 1241 zfcp_get_busid_by_unit(unit)); 1242 1242 debug_text_event(new_fsf_req->adapter->erp_dbf, 1, "fsf_s_lboxed"); 1243 - zfcp_erp_unit_reopen(unit, 0); 1244 - zfcp_cmd_dbf_event_fsf("unitbox", new_fsf_req, 1245 - &new_fsf_req->qtcb->header.fsf_status_qual, 1246 - sizeof(union fsf_status_qual)); 1243 + zfcp_erp_unit_boxed(unit); 1247 1244 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1248 1245 | ZFCP_STATUS_FSFREQ_RETRY; 1249 1246 break; ··· 1570 1573 "(adapter %s, port d_id=0x%08x)\n", 1571 1574 zfcp_get_busid_by_port(port), port->d_id); 1572 1575 debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed"); 1573 - zfcp_erp_port_reopen(port, 0); 1576 + zfcp_erp_port_boxed(port); 1574 1577 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1575 1578 | ZFCP_STATUS_FSFREQ_RETRY; 1576 1579 break; ··· 2457 2460 /* mark port as open */ 2458 2461 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN | 2459 2462 ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); 2463 + atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED | 2464 + ZFCP_STATUS_COMMON_ACCESS_BOXED, 2465 + &port->status); 2460 2466 retval = 0; 2461 2467 /* check whether D_ID has changed during open */ 2462 2468 /* ··· 2803 2803 port->wwpn, 2804 2804 zfcp_get_busid_by_port(port)); 2805 2805 debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_pboxed"); 2806 - zfcp_erp_port_reopen(port, 0); 2806 + zfcp_erp_port_boxed(port); 2807 2807 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2808 2808 ZFCP_STATUS_FSFREQ_RETRY; 2809 2809 break; ··· 3035 3035 "needs to be reopened\n", 3036 3036 unit->port->wwpn, zfcp_get_busid_by_unit(unit)); 3037 3037 debug_text_event(adapter->erp_dbf, 2, "fsf_s_pboxed"); 3038 - zfcp_erp_port_reopen(unit->port, 0); 3038 + zfcp_erp_port_boxed(unit->port); 3039 3039 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 3040 3040 ZFCP_STATUS_FSFREQ_RETRY; 3041 3041 break; ··· 3145 3145 unit->handle); 3146 3146 /* mark unit as open */ 3147 3147 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 3148 - 3148 + atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED | 3149 + ZFCP_STATUS_COMMON_ACCESS_BOXED, 3150 + &unit->status); 3149 3151 if (adapter->supported_features & FSF_FEATURE_LUN_SHARING){ 3150 3152 if (!exclusive) 3151 3153 atomic_set_mask(ZFCP_STATUS_UNIT_SHARED, ··· 3337 3335 unit->port->wwpn, 3338 3336 zfcp_get_busid_by_unit(unit)); 3339 3337 debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_s_pboxed"); 3340 - zfcp_erp_port_reopen(unit->port, 0); 3338 + zfcp_erp_port_boxed(unit->port); 3341 3339 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 3342 3340 ZFCP_STATUS_FSFREQ_RETRY; 3343 3341 break; ··· 3883 3881 "needs to be reopened\n", 3884 3882 unit->port->wwpn, zfcp_get_busid_by_unit(unit)); 3885 3883 debug_text_event(fsf_req->adapter->erp_dbf, 2, "fsf_s_pboxed"); 3886 - zfcp_erp_port_reopen(unit->port, 0); 3887 - zfcp_cmd_dbf_event_fsf("portbox", fsf_req, 3888 - &header->fsf_status_qual, 3889 - sizeof (union fsf_status_qual)); 3884 + zfcp_erp_port_boxed(unit->port); 3890 3885 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 3891 3886 ZFCP_STATUS_FSFREQ_RETRY; 3892 3887 break; ··· 3894 3895 zfcp_get_busid_by_unit(unit), 3895 3896 unit->port->wwpn, unit->fcp_lun); 3896 3897 debug_text_event(fsf_req->adapter->erp_dbf, 1, "fsf_s_lboxed"); 3897 - zfcp_erp_unit_reopen(unit, 0); 3898 - zfcp_cmd_dbf_event_fsf("unitbox", fsf_req, 3899 - &header->fsf_status_qual, 3900 - sizeof(union fsf_status_qual)); 3898 + zfcp_erp_unit_boxed(unit); 3901 3899 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 3902 3900 | ZFCP_STATUS_FSFREQ_RETRY; 3903 3901 break;