WTF: patch "[PATCH] qla2xxx: added sess generations to detect RSCN update races" was seriously submitted to be applied to the 4.1-stable tree?
Subsystems (3)
[email protected]
maintainerThe patch below was submitted to be applied to the 4.1-stable tree.
I fail to see how this patch meets the stable kernel rules as found at Documentation/stable_kernel_rules.txt.
I could be totally wrong, and if so, please respond to <[email protected]> and let me know why this patch should be applied. Otherwise, it is now dropped from my patch queues, never to be seen again.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
df673274fa4896f25f0bf348d2a3535d74b4cbecMon Sep 17 00:00:00 2001
From: Alexei Potashnik <[email protected]>
Date: Tue, 14 Jul 2015 16:00:46 -0400
Subject: [PATCH] qla2xxx: added sess generations to detect RSCN update races
RSCN processing in qla2xxx driver can run in parallel with ELS/IO processing. As such the decision to remove disappeared fc port's session could be stale, because a new login sequence has occurred since and created a brand new session.
Previous mechanism of dealing with this by delaying deletion request was prone to erroneous deletions if the event that was supposed to cancel the deletion never arrived or has been delayed in processing.
New mechanism relies on a time-like generation counter to serialize RSCN updates relative to ELS/IO updates.
drivers/scsi/qla2xxx/qla_dbg.c +1 -1
@@ -68,7 +68,7 @@* | | | 0xd101-0xd1fe | * | | | 0xd214-0xd2fe | * | Target Mode | 0xe080 | | -* | Target Mode Management | 0xf091 | 0xf002 | +* | Target Mode Management | 0xf096 | 0xf002 | * | | | 0xf046-0xf049 | * | Target Mode Task Management | 0x1000d | | * ----------------------------------------------------------------------
drivers/scsi/qla2xxx/qla_def.h +5 -0
@@ -3586,6 +3586,11 @@ typedef struct scsi_qla_host {struct list_head qla_sess_op_cmd_list;spinlock_t cmd_list_lock; +/* Counter to detect races between ELS and RSCN events */ +atomic_t generation_tick; +/* Time when global fcport update has been scheduled */ +int total_fcport_update_gen; +uint32_t vp_abort_cnt;struct fc_vport *fc_vport;/* holds fc_vport * for each vport */
drivers/scsi/qla2xxx/qla_init.c +20 -12
@@ -2927,24 +2927,14 @@ qla2x00_rport_del(void *data) {fc_port_t *fcport = data;struct fc_rport *rport; -scsi_qla_host_t *vha = fcport->vha;unsigned long flags; -unsigned long vha_flags;spin_lock_irqsave (fcport->vha->host->host_lock, flags); rport = fcport->drport ? fcport->drport: fcport->rport; fcport->drport =NULL ;spin_unlock_irqrestore (fcport->vha->host->host_lock, flags); -if (rport) { +if (rport)fc_remote_port_delete (rport); -/* -* Release the target mode FC NEXUS in qla_target.c code -* if target mod is enabled. -*/ -spin_lock_irqsave (&vha->hw->hardware_lock, vha_flags); -qlt_fc_port_deleted (vha, fcport); -spin_unlock_irqrestore (&vha->hw->hardware_lock, vha_flags); - } }/**
@@ -3384,6 +3374,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)LIST_HEAD (new_fcports);struct qla_hw_data *ha = vha->hw;struct scsi_qla_host *base_vha =pci_get_drvdata (ha->pdev); +int discovery_gen;/* If FL port exists, then SNS is present */ if (IS_FWI2_CAPABLE (ha))
@@ -3454,6 +3445,14 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) fcport->scan_state =QLA_FCPORT_SCAN ; } +/* Mark the time right before querying FW for connected ports. +* This process is long, asynchronous and by the time it's done, +* collected information might not be accurate anymore. E.g. +* disconnected port might have re-connected and a brand new +* session has been created. In this case session's generation +* will be newer than discovery_gen. */ +qlt_do_generation_tick (vha, &discovery_gen); + rval =qla2x00_find_all_fabric_devs (vha, &new_fcports);if (rval !=QLA_SUCCESS )break ;
@@ -3505,7 +3504,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)atomic_read (&fcport->state), fcport->flags, fcport->fc4_type, fcport->scan_state); -qlt_fc_port_deleted (vha, fcport); +qlt_fc_port_deleted (vha, fcport, + discovery_gen); } } }
@@ -4282,6 +4282,14 @@ qla2x00_update_fcports(scsi_qla_host_t *base_vha) atomic_read(&fcport->state) != FCS_UNCONFIGURED) {spin_unlock_irqrestore (&ha->vport_slock, flags);qla2x00_rport_del (fcport); + +/* +* Release the target mode FC NEXUS in +* qla_target.c, if target mod is enabled. +*/ +qlt_fc_port_deleted (vha, fcport, + base_vha->total_fcport_update_gen); +spin_lock_irqsave (&ha->vport_slock, flags); } }
drivers/scsi/qla2xxx/qla_os.c +4 -1
@@ -3230,11 +3230,14 @@ qla2x00_schedule_rport_del(struct scsi_qla_host *vha, fc_port_t *fcport,spin_lock_irqsave (vha->host->host_lock, flags); fcport->drport = rport;spin_unlock_irqrestore (vha->host->host_lock, flags); +qlt_do_generation_tick (vha, &base_vha->total_fcport_update_gen);set_bit (FCPORT_UPDATE_NEEDED , &base_vha->dpc_flags);qla2xxx_wake_dpc (base_vha); }else { +int now;fc_remote_port_delete (rport); -qlt_fc_port_deleted (vha, fcport); +qlt_do_generation_tick (vha, &now); +qlt_fc_port_deleted (vha, fcport, now); } }
drivers/scsi/qla2xxx/qla_target.c +49 -11
138 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_target.h +4 -1
@@ -919,6 +919,8 @@ struct qla_tgt_sess {unsigned char logout_completed; +int generation; +struct se_session *se_sess;struct scsi_qla_host *vha;struct qla_tgt *tgt;
@@ -1086,7 +1088,7 @@ extern int qlt_lport_register(void *, u64, u64, u64,extern void qlt_lport_deregister (struct scsi_qla_host *);extern void qlt_unreg_sess (struct qla_tgt_sess *);extern void qlt_fc_port_added (struct scsi_qla_host *,fc_port_t *); -extern void qlt_fc_port_deleted (struct scsi_qla_host *,fc_port_t *); +extern void qlt_fc_port_deleted (struct scsi_qla_host *,fc_port_t *,int );extern int __init qlt_init (void );extern void qlt_exit (void );extern void qlt_update_vp_map (struct scsi_qla_host *,int );
@@ -1163,5 +1165,6 @@ extern irqreturn_t qla83xx_msix_atio_q(int, void *);extern void qlt_83xx_iospace_config (struct qla_hw_data *);extern int qlt_free_qfull_cmds (struct scsi_qla_host *);extern void qlt_logo_completion_handler (fc_port_t *,int ); +extern void qlt_do_generation_tick (struct scsi_qla_host *,int *);#endif /* __QLA_TARGET_H */