Minor fixes and cleanups

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1520 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2010-02-25 13:37:56 +00:00
parent 968f9aa146
commit 713410951b
5 changed files with 30 additions and 9 deletions

View File

@@ -442,6 +442,7 @@ out:
return;
}
/* Must be called from rd thread only */
void iscsi_check_tm_data_wait_timeouts(struct iscsi_conn *conn, bool force)
{
struct iscsi_cmnd *cmnd;
@@ -455,6 +456,8 @@ void iscsi_check_tm_data_wait_timeouts(struct iscsi_conn *conn, bool force)
"j %ld (TIMEOUT %d, force %d)", j,
ISCSI_TM_DATA_WAIT_SCHED_TIMEOUT, force);
iscsi_extracheck_is_rd_thread(conn);
again:
spin_lock_bh(&iscsi_rd_lock);
spin_lock(&conn->write_list_lock);

View File

@@ -88,8 +88,15 @@ static void req_del_from_write_timeout_list(struct iscsi_cmnd *req)
req, conn);
spin_lock_bh(&conn->write_list_lock);
/* Recheck, since it can be changed behind us */
if (unlikely(!req->on_write_timeout_list))
goto out_unlock;
list_del(&req->write_timeout_list_entry);
req->on_write_timeout_list = 0;
out_unlock:
spin_unlock_bh(&conn->write_list_lock);
out:
@@ -151,8 +158,6 @@ void iscsi_restart_cmnd(struct iscsi_cmnd *cmnd)
EXTRACHECKS_BUG_ON(cmnd->r2t_len_to_receive != 0);
EXTRACHECKS_BUG_ON(cmnd->r2t_len_to_send != 0);
iscsi_extracheck_is_rd_thread(cmnd->conn);
req_del_from_write_timeout_list(cmnd);
/*

View File

@@ -189,6 +189,7 @@ struct iscsi_conn {
/* List of data pdus being sent, protected by write_list_lock */
struct list_head write_timeout_list;
/* Protected by write_list_lock */
struct timer_list rsp_timer;
/* All 2 protected by iscsi_wr_lock */
@@ -319,7 +320,7 @@ struct iscsi_cmnd {
struct iscsi_conn *conn;
/*
* Some flags protected by conn->write_list_lock, but all modified only
* Some flags used under conn->write_list_lock, but all modified only
* from single read thread or when there are no references to cmd.
*/
unsigned int hashed:1;
@@ -378,7 +379,7 @@ struct iscsi_cmnd {
struct list_head write_timeout_list_entry;
};
/* Both modified only from single write thread */
/* Both protected by conn->write_list_lock */
unsigned int on_write_timeout_list:1;
unsigned long write_start;

View File

@@ -1155,8 +1155,15 @@ void req_add_to_write_timeout_list(struct iscsi_cmnd *req)
spin_lock_bh(&conn->write_list_lock);
/* Recheck, since it can be changed behind us */
if (unlikely(req->on_write_timeout_list)) {
spin_unlock_bh(&conn->write_list_lock);
goto out;
}
req->on_write_timeout_list = 1;
req->write_start = jiffies;
list_add_tail(&req->write_timeout_list_entry,
&conn->write_timeout_list);

View File

@@ -449,8 +449,10 @@ struct scst_tgt *scst_register(struct scst_tgt_template *vtt,
mutex_unlock(&scst_mutex);
scst_resume_activity();
PRINT_INFO("Target %s (%p) for template %s registered successfully",
target_name, tgt, vtt->name);
PRINT_INFO("Target %s for template %s registered successfully",
tgt->tgt_name, vtt->name);
TRACE_DBG("tgt %p", tgt);
out:
TRACE_EXIT();
@@ -484,7 +486,8 @@ out_free_tgt_err:
out_err:
PRINT_ERROR("Failed to register target %s for template %s (error %d)",
target_name, vtt->name, rc);
(tgt->tgt_name != NULL) ? tgt->tgt_name : target_name,
vtt->name, rc);
goto out;
}
EXPORT_SYMBOL(scst_register);
@@ -553,10 +556,12 @@ again:
del_timer_sync(&tgt->retry_timer);
PRINT_INFO("Target %s for template %s unregistered successfully",
tgt->tgt_name, vtt->name);
scst_tgt_sysfs_put(tgt); /* must not be called under scst_mutex */
PRINT_INFO("Target %p for template %s unregistered successfully",
tgt, vtt->name);
TRACE_DBG("Unregistering tgt %p finished", tgt);
TRACE_EXIT();
return;