]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: sched/wait: Add wait_event_lock_irq_timeout for TASK_UNINTERRUPTIBLE usage
authorNicholas Bellinger <nab@linux-iscsi.org>
Wed, 10 Oct 2018 03:23:09 +0000 (03:23 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 16 Oct 2018 04:11:13 +0000 (00:11 -0400)
Short of reverting commit 00d909a10710 ("scsi: target: Make the session
shutdown code also wait for commands that are being aborted") for v4.19,
target-core needs a wait_event_t macro can be executed using
TASK_UNINTERRUPTIBLE to function correctly with existing fabric drivers that
expect to run with signals pending during session shutdown and active se_cmd
I/O quiesce.

The most notable is iscsi-target/iser-target, while ibmvscsi_tgt invokes
session shutdown logic from userspace via configfs attribute that could also
potentially have signals pending.

So go ahead and introduce wait_event_lock_irq_timeout() to achieve this, and
update + rename __wait_event_lock_irq_timeout() to make it accept 'state' as a
parameter.

Fixes: 00d909a10710 ("scsi: target: Make the session shutdown code also wait for commands that are being aborted")
Cc: <stable@vger.kernel.org> # v4.19+
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Reviewed-by: Bryant G. Ly <bly@catalogicsoftware.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
include/linux/wait.h

index d9f131ecf7081f53417a2dac3cb0f7edf28e7c9f..ed7c122cb31f407f70a36a198d5e6d9ae48c01fa 100644 (file)
@@ -1052,10 +1052,9 @@ do {                                                                             \
        __ret;                                                                  \
 })
 
-#define __wait_event_interruptible_lock_irq_timeout(wq_head, condition,                \
-                                                   lock, timeout)              \
+#define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state)        \
        ___wait_event(wq_head, ___wait_cond_timeout(condition),                 \
-                     TASK_INTERRUPTIBLE, 0, timeout,                           \
+                     state, 0, timeout,                                        \
                      spin_unlock_irq(&lock);                                   \
                      __ret = schedule_timeout(__ret);                          \
                      spin_lock_irq(&lock));
@@ -1089,8 +1088,19 @@ do {                                                                             \
 ({                                                                             \
        long __ret = timeout;                                                   \
        if (!___wait_cond_timeout(condition))                                   \
-               __ret = __wait_event_interruptible_lock_irq_timeout(            \
-                                       wq_head, condition, lock, timeout);     \
+               __ret = __wait_event_lock_irq_timeout(                          \
+                                       wq_head, condition, lock, timeout,      \
+                                       TASK_INTERRUPTIBLE);                    \
+       __ret;                                                                  \
+})
+
+#define wait_event_lock_irq_timeout(wq_head, condition, lock, timeout)         \
+({                                                                             \
+       long __ret = timeout;                                                   \
+       if (!___wait_cond_timeout(condition))                                   \
+               __ret = __wait_event_lock_irq_timeout(                          \
+                                       wq_head, condition, lock, timeout,      \
+                                       TASK_UNINTERRUPTIBLE);                  \
        __ret;                                                                  \
 })