Let's be safe and always do memory barrier after all *_get().

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2462 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2010-10-25 13:09:47 +00:00
parent 499da51437
commit 27ed60c19d
3 changed files with 16 additions and 27 deletions

View File

@@ -3166,7 +3166,7 @@ static void iscsi_preprocessing_done(struct scst_cmd *scst_cmd)
* because there can be only one read thread processing
* connection.
*/
cmnd_get_ordered(req);
cmnd_get(req);
req->scst_state = ISCSI_CMD_STATE_AFTER_PREPROC;
iscsi_make_conn_rd_active(req->conn);
if (unlikely(req->conn->closing)) {

View File

@@ -679,12 +679,10 @@ static inline void cmnd_get(struct iscsi_cmnd *cmnd)
atomic_inc(&cmnd->ref_cnt);
TRACE_DBG("cmnd %p, new cmnd->ref_cnt %d", cmnd,
atomic_read(&cmnd->ref_cnt));
}
static inline void cmnd_get_ordered(struct iscsi_cmnd *cmnd)
{
cmnd_get(cmnd);
/* See comments for each cmnd_get_ordered() use */
/*
* For the same reason as in kref_get(). Let's be safe and
* always do it.
*/
smp_mb__after_atomic_inc();
}
@@ -767,12 +765,10 @@ static inline void conn_get(struct iscsi_conn *conn)
atomic_inc(&conn->conn_ref_cnt);
TRACE_DBG("conn %p, new conn_ref_cnt %d", conn,
atomic_read(&conn->conn_ref_cnt));
}
static inline void conn_get_ordered(struct iscsi_conn *conn)
{
conn_get(conn);
/* See comments for each conn_get_ordered() use */
/*
* For the same reason as in kref_get(). Let's be safe and
* always do it.
*/
smp_mb__after_atomic_inc();
}

View File

@@ -280,22 +280,15 @@ static inline bool ucmd_get_check(struct scst_user_cmd *ucmd)
return res;
}
static inline void __ucmd_get(struct scst_user_cmd *ucmd, bool barrier)
static inline void ucmd_get(struct scst_user_cmd *ucmd)
{
TRACE_DBG("ucmd %p, ucmd_ref %d", ucmd, atomic_read(&ucmd->ucmd_ref));
atomic_inc(&ucmd->ucmd_ref);
if (barrier)
smp_mb__after_atomic_inc();
}
static inline void ucmd_get_ordered(struct scst_user_cmd *ucmd)
{
__ucmd_get(ucmd, true);
}
static inline void ucmd_get(struct scst_user_cmd *ucmd)
{
__ucmd_get(ucmd, false);
/*
* For the same reason as in kref_get(). Let's be safe and
* always do it.
*/
smp_mb__after_atomic_inc();
}
/* Must not be called under cmd_list_lock!! */
@@ -1412,7 +1405,7 @@ static int dev_user_process_reply_exec(struct scst_user_cmd *ucmd,
* Otherwise, due to reorder, in dev_user_process_reply()
* it is possible that ucmd is destroyed before it "got" here.
*/
ucmd_get_ordered(ucmd);
ucmd_get(ucmd);
ucmd->background_exec = 1;
TRACE_DBG("Background ucmd %p", ucmd);
goto out_compl;