git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4604 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-11-06 21:31:51 +00:00
parent edadea8fd0
commit e6bff8a950
2 changed files with 23 additions and 16 deletions
+23 -3
View File
@@ -4673,7 +4673,7 @@ static int scst_ws_push_single_write(struct scst_write_same_priv *wsp,
if (sg == NULL) {
PRINT_ERROR("Unable to alloc sg for %d blocks", blocks);
res = -ENOMEM;
goto out_destroy;
goto out_free_cmd;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
@@ -4715,8 +4715,8 @@ out:
TRACE_EXIT_RES(res);
return res;
out_destroy:
scst_destroy_cmd(cmd);
out_free_cmd:
__scst_cmd_put(cmd);
out_busy:
scst_set_busy(ws_cmd);
@@ -5328,6 +5328,26 @@ out_free:
goto out;
}
static void scst_destroy_cmd(struct scst_cmd *cmd)
{
TRACE_ENTRY();
TRACE_DBG("Destroying cmd %p", cmd);
scst_sess_put(cmd->sess);
/*
* At this point tgt_dev can be dead, but the pointer remains non-NULL
*/
if (likely(cmd->tgt_dev != NULL))
scst_put(cmd->cpu_cmd_counter);
kmem_cache_free(scst_cmd_cachep, cmd);
TRACE_EXIT();
return;
}
/* No locks supposed to be held */
void scst_free_cmd(struct scst_cmd *cmd)
{
-13
View File
@@ -674,19 +674,6 @@ static inline void scst_sess_put(struct scst_session *sess)
struct scst_cmd *scst_alloc_cmd(const uint8_t *cdb,
unsigned int cdb_len, gfp_t gfp_mask);
void scst_free_cmd(struct scst_cmd *cmd);
static inline void scst_destroy_cmd(struct scst_cmd *cmd)
{
scst_sess_put(cmd->sess);
/*
* At this point tgt_dev can be dead, but the pointer remains non-NULL
*/
if (likely(cmd->tgt_dev != NULL))
scst_put(cmd->cpu_cmd_counter);
kmem_cache_free(scst_cmd_cachep, cmd);
return;
}
static inline void __scst_cmd_get(struct scst_cmd *cmd)
{