Skip to content

Commit 25ab0bc

Browse files
Nicholas Bellingermartinkpetersen
authored andcommitted
scsi: sched/wait: Add wait_event_lock_irq_timeout for TASK_UNINTERRUPTIBLE usage
Short of reverting commit 00d909a ("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: 00d909a ("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>
1 parent 0b4aafc commit 25ab0bc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

include/linux/wait.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,10 +1052,9 @@ do { \
10521052
__ret; \
10531053
})
10541054

1055-
#define __wait_event_interruptible_lock_irq_timeout(wq_head, condition, \
1056-
lock, timeout) \
1055+
#define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state) \
10571056
___wait_event(wq_head, ___wait_cond_timeout(condition), \
1058-
TASK_INTERRUPTIBLE, 0, timeout, \
1057+
state, 0, timeout, \
10591058
spin_unlock_irq(&lock); \
10601059
__ret = schedule_timeout(__ret); \
10611060
spin_lock_irq(&lock));
@@ -1089,8 +1088,19 @@ do { \
10891088
({ \
10901089
long __ret = timeout; \
10911090
if (!___wait_cond_timeout(condition)) \
1092-
__ret = __wait_event_interruptible_lock_irq_timeout( \
1093-
wq_head, condition, lock, timeout); \
1091+
__ret = __wait_event_lock_irq_timeout( \
1092+
wq_head, condition, lock, timeout, \
1093+
TASK_INTERRUPTIBLE); \
1094+
__ret; \
1095+
})
1096+
1097+
#define wait_event_lock_irq_timeout(wq_head, condition, lock, timeout) \
1098+
({ \
1099+
long __ret = timeout; \
1100+
if (!___wait_cond_timeout(condition)) \
1101+
__ret = __wait_event_lock_irq_timeout( \
1102+
wq_head, condition, lock, timeout, \
1103+
TASK_UNINTERRUPTIBLE); \
10941104
__ret; \
10951105
})
10961106

0 commit comments

Comments
 (0)