|
|
@@ -1658,7 +1658,7 @@ bool target_stop_cmd(struct se_cmd *cmd, unsigned long *flags)
|
|
|
void transport_generic_request_failure(struct se_cmd *cmd,
|
|
|
sense_reason_t sense_reason)
|
|
|
{
|
|
|
- int ret = 0;
|
|
|
+ int ret = 0, post_ret = 0;
|
|
|
|
|
|
pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08llx"
|
|
|
" CDB: 0x%02x\n", cmd, cmd->tag, cmd->t_task_cdb[0]);
|
|
|
@@ -1680,7 +1680,7 @@ void transport_generic_request_failure(struct se_cmd *cmd,
|
|
|
*/
|
|
|
if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
|
|
|
cmd->transport_complete_callback)
|
|
|
- cmd->transport_complete_callback(cmd, false);
|
|
|
+ cmd->transport_complete_callback(cmd, false, &post_ret);
|
|
|
|
|
|
switch (sense_reason) {
|
|
|
case TCM_NON_EXISTENT_LUN:
|
|
|
@@ -2068,11 +2068,13 @@ static void target_complete_ok_work(struct work_struct *work)
|
|
|
*/
|
|
|
if (cmd->transport_complete_callback) {
|
|
|
sense_reason_t rc;
|
|
|
+ bool caw = (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE);
|
|
|
+ bool zero_dl = !(cmd->data_length);
|
|
|
+ int post_ret = 0;
|
|
|
|
|
|
- rc = cmd->transport_complete_callback(cmd, true);
|
|
|
- if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
|
|
|
- if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
|
|
|
- !cmd->data_length)
|
|
|
+ rc = cmd->transport_complete_callback(cmd, true, &post_ret);
|
|
|
+ if (!rc && !post_ret) {
|
|
|
+ if (caw && zero_dl)
|
|
|
goto queue_rsp;
|
|
|
|
|
|
return;
|
|
|
@@ -2507,23 +2509,24 @@ int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref)
|
|
|
EXPORT_SYMBOL(target_get_sess_cmd);
|
|
|
|
|
|
static void target_release_cmd_kref(struct kref *kref)
|
|
|
- __releases(&se_cmd->se_sess->sess_cmd_lock)
|
|
|
{
|
|
|
struct se_cmd *se_cmd = container_of(kref, struct se_cmd, cmd_kref);
|
|
|
struct se_session *se_sess = se_cmd->se_sess;
|
|
|
+ unsigned long flags;
|
|
|
|
|
|
+ spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
|
|
|
if (list_empty(&se_cmd->se_cmd_list)) {
|
|
|
- spin_unlock(&se_sess->sess_cmd_lock);
|
|
|
+ spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
|
|
|
se_cmd->se_tfo->release_cmd(se_cmd);
|
|
|
return;
|
|
|
}
|
|
|
if (se_sess->sess_tearing_down && se_cmd->cmd_wait_set) {
|
|
|
- spin_unlock(&se_sess->sess_cmd_lock);
|
|
|
+ spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
|
|
|
complete(&se_cmd->cmd_wait_comp);
|
|
|
return;
|
|
|
}
|
|
|
list_del(&se_cmd->se_cmd_list);
|
|
|
- spin_unlock(&se_sess->sess_cmd_lock);
|
|
|
+ spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
|
|
|
|
|
|
se_cmd->se_tfo->release_cmd(se_cmd);
|
|
|
}
|
|
|
@@ -2539,8 +2542,7 @@ int target_put_sess_cmd(struct se_cmd *se_cmd)
|
|
|
se_cmd->se_tfo->release_cmd(se_cmd);
|
|
|
return 1;
|
|
|
}
|
|
|
- return kref_put_spinlock_irqsave(&se_cmd->cmd_kref, target_release_cmd_kref,
|
|
|
- &se_sess->sess_cmd_lock);
|
|
|
+ return kref_put(&se_cmd->cmd_kref, target_release_cmd_kref);
|
|
|
}
|
|
|
EXPORT_SYMBOL(target_put_sess_cmd);
|
|
|
|