diff options
author | Mike Marshall <hubcap@omnibond.com> | 2015-09-29 12:07:46 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2015-10-03 11:44:36 -0400 |
commit | 8c3905adea92c79e32b02120c724dfd4cf84dd85 (patch) | |
tree | 0ecfd4f18ba189eacb81760beee842d97467dd97 /fs | |
parent | 50e01586f4b10dc7aa534bbfcd1707586e7b32e0 (diff) | |
download | linux-8c3905adea92c79e32b02120c724dfd4cf84dd85.tar.bz2 |
Orangefs: update signal blocking code before Oleg sees it.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/orangefs/pvfs2-kernel.h | 4 | ||||
-rw-r--r-- | fs/orangefs/pvfs2-utils.c | 41 | ||||
-rw-r--r-- | fs/orangefs/waitqueue.c | 6 |
3 files changed, 20 insertions, 31 deletions
diff --git a/fs/orangefs/pvfs2-kernel.h b/fs/orangefs/pvfs2-kernel.h index be30111b40d2..299b48c37cab 100644 --- a/fs/orangefs/pvfs2-kernel.h +++ b/fs/orangefs/pvfs2-kernel.h @@ -649,9 +649,9 @@ void pvfs2_op_initialize(struct pvfs2_kernel_op_s *op); void pvfs2_make_bad_inode(struct inode *inode); -void mask_blocked_signals(sigset_t *orig_sigset); +void block_signals(sigset_t *); -void unmask_blocked_signals(sigset_t *orig_sigset); +void set_signals(sigset_t *); int pvfs2_unmount_sb(struct super_block *sb); diff --git a/fs/orangefs/pvfs2-utils.c b/fs/orangefs/pvfs2-utils.c index 11ee073ecd19..834e06674d0a 100644 --- a/fs/orangefs/pvfs2-utils.c +++ b/fs/orangefs/pvfs2-utils.c @@ -632,36 +632,25 @@ void pvfs2_make_bad_inode(struct inode *inode) } } -/* this code is based on linux/net/sunrpc/clnt.c:rpc_clnt_sigmask */ -void mask_blocked_signals(sigset_t *orig_sigset) +/* Block all blockable signals... */ +void block_signals(sigset_t *orig_sigset) { - unsigned long sigallow = sigmask(SIGKILL); - unsigned long irqflags = 0; - struct k_sigaction *action = pvfs2_current_sigaction; - - sigallow |= ((action[SIGINT - 1].sa.sa_handler == SIG_DFL) ? - sigmask(SIGINT) : - 0); - sigallow |= ((action[SIGQUIT - 1].sa.sa_handler == SIG_DFL) ? - sigmask(SIGQUIT) : - 0); - - spin_lock_irqsave(&pvfs2_current_signal_lock, irqflags); - *orig_sigset = current->blocked; - siginitsetinv(¤t->blocked, sigallow & ~orig_sigset->sig[0]); - recalc_sigpending(); - spin_unlock_irqrestore(&pvfs2_current_signal_lock, irqflags); + sigset_t mask; + + /* + * Initialize all entries in the signal set to the + * inverse of the given mask. + */ + siginitsetinv(&mask, sigmask(SIGKILL)); + + /* Block 'em Danno... */ + sigprocmask(SIG_BLOCK, &mask, orig_sigset); } -/* this code is based on linux/net/sunrpc/clnt.c:rpc_clnt_sigunmask */ -void unmask_blocked_signals(sigset_t *orig_sigset) +/* set the signal mask to the given template... */ +void set_signals(sigset_t *sigset) { - unsigned long irqflags = 0; - - spin_lock_irqsave(&pvfs2_current_signal_lock, irqflags); - current->blocked = *orig_sigset; - recalc_sigpending(); - spin_unlock_irqrestore(&pvfs2_current_signal_lock, irqflags); + sigprocmask(SIG_SETMASK, sigset, NULL); } __u64 pvfs2_convert_time_field(void *time_ptr) diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c index ad79e534dc8e..d7b0eba043ab 100644 --- a/fs/orangefs/waitqueue.c +++ b/fs/orangefs/waitqueue.c @@ -80,7 +80,7 @@ retry_servicing: /* mask out signals if this operation is not to be interrupted */ if (!(flags & PVFS2_OP_INTERRUPTIBLE)) - mask_blocked_signals(&orig_sigset); + block_signals(&orig_sigset); if (!(flags & PVFS2_OP_NO_SEMAPHORE)) { ret = mutex_lock_interruptible(&request_mutex); @@ -90,7 +90,7 @@ retry_servicing: */ if (ret < 0) { if (!(flags & PVFS2_OP_INTERRUPTIBLE)) - unmask_blocked_signals(&orig_sigset); + set_signals(&orig_sigset); op->downcall.status = ret; gossip_debug(GOSSIP_WAIT_DEBUG, "pvfs2: service_operation interrupted.\n"); @@ -160,7 +160,7 @@ retry_servicing: } if (!(flags & PVFS2_OP_INTERRUPTIBLE)) - unmask_blocked_signals(&orig_sigset); + set_signals(&orig_sigset); BUG_ON(ret != op->downcall.status); /* retry if operation has not been serviced and if requested */ |