Increment session refcount in scst_pre_rx_mgmt_cmd() instead of scst_post_rx_mgmt_cmd() (merge r4423 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4626 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-11-25 08:12:26 +00:00
parent 7ba44bbc51
commit 391ae47690
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -1768,7 +1768,7 @@ size_t qla2xxx_del_vtarget(u64 *port_name)
/* We only allow support on Channel 0 !!! */
list_for_each_entry(vport, &fc_host->vports, peers) {
if ((vport->channel == 0) &&
(vport->port_name == *port_name)) {
(vport->port_name == *port_name)) {
match = 1;
break;
}
+6 -4
View File
@@ -209,6 +209,8 @@ struct scst_cmd *scst_rx_cmd(struct scst_session *sess,
goto out;
cmd->sess = sess;
scst_sess_get(sess);
cmd->tgt = sess->tgt;
cmd->tgtt = sess->tgt->tgtt;
@@ -218,7 +220,6 @@ struct scst_cmd *scst_rx_cmd(struct scst_session *sess,
SCST_LOAD_SENSE(scst_sense_lun_not_supported));
TRACE_DBG("cmd %p, sess %p", cmd, sess);
scst_sess_get(sess);
out:
TRACE_EXIT();
@@ -5947,6 +5948,10 @@ static struct scst_mgmt_cmd *scst_pre_rx_mgmt_cmd(struct scst_session
}
mcmd->sess = sess;
scst_sess_get(sess);
atomic_inc(&sess->sess_cmd_count);
mcmd->fn = fn;
mcmd->state = SCST_MCMD_STATE_INIT;
mcmd->tgt_priv = tgt_priv;
@@ -5969,8 +5974,6 @@ static int scst_post_rx_mgmt_cmd(struct scst_session *sess,
TRACE_ENTRY();
scst_sess_get(sess);
if (unlikely(sess->shut_phase != SCST_SESS_SPH_READY)) {
PRINT_CRIT_ERROR("New mgmt cmd while shutting down the "
"session %p shut_phase %ld", sess, sess->shut_phase);
@@ -5980,7 +5983,6 @@ static int scst_post_rx_mgmt_cmd(struct scst_session *sess,
local_irq_save(flags);
spin_lock(&sess->sess_list_lock);
atomic_inc(&sess->sess_cmd_count);
if (unlikely(sess->init_phase != SCST_SESS_IPH_READY)) {
switch (sess->init_phase) {