aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2016-02-24 16:54:27 -0500
committerMike Marshall <hubcap@omnibond.com>2016-02-24 16:54:27 -0500
commitadcf34a2893386c99e80feee36e30a782b3815e7 (patch)
tree5a18b23a0901a806048281be87c761c90204e38c
parentd37c0f307adb1d15712cb8d3cec23d81389c1937 (diff)
Orangefs: code sanitation
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r--fs/orangefs/devorangefs-req.c2
-rw-r--r--fs/orangefs/orangefs-kernel.h2
-rw-r--r--fs/orangefs/super.c4
-rw-r--r--fs/orangefs/waitqueue.c35
4 files changed, 29 insertions, 14 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index f7914f5d296f..0db3a57f974d 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -590,7 +590,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
590 * remount all mounted orangefs volumes to regain the lost 590 * remount all mounted orangefs volumes to regain the lost
591 * dynamic mount tables (if any) -- NOTE: this is done 591 * dynamic mount tables (if any) -- NOTE: this is done
592 * without keeping the superblock list locked due to the 592 * without keeping the superblock list locked due to the
593 * upcall/downcall waiting. also, the request semaphore is 593 * upcall/downcall waiting. also, the request mutex is
594 * used to ensure that no operations will be serviced until 594 * used to ensure that no operations will be serviced until
595 * all of the remounts are serviced (to avoid ops between 595 * all of the remounts are serviced (to avoid ops between
596 * mounts to fail) 596 * mounts to fail)
diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h
index 4ed64e555ca0..c3b3b22115eb 100644
--- a/fs/orangefs/orangefs-kernel.h
+++ b/fs/orangefs/orangefs-kernel.h
@@ -603,7 +603,7 @@ extern wait_queue_head_t orangefs_bufmap_init_waitq;
603#define ORANGEFS_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */ 603#define ORANGEFS_OP_INTERRUPTIBLE 1 /* service_operation() is interruptible */
604#define ORANGEFS_OP_PRIORITY 2 /* service_operation() is high priority */ 604#define ORANGEFS_OP_PRIORITY 2 /* service_operation() is high priority */
605#define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */ 605#define ORANGEFS_OP_CANCELLATION 4 /* this is a cancellation */
606#define ORANGEFS_OP_NO_SEMAPHORE 8 /* don't acquire semaphore */ 606#define ORANGEFS_OP_NO_MUTEX 8 /* don't acquire request_mutex */
607#define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */ 607#define ORANGEFS_OP_ASYNC 16 /* Queue it, but don't wait */
608 608
609int service_operation(struct orangefs_kernel_op_s *op, 609int service_operation(struct orangefs_kernel_op_s *op,
diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
index 93cc352be360..65ddc74e96b6 100644
--- a/fs/orangefs/super.c
+++ b/fs/orangefs/super.c
@@ -229,12 +229,12 @@ int orangefs_remount(struct super_block *sb)
229 new_op->upcall.req.fs_mount.orangefs_config_server); 229 new_op->upcall.req.fs_mount.orangefs_config_server);
230 230
231 /* 231 /*
232 * we assume that the calling function has already acquire the 232 * we assume that the calling function has already acquired the
233 * request_mutex to prevent other operations from bypassing 233 * request_mutex to prevent other operations from bypassing
234 * this one 234 * this one
235 */ 235 */
236 ret = service_operation(new_op, "orangefs_remount", 236 ret = service_operation(new_op, "orangefs_remount",
237 ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_SEMAPHORE); 237 ORANGEFS_OP_PRIORITY | ORANGEFS_OP_NO_MUTEX);
238 gossip_debug(GOSSIP_SUPER_DEBUG, 238 gossip_debug(GOSSIP_SUPER_DEBUG,
239 "orangefs_remount: mount got return value of %d\n", 239 "orangefs_remount: mount got return value of %d\n",
240 ret); 240 ret);
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index 3f9e43066444..1eadf69cc919 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -56,7 +56,6 @@ int service_operation(struct orangefs_kernel_op_s *op,
56 int flags) 56 int flags)
57{ 57{
58 long timeout = MAX_SCHEDULE_TIMEOUT; 58 long timeout = MAX_SCHEDULE_TIMEOUT;
59 /* flags to modify behavior */
60 int ret = 0; 59 int ret = 0;
61 60
62 DEFINE_WAIT(wait_entry); 61 DEFINE_WAIT(wait_entry);
@@ -74,14 +73,20 @@ retry_servicing:
74 current->comm, 73 current->comm,
75 current->pid); 74 current->pid);
76 75
77 if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) { 76 /*
77 * If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
78 * aquiring the request_mutex because we're servicing a
79 * high priority remount operation and the request_mutex is
80 * already taken.
81 */
82 if (!(flags & ORANGEFS_OP_NO_MUTEX)) {
78 if (flags & ORANGEFS_OP_INTERRUPTIBLE) 83 if (flags & ORANGEFS_OP_INTERRUPTIBLE)
79 ret = mutex_lock_interruptible(&request_mutex); 84 ret = mutex_lock_interruptible(&request_mutex);
80 else 85 else
81 ret = mutex_lock_killable(&request_mutex); 86 ret = mutex_lock_killable(&request_mutex);
82 /* 87 /*
83 * check to see if we were interrupted while waiting for 88 * check to see if we were interrupted while waiting for
84 * semaphore 89 * mutex
85 */ 90 */
86 if (ret < 0) { 91 if (ret < 0) {
87 op->downcall.status = ret; 92 op->downcall.status = ret;
@@ -95,6 +100,7 @@ retry_servicing:
95 spin_lock(&orangefs_request_list_lock); 100 spin_lock(&orangefs_request_list_lock);
96 spin_lock(&op->lock); 101 spin_lock(&op->lock);
97 set_op_state_waiting(op); 102 set_op_state_waiting(op);
103 /* add high priority remount op to the front of the line. */
98 if (flags & ORANGEFS_OP_PRIORITY) 104 if (flags & ORANGEFS_OP_PRIORITY)
99 list_add(&op->list, &orangefs_request_list); 105 list_add(&op->list, &orangefs_request_list);
100 else 106 else
@@ -109,7 +115,7 @@ retry_servicing:
109 } 115 }
110 spin_unlock(&orangefs_request_list_lock); 116 spin_unlock(&orangefs_request_list_lock);
111 117
112 if (!(flags & ORANGEFS_OP_NO_SEMAPHORE)) 118 if (!(flags & ORANGEFS_OP_NO_MUTEX))
113 mutex_unlock(&request_mutex); 119 mutex_unlock(&request_mutex);
114 120
115 ret = wait_for_matching_downcall(op, timeout, 121 ret = wait_for_matching_downcall(op, timeout,
@@ -132,10 +138,17 @@ retry_servicing:
132 138
133 /* failed to get matching downcall */ 139 /* failed to get matching downcall */
134 if (ret == -ETIMEDOUT) { 140 if (ret == -ETIMEDOUT) {
135 gossip_err("orangefs: %s -- wait timed out; aborting attempt.\n", 141 gossip_err("%s: %s -- wait timed out; aborting attempt.\n",
142 __func__,
136 op_name); 143 op_name);
137 } 144 }
145
146 /*
147 * remove waiting ops from the request list or
148 * remove in-progress ops from the in-progress list.
149 */
138 orangefs_clean_up_interrupted_operation(op); 150 orangefs_clean_up_interrupted_operation(op);
151
139 op->downcall.status = ret; 152 op->downcall.status = ret;
140 /* retry if operation has not been serviced and if requested */ 153 /* retry if operation has not been serviced and if requested */
141 if (ret == -EAGAIN) { 154 if (ret == -EAGAIN) {
@@ -148,11 +161,12 @@ retry_servicing:
148 op_name, 161 op_name,
149 op->attempts); 162 op->attempts);
150 163
164 /*
165 * io ops (ops that use the shared memory buffer) have
166 * to be returned to their caller for a retry. Other ops
167 * can just be recycled here.
168 */
151 if (!op->uses_shared_memory) 169 if (!op->uses_shared_memory)
152 /*
153 * this operation doesn't use the shared memory
154 * system
155 */
156 goto retry_servicing; 170 goto retry_servicing;
157 } 171 }
158 172
@@ -268,7 +282,8 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
268 long n; 282 long n;
269 283
270 if (interruptible) 284 if (interruptible)
271 n = wait_for_completion_interruptible_timeout(&op->waitq, timeout); 285 n = wait_for_completion_interruptible_timeout(&op->waitq,
286 timeout);
272 else 287 else
273 n = wait_for_completion_killable_timeout(&op->waitq, timeout); 288 n = wait_for_completion_killable_timeout(&op->waitq, timeout);
274 289