aboutsummaryrefslogtreecommitdiffstats
path: root/fs/orangefs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-02-13 10:49:24 -0500
committerMike Marshall <hubcap@omnibond.com>2016-02-19 13:45:53 -0500
commitc72f15b7d9b3cc744f066776dd0e61e6ab25e7d2 (patch)
tree707390e53b298b9c6c4fbf5e279648b8e2364581 /fs/orangefs
parent98815ade9eaca3c4729710129a651aa0b43d007a (diff)
service_operation(): don't block signals, just use ..._killable
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/orangefs-kernel.h4
-rw-r--r--fs/orangefs/orangefs-utils.c21
-rw-r--r--fs/orangefs/waitqueue.c29
3 files changed, 14 insertions, 40 deletions
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index de898bda7859..8613d4166d0f 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -580,10 +580,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
580 580
581void orangefs_make_bad_inode(struct inode *inode); 581void orangefs_make_bad_inode(struct inode *inode);
582 582
583void orangefs_block_signals(sigset_t *);
584
585void orangefs_set_signals(sigset_t *);
586
587int orangefs_unmount_sb(struct super_block *sb); 583int orangefs_unmount_sb(struct super_block *sb);
588 584
589bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op); 585bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
diff --git a/fs/orangefs/orangefs-utils.c b/fs/orangefs/orangefs-utils.c
index 63e8c9bc912e..488f3501b09c 100644
--- a/fs/orangefs/orangefs-utils.c
+++ b/fs/orangefs/orangefs-utils.c
@@ -707,27 +707,6 @@ void orangefs_make_bad_inode(struct inode *inode)
707 } 707 }
708} 708}
709 709
710/* Block all blockable signals... */
711void orangefs_block_signals(sigset_t *orig_sigset)
712{
713 sigset_t mask;
714
715 /*
716 * Initialize all entries in the signal set to the
717 * inverse of the given mask.
718 */
719 siginitsetinv(&mask, sigmask(SIGKILL));
720
721 /* Block 'em Danno... */
722 sigprocmask(SIG_BLOCK, &mask, orig_sigset);
723}
724
725/* set the signal mask to the given template... */
726void orangefs_set_signals(sigset_t *sigset)
727{
728 sigprocmask(SIG_SETMASK, sigset, NULL);
729}
730
731/* 710/*
732 * The following is a very dirty hack that is now a permanent part of the 711 * The following is a very dirty hack that is now a permanent part of the
733 * ORANGEFS protocol. See protocol.h for more error definitions. 712 * ORANGEFS protocol. See protocol.h for more error definitions.
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index 6cae77400a5b..86b4b1fc0b14 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -16,7 +16,7 @@
16#include "orangefs-kernel.h" 16#include "orangefs-kernel.h"
17#include "orangefs-bufmap.h" 17#include "orangefs-bufmap.h"
18 18
19static int wait_for_matching_downcall(struct orangefs_kernel_op_s *); 19static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, bool);
20static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *); 20static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *);
21 21
22/* 22/*
@@ -56,7 +56,6 @@ int service_operation(struct orangefs_kernel_op_s *op,
56 int flags) 56 int flags)
57{ 57{
58 /* flags to modify behavior */ 58 /* flags to modify behavior */
59 sigset_t orig_sigset;
60 int ret = 0; 59 int ret = 0;
61 60
62 DEFINE_WAIT(wait_entry); 61 DEFINE_WAIT(wait_entry);
@@ -75,19 +74,16 @@ retry_servicing:
75 current->comm, 74 current->comm,
76 current->pid); 75 current->pid);
77 76
78 /* mask out signals if this operation is not to be interrupted */
79 if (!(flags & ORANGEFS_OP_INTERRUPTIBLE))
80 orangefs_block_signals(&orig_sigset);
81
82 if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) { 77 if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) {
83 ret = mutex_lock_interruptible(&request_mutex); 78 if (flags & ORANGEFS_OP_INTERRUPTIBLE)
79 ret = mutex_lock_interruptible(&request_mutex);
80 else
81 ret = mutex_lock_killable(&request_mutex);
84 /* 82 /*
85 * check to see if we were interrupted while waiting for 83 * check to see if we were interrupted while waiting for
86 * semaphore 84 * semaphore
87 */ 85 */
88 if (ret < 0) { 86 if (ret < 0) {
89 if (!(flags & ORANGEFS_OP_INTERRUPTIBLE))
90 orangefs_set_signals(&orig_sigset);
91 op->downcall.status = ret; 87 op->downcall.status = ret;
92 gossip_debug(GOSSIP_WAIT_DEBUG, 88 gossip_debug(GOSSIP_WAIT_DEBUG,
93 "orangefs: service_operation interrupted.\n"); 89 "orangefs: service_operation interrupted.\n");
@@ -128,7 +124,7 @@ retry_servicing:
128 if (flags & ORANGEFS_OP_ASYNC) 124 if (flags & ORANGEFS_OP_ASYNC)
129 return 0; 125 return 0;
130 126
131 ret = wait_for_matching_downcall(op); 127 ret = wait_for_matching_downcall(op, flags & ORANGEFS_OP_INTERRUPTIBLE);
132 128
133 if (ret < 0) { 129 if (ret < 0) {
134 /* failed to get matching downcall */ 130 /* failed to get matching downcall */
@@ -146,9 +142,6 @@ retry_servicing:
146 ret = op->downcall.status; 142 ret = op->downcall.status;
147 } 143 }
148 144
149 if (!(flags & ORANGEFS_OP_INTERRUPTIBLE))
150 orangefs_set_signals(&orig_sigset);
151
152 BUG_ON(ret != op->downcall.status); 145 BUG_ON(ret != op->downcall.status);
153 /* retry if operation has not been serviced and if requested */ 146 /* retry if operation has not been serviced and if requested */
154 if (!op_state_serviced(op) && op->downcall.status == -EAGAIN) { 147 if (!op_state_serviced(op) && op->downcall.status == -EAGAIN) {
@@ -334,12 +327,18 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s
334 * 327 *
335 * Returns with op->lock taken. 328 * Returns with op->lock taken.
336 */ 329 */
337static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op) 330static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
331 bool interruptible)
338{ 332{
339 long timeout, n; 333 long timeout, n;
340 334
341 timeout = op->attempts ? op_timeout_secs * HZ : MAX_SCHEDULE_TIMEOUT; 335 timeout = op->attempts ? op_timeout_secs * HZ : MAX_SCHEDULE_TIMEOUT;
342 n = wait_for_completion_interruptible_timeout(&op->waitq, timeout); 336
337 if (interruptible)
338 n = wait_for_completion_interruptible_timeout(&op->waitq, timeout);
339 else
340 n = wait_for_completion_killable_timeout(&op->waitq, timeout);
341
343 spin_lock(&op->lock); 342 spin_lock(&op->lock);
344 343
345 if (op_state_serviced(op)) 344 if (op_state_serviced(op))