Minor fixes and improvements

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@235 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2007-12-14 16:43:23 +00:00
parent 2c263786c2
commit 70f471427a
4 changed files with 35 additions and 13 deletions

View File

@@ -302,15 +302,15 @@ static int iscsi_conn_alloc(struct iscsi_session *session, struct conn_info *inf
struct iscsi_conn *conn;
int res = 0;
TRACE_MGMT_DBG("Creating connection for sid %#Lx, cid %u",
(unsigned long long)session->sid, info->cid);
conn = kzalloc(sizeof(*conn), GFP_KERNEL);
if (!conn) {
res = -ENOMEM;
goto out_err;
}
TRACE_MGMT_DBG("Creating connection %p for sid %#Lx, cid %u", conn,
(unsigned long long)session->sid, info->cid);
/* Changing it, change ISCSI_CONN_IOV_MAX as well !! */
conn->read_iov = (struct iovec *)get_zeroed_page(GFP_KERNEL);
if (conn->read_iov == NULL) {

View File

@@ -1987,8 +1987,13 @@ static void iscsi_session_push_cmnd(struct iscsi_cmnd *cmnd)
spin_unlock(&session->sn_lock);
if (unlikely(session->tm_rsp != NULL))
if (unlikely(session->tm_rsp != NULL)) {
struct iscsi_conn *conn = cmnd->conn;
spin_lock_bh(&conn->cmd_list_lock);
__cmnd_abort(cmnd);
spin_unlock_bh(&conn->cmd_list_lock);
iscsi_cond_send_tm_resp(session->tm_rsp, 0);
}
iscsi_cmnd_exec(cmnd);
@@ -2370,7 +2375,7 @@ static void iscsi_cond_send_tm_resp(struct iscsi_cmnd *rsp, int force)
case ISCSI_FUNCTION_ABORT_TASK_SET:
case ISCSI_FUNCTION_CLEAR_TASK_SET:
case ISCSI_FUNCTION_CLEAR_ACA:
if (after(req_hdr->cmd_sn, sess->exp_cmd_sn)) {
if (before(sess->exp_cmd_sn, req_hdr->cmd_sn)) {
TRACE_MGMT_DBG("Delaying TM fn %x response, "
"because not all affected commands "
"received (rsp %p, cmd sn %x, exp sn "

View File

@@ -120,6 +120,9 @@ static void close_conn(struct iscsi_conn *conn)
{
struct iscsi_session *session = conn->session;
struct iscsi_target *target = conn->target;
#ifdef DEBUG
unsigned long start_waiting = jiffies;
#endif
TRACE_ENTRY();
@@ -173,6 +176,9 @@ static void close_conn(struct iscsi_conn *conn)
#ifdef NET_PAGE_CALLBACKS_DEFINED
struct iscsi_cmnd *rsp;
#endif
if (time_after(jiffies, start_waiting+10*HZ))
trace_flag |= TRACE_CONN_OC_DBG;
spin_lock_bh(&conn->cmd_list_lock);
list_for_each_entry(cmnd, &conn->cmd_list, cmd_list_entry) {
TRACE_CONN_CLOSE_DBG("cmd %p, scst_state %x, data_waiting "

View File

@@ -518,6 +518,7 @@ static int plain_main_init(char *filename)
char *p, *q;
int idx;
u32 tid, val;
int res = 0;
if (!(config = fopen(filename, "r")))
return -errno;
@@ -538,27 +539,37 @@ static int plain_main_init(char *filename)
;
} else if (!((idx = param_index_by_name(p, target_keys)) < 0) && tid) {
val = strtol(q, &q, 0);
if (param_check_val(target_keys, idx, &val) < 0)
log_warning("Wrong value %u for parameter %s\n",
if (param_check_val(target_keys, idx, &val) < 0) {
log_error("Wrong value %u for parameter %s\n",
val, target_keys[idx].name);
res = -1;
break;
}
iscsi_param_partial_set(tid, 0, key_target, idx, val);
} else if (!((idx = param_index_by_name(p, session_keys)) < 0) && tid) {
char *str = target_sep_string(&q);
if (param_str_to_val(session_keys, idx, str, &val) < 0) {
log_warning("Wrong value %s for parameter %s\n",
log_error("Wrong value %s for parameter %s\n",
str, session_keys[idx].name);
continue;
res = -1;
break;
}
if (param_check_val(session_keys, idx, &val) < 0)
log_warning("Wrong value %u for parameter %s\n",
if (param_check_val(session_keys, idx, &val) < 0) {
log_error("Wrong value %u for parameter %s\n",
val, session_keys[idx].name);
res = -1;
break;
}
iscsi_param_partial_set(tid, 0, key_session, idx, val);
} else if (param_index_by_name(p, user_keys) < 0)
} else if (param_index_by_name(p, user_keys) < 0) {
log_warning("Unknown iscsi-scstd.conf param: %s\n", p);
res = -1;
break;
}
}
fclose(config);
return 0;
return res;
}
static int plain_default_load(char *params)