[Devel] [PATCH RHEL7 COMMIT] ms/new helper: wait_event_killable_exclusive()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 14 14:49:04 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.1
------>
commit 33cba27d15135e157617e8ae9147baf9925f5e99
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Sat Oct 15 01:49:04 2016 +0400

    ms/new helper: wait_event_killable_exclusive()
    
    Patchset description:
    
    fuse: fix signals handling while processing request
    
    This patch fixes wrong SIGBUS result in page fault handler for fuse file, when
    process received a signal.
    
    https://jira.sw.ru/browse/PSBM-53581
    
    Stanislav Kinsburskiy (2):
          new helper: wait_event_killable_exclusive()
          fuse: handle only fatal signals while waiting request answer
    =====================================================
    This patch description:
    
    Backport of ms commit 6a0fb306738994d6f091791aeb11a5dc87ad8f4c
    ("new helper: wait_event_killable_exclusive()").
    Signed-off-by: Al Viro <viro at zeniv.linux.org.uk>
    
    Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
    Acked-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 include/linux/wait.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 65da9e3..8475f2d 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -710,6 +710,32 @@ do {									\
 	__ret;								\
 })
 
+#define __wait_event_killable_exclusive(wq, condition, ret)		\
+do {									\
+	DEFINE_WAIT(__wait);						\
+									\
+	for (;;) {							\
+		prepare_to_wait_exclusive(&wq, &__wait, TASK_KILLABLE);	\
+		if (condition)						\
+			break;						\
+		if (!fatal_signal_pending(current)) {			\
+			schedule();					\
+			continue;					\
+		}							\
+		ret = -ERESTARTSYS;					\
+		break;							\
+	}								\
+	finish_wait(&wq, &__wait);					\
+} while (0)
+
+
+#define wait_event_killable_exclusive(wq, condition)			\
+({									\
+	int __ret = 0;							\
+	if (!(condition))						\
+		__wait_event_killable_exclusive(wq, condition, __ret);	\
+	__ret;								\
+})
 
 #define __wait_event_lock_irq(wq, condition, lock, cmd)			\
 do {									\


More information about the Devel mailing list