[PATCH] target: up caw_sem if COMPARE_AND_WRITE got aborted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nic,

If a se_cmd of COMPARE_AND_WRITE got aborted, "struct semaphore caw_sem" of the corresponding se_device will never being called up().

I propose a patch:


Signed-off-by: Jiang Yi <jiangyilism@xxxxxxxxx>
---
 drivers/target/target_core_transport.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 6025935..02734ca 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -726,6 +726,9 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
      */
     if (cmd->transport_state & CMD_T_ABORTED ||
         cmd->transport_state & CMD_T_STOP) {
+        if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) && success) {
+            up(&dev->caw_sem);
+        }
         spin_unlock_irqrestore(&cmd->t_state_lock, flags);
         complete_all(&cmd->t_transport_stop_comp);
         return;
-- 
2.5.0

                                  by Jiang Yi

--
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



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux