Commit eab9b389 authored by Al Viro's avatar Al Viro Committed by Mike Marshall

orangefs_clean_up_interrupted_operation: call with op->lock held

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
parent 70c6ea26
...@@ -279,35 +279,8 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s ...@@ -279,35 +279,8 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s
* the interruption is detected. there is a coarse grained lock * the interruption is detected. there is a coarse grained lock
* across the operation. * across the operation.
* *
* NOTE: be sure not to reverse lock ordering by locking an op lock * Called with op->lock held.
* while holding the request_list lock. Here, we first lock the op
* and then lock the appropriate list.
*/ */
if (!op) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: op is null, ignoring\n",
__func__);
return;
}
/*
* one more sanity check, make sure it's in one of the possible states
* or don't try to cancel it
*/
if (!(op_state_waiting(op) ||
op_state_in_progress(op) ||
op_state_serviced(op) ||
op_state_purged(op))) {
gossip_debug(GOSSIP_WAIT_DEBUG,
"%s: op %p not in a valid state (%0x), "
"ignoring\n",
__func__,
op,
op->op_state);
return;
}
spin_lock(&op->lock);
op->op_state |= OP_VFS_STATE_GIVEN_UP; op->op_state |= OP_VFS_STATE_GIVEN_UP;
if (op_state_waiting(op)) { if (op_state_waiting(op)) {
...@@ -374,7 +347,6 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op) ...@@ -374,7 +347,6 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
ret = 0; ret = 0;
break; break;
} }
spin_unlock(&op->lock);
if (unlikely(signal_pending(current))) { if (unlikely(signal_pending(current))) {
gossip_debug(GOSSIP_WAIT_DEBUG, gossip_debug(GOSSIP_WAIT_DEBUG,
...@@ -394,7 +366,6 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op) ...@@ -394,7 +366,6 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
* has not purged our operation, we are happy to * has not purged our operation, we are happy to
* simply wait * simply wait
*/ */
spin_lock(&op->lock);
if (op->attempts == 0 && !op_state_purged(op)) { if (op->attempts == 0 && !op_state_purged(op)) {
spin_unlock(&op->lock); spin_unlock(&op->lock);
schedule(); schedule();
...@@ -415,6 +386,7 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op) ...@@ -415,6 +386,7 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
op, op,
op->attempts); op->attempts);
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
spin_lock(&op->lock);
orangefs_clean_up_interrupted_operation(op); orangefs_clean_up_interrupted_operation(op);
break; break;
} }
...@@ -434,7 +406,6 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op) ...@@ -434,7 +406,6 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op)
ret = (op->attempts < ORANGEFS_PURGE_RETRY_COUNT) ? ret = (op->attempts < ORANGEFS_PURGE_RETRY_COUNT) ?
-EAGAIN : -EAGAIN :
-EIO; -EIO;
spin_unlock(&op->lock);
gossip_debug(GOSSIP_WAIT_DEBUG, gossip_debug(GOSSIP_WAIT_DEBUG,
"*** %s:" "*** %s:"
" operation purged (tag " " operation purged (tag "
...@@ -481,7 +452,6 @@ static int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op) ...@@ -481,7 +452,6 @@ static int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op)
ret = 0; ret = 0;
break; break;
} }
spin_unlock(&op->lock);
if (signal_pending(current)) { if (signal_pending(current)) {
gossip_debug(GOSSIP_WAIT_DEBUG, gossip_debug(GOSSIP_WAIT_DEBUG,
...@@ -498,6 +468,7 @@ static int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op) ...@@ -498,6 +468,7 @@ static int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op)
gossip_debug(GOSSIP_WAIT_DEBUG, gossip_debug(GOSSIP_WAIT_DEBUG,
"%s:About to call schedule_timeout.\n", "%s:About to call schedule_timeout.\n",
__func__); __func__);
spin_unlock(&op->lock);
ret = ret =
schedule_timeout(MSECS_TO_JIFFIES(1000 * op_timeout_secs)); schedule_timeout(MSECS_TO_JIFFIES(1000 * op_timeout_secs));
...@@ -510,6 +481,7 @@ static int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op) ...@@ -510,6 +481,7 @@ static int wait_for_cancellation_downcall(struct orangefs_kernel_op_s *op)
"%s:*** operation timed out: %p\n", "%s:*** operation timed out: %p\n",
__func__, __func__,
op); op);
spin_lock(&op->lock);
orangefs_clean_up_interrupted_operation(op); orangefs_clean_up_interrupted_operation(op);
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment