Don't call target drivers on_free_cmd() for internal commands
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 12 Oct 2009 11:47:44 +0000 (11:47 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Mon, 12 Oct 2009 11:47:44 +0000 (11:47 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1201 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_lib.c

index 4c191d7..547f0ff 100644 (file)
@@ -2507,7 +2507,7 @@ void scst_free_cmd(struct scst_cmd *cmd)
        if (!cmd->tgt_data_buf_alloced)
                scst_check_restore_sg_buff(cmd);
 
-       if (cmd->tgtt->on_free_cmd != NULL) {
+       if ((cmd->tgtt->on_free_cmd != NULL) && likely(!cmd->internal)) {
                TRACE_DBG("Calling target's on_free_cmd(%p)", cmd);
                scst_set_cur_start(cmd);
                cmd->tgtt->on_free_cmd(cmd);