Orangefs: code sanitation
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
parent
d37c0f307a
commit
adcf34a289
@ -590,7 +590,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
|
|||||||
* remount all mounted orangefs volumes to regain the lost
|
* remount all mounted orangefs volumes to regain the lost
|
||||||
* dynamic mount tables (if any) -- NOTE: this is done
|
* dynamic mount tables (if any) -- NOTE: this is done
|
||||||
* without keeping the superblock list locked due to the
|
* without keeping the superblock list locked due to the
|
||||||
* upcall/downcall waiting. also, the request semaphore is
|
* upcall/downcall waiting. also, the request mutex is
|
||||||
* used to ensure that no operations will be serviced until
|
* used to ensure that no operations will be serviced until
|
||||||
* all of the remounts are serviced (to avoid ops between
|
* all of the remounts are serviced (to avoid ops between
|
||||||
* mounts to fail)
|
* mounts to fail)
|
||||||
|
@ -603,7 +603,7 @@ extern wait_queue_head_t orangefs_bufmap_init_waitq;
|
|||||||
#define ORANGEFS_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */
|
#define ORANGEFS_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */
|
||||||
#define ORANGEFS_OP_PRIORITY 2 /* service_operation() is high priority */
|
#define ORANGEFS_OP_PRIORITY 2 /* service_operation() is high priority */
|
||||||
#define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */
|
#define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */
|
||||||
#define ORANGEFS_OP_NO_SEMAPHORE 8 /* don't acquire semaphore */
|
#define ORANGEFS_OP_NO_MUTEX 8 /* don't acquire request_mutex */
|
||||||
#define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */
|
#define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */
|
||||||
|
|
||||||
int service_operation(struct orangefs_kernel_op_s *op,
|
int service_operation(struct orangefs_kernel_op_s *op,
|
||||||
|
@ -229,12 +229,12 @@ int orangefs_remount(struct super_block *sb)
|
|||||||
new_op->upcall.req.fs_mount.orangefs_config_server);
|
new_op->upcall.req.fs_mount.orangefs_config_server);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we assume that the calling function has already acquire the
|
* we assume that the calling function has already acquired the
|
||||||
* request_mutex to prevent other operations from bypassing
|
* request_mutex to prevent other operations from bypassing
|
||||||
* this one
|
* this one
|
||||||
*/
|
*/
|
||||||
ret = service_operation(new_op, "orangefs_remount",
|
ret = service_operation(new_op, "orangefs_remount",
|
||||||
ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_SEMAPHORE);
|
ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);
|
||||||
gossip_debug(GOSSIP_SUPER_DEBUG,
|
gossip_debug(GOSSIP_SUPER_DEBUG,
|
||||||
"orangefs_remount: mount got return value of %d\n",
|
"orangefs_remount: mount got return value of %d\n",
|
||||||
ret);
|
ret);
|
||||||
|
@ -56,7 +56,6 @@ int service_operation(struct orangefs_kernel_op_s *op,
|
|||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
long timeout = MAX_SCHEDULE_TIMEOUT;
|
long timeout = MAX_SCHEDULE_TIMEOUT;
|
||||||
/* flags to modify behavior */
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DEFINE_WAIT(wait_entry);
|
DEFINE_WAIT(wait_entry);
|
||||||
@ -74,14 +73,20 @@ retry_servicing:
|
|||||||
current->comm,
|
current->comm,
|
||||||
current->pid);
|
current->pid);
|
||||||
|
|
||||||
if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) {
|
/*
|
||||||
|
* If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
|
||||||
|
* aquiring the request_mutex because we're servicing a
|
||||||
|
* high priority remount operation and the request_mutex is
|
||||||
|
* already taken.
|
||||||
|
*/
|
||||||
|
if (!(flags & ORANGEFS_OP_NO_MUTEX)) {
|
||||||
if (flags & ORANGEFS_OP_INTERRUPTIBLE)
|
if (flags & ORANGEFS_OP_INTERRUPTIBLE)
|
||||||
ret = mutex_lock_interruptible(&request_mutex);
|
ret = mutex_lock_interruptible(&request_mutex);
|
||||||
else
|
else
|
||||||
ret = mutex_lock_killable(&request_mutex);
|
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
|
* mutex
|
||||||
*/
|
*/
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
op->downcall.status = ret;
|
op->downcall.status = ret;
|
||||||
@ -95,6 +100,7 @@ retry_servicing:
|
|||||||
spin_lock(&orangefs_request_list_lock);
|
spin_lock(&orangefs_request_list_lock);
|
||||||
spin_lock(&op->lock);
|
spin_lock(&op->lock);
|
||||||
set_op_state_waiting(op);
|
set_op_state_waiting(op);
|
||||||
|
/* add high priority remount op to the front of the line. */
|
||||||
if (flags & ORANGEFS_OP_PRIORITY)
|
if (flags & ORANGEFS_OP_PRIORITY)
|
||||||
list_add(&op->list, &orangefs_request_list);
|
list_add(&op->list, &orangefs_request_list);
|
||||||
else
|
else
|
||||||
@ -109,7 +115,7 @@ retry_servicing:
|
|||||||
}
|
}
|
||||||
spin_unlock(&orangefs_request_list_lock);
|
spin_unlock(&orangefs_request_list_lock);
|
||||||
|
|
||||||
if (!(flags & ORANGEFS_OP_NO_SEMAPHORE))
|
if (!(flags & ORANGEFS_OP_NO_MUTEX))
|
||||||
mutex_unlock(&request_mutex);
|
mutex_unlock(&request_mutex);
|
||||||
|
|
||||||
ret = wait_for_matching_downcall(op, timeout,
|
ret = wait_for_matching_downcall(op, timeout,
|
||||||
@ -132,10 +138,17 @@ retry_servicing:
|
|||||||
|
|
||||||
/* failed to get matching downcall */
|
/* failed to get matching downcall */
|
||||||
if (ret == -ETIMEDOUT) {
|
if (ret == -ETIMEDOUT) {
|
||||||
gossip_err("orangefs: %s -- wait timed out; aborting attempt.\n",
|
gossip_err("%s: %s -- wait timed out; aborting attempt.\n",
|
||||||
|
__func__,
|
||||||
op_name);
|
op_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* remove waiting ops from the request list or
|
||||||
|
* remove in-progress ops from the in-progress list.
|
||||||
|
*/
|
||||||
orangefs_clean_up_interrupted_operation(op);
|
orangefs_clean_up_interrupted_operation(op);
|
||||||
|
|
||||||
op->downcall.status = ret;
|
op->downcall.status = ret;
|
||||||
/* retry if operation has not been serviced and if requested */
|
/* retry if operation has not been serviced and if requested */
|
||||||
if (ret == -EAGAIN) {
|
if (ret == -EAGAIN) {
|
||||||
@ -148,11 +161,12 @@ retry_servicing:
|
|||||||
op_name,
|
op_name,
|
||||||
op->attempts);
|
op->attempts);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* io ops (ops that use the shared memory buffer) have
|
||||||
|
* to be returned to their caller for a retry. Other ops
|
||||||
|
* can just be recycled here.
|
||||||
|
*/
|
||||||
if (!op->uses_shared_memory)
|
if (!op->uses_shared_memory)
|
||||||
/*
|
|
||||||
* this operation doesn't use the shared memory
|
|
||||||
* system
|
|
||||||
*/
|
|
||||||
goto retry_servicing;
|
goto retry_servicing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +282,8 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
|
|||||||
long n;
|
long n;
|
||||||
|
|
||||||
if (interruptible)
|
if (interruptible)
|
||||||
n = wait_for_completion_interruptible_timeout(&op->waitq, timeout);
|
n = wait_for_completion_interruptible_timeout(&op->waitq,
|
||||||
|
timeout);
|
||||||
else
|
else
|
||||||
n = wait_for_completion_killable_timeout(&op->waitq, timeout);
|
n = wait_for_completion_killable_timeout(&op->waitq, timeout);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user