For consistency, free the target se_cmd before putting the pages related to the command. Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxxxxxxxxxx> --- This function is invoked in vhost worker thread context to complete a request. I'm not sure whether it's safe to call transport_generic_free_cmd() from another kernel thread. I'm also not sure if we really need to set the wait_for_tasks argument here since the task really should be done by now. Basically this function is supposed to quiesce the task, put page references, and then free the struct. Thoughts? drivers/target/tcm_vhost/tcm_vhost_scsi.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/target/tcm_vhost/tcm_vhost_scsi.c b/drivers/target/tcm_vhost/tcm_vhost_scsi.c index 93b3a82..f887ed5 100644 --- a/drivers/target/tcm_vhost/tcm_vhost_scsi.c +++ b/drivers/target/tcm_vhost/tcm_vhost_scsi.c @@ -42,6 +42,7 @@ static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd) struct se_cmd *se_cmd = &tv_cmd->tvc_se_cmd; /* TODO locking against target/backend threads? */ + transport_generic_free_cmd(se_cmd, 1); if (tv_cmd->tvc_sgl_count) { u32 i; @@ -49,8 +50,6 @@ static void vhost_scsi_free_cmd(struct tcm_vhost_cmd *tv_cmd) put_page(sg_page(&tv_cmd->tvc_sgl[i])); } - /* TODO what does wait_for_tasks do? */ - transport_generic_free_cmd(se_cmd, 1); kfree(tv_cmd); } -- 1.7.9.1 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html