Merge of r764

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/1.0.1.x@765 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-04-09 10:26:48 +00:00
parent 2a3c56b408
commit fa191c256b
12 changed files with 216 additions and 81 deletions
+6
View File
@@ -2647,6 +2647,12 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd)
if (unlikely(old_state != ISCSI_CMD_STATE_RESTARTED)) {
TRACE_DBG("req %p on %d state", req, old_state);
/*
* We could preliminary have finished req before we knew its
* device, so check if we return correct sense format.
*/
scst_check_convert_sense(scst_cmd);
create_status_rsp(req, status, sense, sense_len);
switch (old_state) {
+1 -2
View File
@@ -122,7 +122,6 @@ struct iscsi_session {
struct iscsi_session *sess_reinst_successor;
unsigned int sess_reinstating:1;
unsigned int sess_shutting_down:1;
unsigned int deleted_from_session_list:1;
/* All don't need any protection */
char *initiator_name;
@@ -456,7 +455,7 @@ extern struct iscsi_session *session_lookup(struct iscsi_target *, u64);
extern void sess_enable_reinstated_sess(struct iscsi_session *);
extern int session_add(struct iscsi_target *, struct iscsi_kern_session_info *);
extern int session_del(struct iscsi_target *, u64);
extern int session_free(struct iscsi_session *session);
extern int session_free(struct iscsi_session *session, bool del);
/* params.c */
extern int iscsi_param_set(struct iscsi_target *,
+1 -12
View File
@@ -552,18 +552,7 @@ static void close_conn(struct iscsi_conn *conn)
if (list_empty(&session->conn_list)) {
sBUG_ON(session->sess_reinst_successor != NULL);
list_del(&session->session_list_entry);
session->deleted_from_session_list = 1;
mutex_unlock(&target->target_mutex);
if (session->scst_sess != NULL) {
scst_unregister_session(session->scst_sess, 1, NULL);
session->scst_sess = NULL;
}
mutex_lock(&target->target_mutex);
session_free(session);
session_free(session, true);
}
mutex_unlock(&target->target_mutex);
+20 -8
View File
@@ -196,7 +196,7 @@ int session_add(struct iscsi_target *target,
* Mutex target_mgmt_mutex won't allow to add connections to
* the new session after target_mutex was dropped, so it's safe
* to replace the initial UA without it. We can't do it under
* target_mutex, because otherwise we will establish a
* target_mutex, because otherwise we can establish a
* circular locking dependency between target_mutex and
* scst_mutex in SCST core (iscsi_report_aen() called by
* SCST core under scst_mutex).
@@ -213,13 +213,15 @@ out_err_unlock:
scst_unregister_session(new_sess->scst_sess, 1, NULL);
new_sess->scst_sess = NULL;
new_sess->deleted_from_session_list = 1; /* it wasn't added, actually */
session_free(new_sess);
mutex_lock(&target->target_mutex);
session_free(new_sess, false);
mutex_unlock(&target->target_mutex);
goto out;
}
/* target_mutex supposed to be locked */
int session_free(struct iscsi_session *session)
int session_free(struct iscsi_session *session, bool del)
{
unsigned int i;
@@ -236,8 +238,6 @@ int session_free(struct iscsi_session *session)
for (i = 0; i < ARRAY_SIZE(session->cmnd_hash); i++)
sBUG_ON(!list_empty(&session->cmnd_hash[i]));
sBUG_ON(session->scst_sess != NULL);
if (session->sess_reinst_successor != NULL)
sess_enable_reinstated_sess(session->sess_reinst_successor);
@@ -253,7 +253,19 @@ int session_free(struct iscsi_session *session)
}
}
if (!session->deleted_from_session_list)
if (session->scst_sess != NULL) {
/*
* We must NOT call scst_unregister_session() in the waiting
* mode, since we are under target_mutex. Otherwise we can
* establish a circular locking dependency between target_mutex
* and scst_mutex in SCST core (iscsi_report_aen() called by
* SCST core under scst_mutex).
*/
scst_unregister_session(session->scst_sess, 0, NULL);
session->scst_sess = NULL;
}
if (del)
list_del(&session->session_list_entry);
kfree(session->initiator_name);
@@ -277,7 +289,7 @@ int session_del(struct iscsi_target *target, u64 sid)
return -EBUSY;
}
return session_free(session);
return session_free(session, true);
}
/* target_mutex supposed to be locked */