提交 8c3905ad 编写于 作者: M Mike Marshall

Orangefs: update signal blocking code before Oleg sees it.

Signed-off-by: NMike Marshall <hubcap@omnibond.com>
上级 50e01586
...@@ -649,9 +649,9 @@ void pvfs2_op_initialize(struct pvfs2_kernel_op_s *op); ...@@ -649,9 +649,9 @@ void pvfs2_op_initialize(struct pvfs2_kernel_op_s *op);
void pvfs2_make_bad_inode(struct inode *inode); 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); int pvfs2_unmount_sb(struct super_block *sb);
......
...@@ -632,36 +632,25 @@ void pvfs2_make_bad_inode(struct inode *inode) ...@@ -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 */ /* Block all blockable signals... */
void mask_blocked_signals(sigset_t *orig_sigset) void block_signals(sigset_t *orig_sigset)
{ {
unsigned long sigallow = sigmask(SIGKILL); sigset_t mask;
unsigned long irqflags = 0;
struct k_sigaction *action = pvfs2_current_sigaction; /*
* Initialize all entries in the signal set to the
sigallow |= ((action[SIGINT - 1].sa.sa_handler == SIG_DFL) ? * inverse of the given mask.
sigmask(SIGINT) : */
0); siginitsetinv(&mask, sigmask(SIGKILL));
sigallow |= ((action[SIGQUIT - 1].sa.sa_handler == SIG_DFL) ?
sigmask(SIGQUIT) : /* Block 'em Danno... */
0); sigprocmask(SIG_BLOCK, &mask, orig_sigset);
spin_lock_irqsave(&pvfs2_current_signal_lock, irqflags);
*orig_sigset = current->blocked;
siginitsetinv(&current->blocked, sigallow & ~orig_sigset->sig[0]);
recalc_sigpending();
spin_unlock_irqrestore(&pvfs2_current_signal_lock, irqflags);
} }
/* this code is based on linux/net/sunrpc/clnt.c:rpc_clnt_sigunmask */ /* set the signal mask to the given template... */
void unmask_blocked_signals(sigset_t *orig_sigset) void set_signals(sigset_t *sigset)
{ {
unsigned long irqflags = 0; sigprocmask(SIG_SETMASK, sigset, NULL);
spin_lock_irqsave(&pvfs2_current_signal_lock, irqflags);
current->blocked = *orig_sigset;
recalc_sigpending();
spin_unlock_irqrestore(&pvfs2_current_signal_lock, irqflags);
} }
__u64 pvfs2_convert_time_field(void *time_ptr) __u64 pvfs2_convert_time_field(void *time_ptr)
......
...@@ -80,7 +80,7 @@ int service_operation(struct pvfs2_kernel_op_s *op, ...@@ -80,7 +80,7 @@ int service_operation(struct pvfs2_kernel_op_s *op,
/* mask out signals if this operation is not to be interrupted */ /* mask out signals if this operation is not to be interrupted */
if (!(flags & PVFS2_OP_INTERRUPTIBLE)) if (!(flags & PVFS2_OP_INTERRUPTIBLE))
mask_blocked_signals(&orig_sigset); block_signals(&orig_sigset);
if (!(flags & PVFS2_OP_NO_SEMAPHORE)) { if (!(flags & PVFS2_OP_NO_SEMAPHORE)) {
ret = mutex_lock_interruptible(&request_mutex); ret = mutex_lock_interruptible(&request_mutex);
...@@ -90,7 +90,7 @@ int service_operation(struct pvfs2_kernel_op_s *op, ...@@ -90,7 +90,7 @@ int service_operation(struct pvfs2_kernel_op_s *op,
*/ */
if (ret < 0) { if (ret < 0) {
if (!(flags & PVFS2_OP_INTERRUPTIBLE)) if (!(flags & PVFS2_OP_INTERRUPTIBLE))
unmask_blocked_signals(&orig_sigset); set_signals(&orig_sigset);
op->downcall.status = ret; op->downcall.status = ret;
gossip_debug(GOSSIP_WAIT_DEBUG, gossip_debug(GOSSIP_WAIT_DEBUG,
"pvfs2: service_operation interrupted.\n"); "pvfs2: service_operation interrupted.\n");
...@@ -160,7 +160,7 @@ int service_operation(struct pvfs2_kernel_op_s *op, ...@@ -160,7 +160,7 @@ int service_operation(struct pvfs2_kernel_op_s *op,
} }
if (!(flags & PVFS2_OP_INTERRUPTIBLE)) if (!(flags & PVFS2_OP_INTERRUPTIBLE))
unmask_blocked_signals(&orig_sigset); set_signals(&orig_sigset);
BUG_ON(ret != op->downcall.status); BUG_ON(ret != op->downcall.status);
/* retry if operation has not been serviced and if requested */ /* retry if operation has not been serviced and if requested */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册