提交 c72f15b7 编写于 作者: A Al Viro 提交者: Mike Marshall

service_operation(): don't block signals, just use ..._killable

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NMike Marshall <hubcap@omnibond.com>
上级 98815ade
...@@ -580,10 +580,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr); ...@@ -580,10 +580,6 @@ int orangefs_inode_setattr(struct inode *inode, struct iattr *iattr);
void orangefs_make_bad_inode(struct inode *inode); void orangefs_make_bad_inode(struct inode *inode);
void orangefs_block_signals(sigset_t *);
void orangefs_set_signals(sigset_t *);
int orangefs_unmount_sb(struct super_block *sb); int orangefs_unmount_sb(struct super_block *sb);
bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op); bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
......
...@@ -707,27 +707,6 @@ void orangefs_make_bad_inode(struct inode *inode) ...@@ -707,27 +707,6 @@ void orangefs_make_bad_inode(struct inode *inode)
} }
} }
/* Block all blockable signals... */
void orangefs_block_signals(sigset_t *orig_sigset)
{
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);
}
/* set the signal mask to the given template... */
void orangefs_set_signals(sigset_t *sigset)
{
sigprocmask(SIG_SETMASK, sigset, NULL);
}
/* /*
* The following is a very dirty hack that is now a permanent part of the * The following is a very dirty hack that is now a permanent part of the
* ORANGEFS protocol. See protocol.h for more error definitions. * ORANGEFS protocol. See protocol.h for more error definitions.
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "orangefs-kernel.h" #include "orangefs-kernel.h"
#include "orangefs-bufmap.h" #include "orangefs-bufmap.h"
static int wait_for_matching_downcall(struct orangefs_kernel_op_s *); static int wait_for_matching_downcall(struct orangefs_kernel_op_s *, bool);
static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *); static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *);
/* /*
...@@ -56,7 +56,6 @@ int service_operation(struct orangefs_kernel_op_s *op, ...@@ -56,7 +56,6 @@ int service_operation(struct orangefs_kernel_op_s *op,
int flags) int flags)
{ {
/* flags to modify behavior */ /* flags to modify behavior */
sigset_t orig_sigset;
int ret = 0; int ret = 0;
DEFINE_WAIT(wait_entry); DEFINE_WAIT(wait_entry);
...@@ -75,19 +74,16 @@ int service_operation(struct orangefs_kernel_op_s *op, ...@@ -75,19 +74,16 @@ int service_operation(struct orangefs_kernel_op_s *op,
current->comm, current->comm,
current->pid); current->pid);
/* mask out signals if this operation is not to be interrupted */
if (!(flags & ORANGEFS_OP_INTERRUPTIBLE))
orangefs_block_signals(&orig_sigset);
if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) { if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) {
ret = mutex_lock_interruptible(&request_mutex); if (flags & ORANGEFS_OP_INTERRUPTIBLE)
ret = mutex_lock_interruptible(&request_mutex);
else
ret = mutex_lock_killable(&request_mutex);
/* /*
* check to see if we were interrupted while waiting for * check to see if we were interrupted while waiting for
* semaphore * semaphore
*/ */
if (ret < 0) { if (ret < 0) {
if (!(flags & ORANGEFS_OP_INTERRUPTIBLE))
orangefs_set_signals(&orig_sigset);
op->downcall.status = ret; op->downcall.status = ret;
gossip_debug(GOSSIP_WAIT_DEBUG, gossip_debug(GOSSIP_WAIT_DEBUG,
"orangefs: service_operation interrupted.\n"); "orangefs: service_operation interrupted.\n");
...@@ -128,7 +124,7 @@ int service_operation(struct orangefs_kernel_op_s *op, ...@@ -128,7 +124,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
if (flags & ORANGEFS_OP_ASYNC) if (flags & ORANGEFS_OP_ASYNC)
return 0; return 0;
ret = wait_for_matching_downcall(op); ret = wait_for_matching_downcall(op, flags & ORANGEFS_OP_INTERRUPTIBLE);
if (ret < 0) { if (ret < 0) {
/* failed to get matching downcall */ /* failed to get matching downcall */
...@@ -146,9 +142,6 @@ int service_operation(struct orangefs_kernel_op_s *op, ...@@ -146,9 +142,6 @@ int service_operation(struct orangefs_kernel_op_s *op,
ret = op->downcall.status; ret = op->downcall.status;
} }
if (!(flags & ORANGEFS_OP_INTERRUPTIBLE))
orangefs_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 */
if (!op_state_serviced(op) && op->downcall.status == -EAGAIN) { 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,12 +327,18 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s
* *
* Returns with op->lock taken. * Returns with op->lock taken.
*/ */
static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op) static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
bool interruptible)
{ {
long timeout, n; long timeout, n;
timeout = op->attempts ? op_timeout_secs * HZ : MAX_SCHEDULE_TIMEOUT; timeout = op->attempts ? op_timeout_secs * HZ : MAX_SCHEDULE_TIMEOUT;
n = wait_for_completion_interruptible_timeout(&op->waitq, timeout);
if (interruptible)
n = wait_for_completion_interruptible_timeout(&op->waitq, timeout);
else
n = wait_for_completion_killable_timeout(&op->waitq, timeout);
spin_lock(&op->lock); spin_lock(&op->lock);
if (op_state_serviced(op)) if (op_state_serviced(op))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册