+static void target_complete_timeout_work(struct work_struct *work)
+{
+ struct se_cmd *cmd = container_of(work, struct se_cmd, work);
+ unsigned long flags;
+
+ /*
+ * Reset cmd->t_se_count to allow transport_put_cmd()
+ * to allow last call to free memory resources.
+ */
+ spin_lock_irqsave(&cmd->t_state_lock, flags);
+ if (atomic_read(&cmd->t_transport_timeout) > 1) {
+ int tmp = (atomic_read(&cmd->t_transport_timeout) - 1);
+
+ atomic_sub(tmp, &cmd->t_se_count);
+ }
+ spin_unlock_irqrestore(&cmd->t_state_lock, flags);
+
+ transport_put_cmd(cmd);
+}
+
+static void target_complete_failure_work(struct work_struct *work)
+{
+ struct se_cmd *cmd = container_of(work, struct se_cmd, work);
+
+ transport_generic_request_failure(cmd, 1, 1);
+}
+