|
@@ -730,6 +730,15 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
|
|
|
if (cmd->transport_state & CMD_T_ABORTED ||
|
|
|
cmd->transport_state & CMD_T_STOP) {
|
|
|
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
|
|
|
+ /*
|
|
|
+ * If COMPARE_AND_WRITE was stopped by __transport_wait_for_tasks(),
|
|
|
+ * release se_device->caw_sem obtained by sbc_compare_and_write()
|
|
|
+ * since target_complete_ok_work() or target_complete_failure_work()
|
|
|
+ * won't be called to invoke the normal CAW completion callbacks.
|
|
|
+ */
|
|
|
+ if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) {
|
|
|
+ up(&dev->caw_sem);
|
|
|
+ }
|
|
|
complete_all(&cmd->t_transport_stop_comp);
|
|
|
return;
|
|
|
} else if (!success) {
|