scst_sess_get() should be done in scst_pre_rx_mgmt_cmd() instead of scst_post_rx_mgmt_cmd()

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4423 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-07-25 18:48:06 +00:00
parent 55fc545848
commit 0601427337

View File

@@ -222,6 +222,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;
@@ -231,7 +233,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();
@@ -6036,6 +6037,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;
@@ -6058,8 +6063,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);
@@ -6069,7 +6072,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) {