[PATCH 1/2] wait: add wait_event_freezable_killable_exclusive

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

 



Add a freezable variant of exclusive wait.  This can be useful
in, for example, FUSE when system suspend occurs while FUSE is
blocked on requests (which prevents system suspend.)

Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
---
 include/linux/wait.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 327894f022cf..b98cfd094543 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -657,6 +657,20 @@ do {										\
 	__ret;									\
 })
 
+#define __wait_event_freezable_killable_exclusive(wq, condition)		\
+	___wait_event(wq, condition, (TASK_KILLABLE|TASK_FREEZABLE), 1, 0,	\
+		      schedule())
+
+#define wait_event_freezable_killable_exclusive(wq, condition)			\
+({										\
+	int __ret = 0;								\
+	might_sleep();								\
+	if (!(condition))							\
+		__ret = __wait_event_freezable_killable_exclusive(wq,		\
+								  condition);	\
+	__ret;									\
+})
+
 /**
  * wait_event_idle - wait for a condition without contributing to system load
  * @wq_head: the waitqueue to wait on
-- 
2.50.0.rc1.591.g9c95f17f64-goog





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux