aboutsummaryrefslogtreecommitdiffstats
path: root/fs/orangefs
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2016-02-26 10:21:12 -0500
committerMike Marshall <hubcap@omnibond.com>2016-02-26 10:21:12 -0500
commitca9f518eadeb7edd8e438a6542d3caec9bc3bb74 (patch)
tree398f2460c1516015c78516e2888ea28af54c07a0 /fs/orangefs
parent401898eed7e05b8a898a44b49d5e9a510aebee83 (diff)
Orangefs: code sanitation.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs')
-rw-r--r--fs/orangefs/devorangefs-req.c20
-rw-r--r--fs/orangefs/orangefs-mod.c11
-rw-r--r--fs/orangefs/waitqueue.c44
3 files changed, 46 insertions, 29 deletions
diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c
index 0db3a57f974d..e3934c06b96a 100644
--- a/fs/orangefs/devorangefs-req.c
+++ b/fs/orangefs/devorangefs-req.c
@@ -46,6 +46,10 @@ static void orangefs_devreq_add_op(struct orangefs_kernel_op_s *op)
46 list_add_tail(&op->list, &htable_ops_in_progress[index]); 46 list_add_tail(&op->list, &htable_ops_in_progress[index]);
47} 47}
48 48
49/*
50 * find the op with this tag and remove it from the in progress
51 * hash table.
52 */
49static struct orangefs_kernel_op_s *orangefs_devreq_remove_op(__u64 tag) 53static struct orangefs_kernel_op_s *orangefs_devreq_remove_op(__u64 tag)
50{ 54{
51 struct orangefs_kernel_op_s *op, *next; 55 struct orangefs_kernel_op_s *op, *next;
@@ -190,8 +194,10 @@ restart:
190 return -EAGAIN; 194 return -EAGAIN;
191 } 195 }
192 196
193 gossip_debug(GOSSIP_DEV_DEBUG, "orangefs: reading op tag %llu %s\n", 197 gossip_debug(GOSSIP_DEV_DEBUG, "%s: reading op tag %llu %s\n",
194 llu(cur_op->tag), get_opname_string(cur_op)); 198 __func__,
199 llu(cur_op->tag),
200 get_opname_string(cur_op));
195 201
196 /* 202 /*
197 * Such an op should never be on the list in the first place. If so, we 203 * Such an op should never be on the list in the first place. If so, we
@@ -204,6 +210,7 @@ restart:
204 spin_unlock(&orangefs_request_list_lock); 210 spin_unlock(&orangefs_request_list_lock);
205 return -EAGAIN; 211 return -EAGAIN;
206 } 212 }
213
207 list_del_init(&cur_op->list); 214 list_del_init(&cur_op->list);
208 spin_unlock(&orangefs_request_list_lock); 215 spin_unlock(&orangefs_request_list_lock);
209 216
@@ -323,6 +330,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
323 return -EPROTO; 330 return -EPROTO;
324 } 331 }
325 332
333 /* remove the op from the in progress hash table */
326 op = orangefs_devreq_remove_op(head.tag); 334 op = orangefs_devreq_remove_op(head.tag);
327 if (!op) { 335 if (!op) {
328 gossip_err("WARNING: No one's waiting for tag %llu\n", 336 gossip_err("WARNING: No one's waiting for tag %llu\n",
@@ -486,15 +494,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file)
486 gossip_debug(GOSSIP_DEV_DEBUG, "ORANGEFS Device Close: Filesystem(s) %s\n", 494 gossip_debug(GOSSIP_DEV_DEBUG, "ORANGEFS Device Close: Filesystem(s) %s\n",
487 (unmounted ? "UNMOUNTED" : "MOUNTED")); 495 (unmounted ? "UNMOUNTED" : "MOUNTED"));
488 496
489 /*
490 * Walk through the list of ops in the request list, mark them
491 * as purged and wake them up.
492 */
493 purge_waiting_ops(); 497 purge_waiting_ops();
494 /*
495 * Walk through the hash table of in progress operations; mark
496 * them as purged and wake them up
497 */
498 purge_inprogress_ops(); 498 purge_inprogress_ops();
499 499
500 orangefs_bufmap_run_down(); 500 orangefs_bufmap_run_down();
diff --git a/fs/orangefs/orangefs-mod.c b/fs/orangefs/orangefs-mod.c
index 965959cb11d1..a4e08dd3e669 100644
--- a/fs/orangefs/orangefs-mod.c
+++ b/fs/orangefs/orangefs-mod.c
@@ -119,10 +119,10 @@ static int __init orangefs_init(void)
119 if (gossip_debug_mask != 0) 119 if (gossip_debug_mask != 0)
120 kernel_mask_set_mod_init = true; 120 kernel_mask_set_mod_init = true;
121 121
122 /* print information message to the system log */ 122 pr_info("%s: called with debug mask: :%s: :%llx:\n",
123 pr_info("orangefs: orangefs_init called with debug mask: :%s: :%llx:\n", 123 __func__,
124 kernel_debug_string, 124 kernel_debug_string,
125 (unsigned long long)gossip_debug_mask); 125 (unsigned long long)gossip_debug_mask);
126 126
127 ret = bdi_init(&orangefs_backing_dev_info); 127 ret = bdi_init(&orangefs_backing_dev_info);
128 128
@@ -147,7 +147,8 @@ static int __init orangefs_init(void)
147 /* Initialize the orangefsdev subsystem. */ 147 /* Initialize the orangefsdev subsystem. */
148 ret = orangefs_dev_init(); 148 ret = orangefs_dev_init();
149 if (ret < 0) { 149 if (ret < 0) {
150 gossip_err("orangefs: could not initialize device subsystem %d!\n", 150 gossip_err("%s: could not initialize device subsystem %d!\n",
151 __func__,
151 ret); 152 ret);
152 goto cleanup_inode; 153 goto cleanup_inode;
153 } 154 }
diff --git a/fs/orangefs/waitqueue.c b/fs/orangefs/waitqueue.c
index 1eadf69cc919..edfd921cf6ec 100644
--- a/fs/orangefs/waitqueue.c
+++ b/fs/orangefs/waitqueue.c
@@ -75,7 +75,7 @@ retry_servicing:
75 75
76 /* 76 /*
77 * If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid 77 * If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
78 * aquiring the request_mutex because we're servicing a 78 * acquiring the request_mutex because we're servicing a
79 * high priority remount operation and the request_mutex is 79 * high priority remount operation and the request_mutex is
80 * already taken. 80 * already taken.
81 */ 81 */
@@ -91,7 +91,8 @@ retry_servicing:
91 if (ret < 0) { 91 if (ret < 0) {
92 op->downcall.status = ret; 92 op->downcall.status = ret;
93 gossip_debug(GOSSIP_WAIT_DEBUG, 93 gossip_debug(GOSSIP_WAIT_DEBUG,
94 "orangefs: service_operation interrupted.\n"); 94 "%s: service_operation interrupted.\n",
95 __func__);
95 return ret; 96 return ret;
96 } 97 }
97 } 98 }
@@ -127,9 +128,9 @@ retry_servicing:
127 ret, 128 ret,
128 op); 129 op);
129 130
131 /* got matching downcall; make sure status is in errno format */
130 if (!ret) { 132 if (!ret) {
131 spin_unlock(&op->lock); 133 spin_unlock(&op->lock);
132 /* got matching downcall; make sure status is in errno format */
133 op->downcall.status = 134 op->downcall.status =
134 orangefs_normalize_to_errno(op->downcall.status); 135 orangefs_normalize_to_errno(op->downcall.status);
135 ret = op->downcall.status; 136 ret = op->downcall.status;
@@ -144,8 +145,8 @@ retry_servicing:
144 } 145 }
145 146
146 /* 147 /*
147 * remove waiting ops from the request list or 148 * remove a waiting op from the request list or
148 * remove in-progress ops from the in-progress list. 149 * remove an in-progress op from the in-progress list.
149 */ 150 */
150 orangefs_clean_up_interrupted_operation(op); 151 orangefs_clean_up_interrupted_operation(op);
151 152
@@ -179,6 +180,7 @@ out:
179 return ret; 180 return ret;
180} 181}
181 182
183/* This can get called on an I/O op if it had a bad service_operation. */
182bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op) 184bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
183{ 185{
184 u64 tag = op->tag; 186 u64 tag = op->tag;
@@ -206,23 +208,31 @@ bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
206 spin_unlock(&op->lock); 208 spin_unlock(&op->lock);
207 spin_unlock(&orangefs_request_list_lock); 209 spin_unlock(&orangefs_request_list_lock);
208 210
209 gossip_debug(GOSSIP_UTILS_DEBUG, 211 gossip_debug(GOSSIP_WAIT_DEBUG,
210 "Attempting ORANGEFS operation cancellation of tag %llu\n", 212 "Attempting ORANGEFS operation cancellation of tag %llu\n",
211 llu(tag)); 213 llu(tag));
212 return true; 214 return true;
213} 215}
214 216
215static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op) 217/*
218 * Change an op to the "given up" state and remove it from its list.
219 */
220static void
221 orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
216{ 222{
217 /* 223 /*
218 * handle interrupted cases depending on what state we were in when 224 * handle interrupted cases depending on what state we were in when
219 * the interruption is detected. there is a coarse grained lock 225 * the interruption is detected.
220 * across the operation.
221 * 226 *
222 * Called with op->lock held. 227 * Called with op->lock held.
223 */ 228 */
229
230 /*
231 * List manipulation code elsewhere will ignore ops that
232 * have been given up upon.
233 */
224 op->op_state |= OP_VFS_STATE_GIVEN_UP; 234 op->op_state |= OP_VFS_STATE_GIVEN_UP;
225 /* from that point on it can't be moved by anybody else */ 235
226 if (list_empty(&op->list)) { 236 if (list_empty(&op->list)) {
227 /* caught copying to/from daemon */ 237 /* caught copying to/from daemon */
228 BUG_ON(op_state_serviced(op)); 238 BUG_ON(op_state_serviced(op));
@@ -259,12 +269,12 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s
259} 269}
260 270
261/* 271/*
262 * sleeps on waitqueue waiting for matching downcall. 272 * Sleeps on waitqueue waiting for matching downcall.
263 * if client-core finishes servicing, then we are good to go. 273 * If client-core finishes servicing, then we are good to go.
264 * else if client-core exits, we get woken up here, and retry with a timeout 274 * else if client-core exits, we get woken up here, and retry with a timeout
265 * 275 *
266 * Post when this call returns to the caller, the specified op will no 276 * When this call returns to the caller, the specified op will no
267 * longer be on any list or htable. 277 * longer be in either the in_progress hash table or on the request list.
268 * 278 *
269 * Returns 0 on success and -errno on failure 279 * Returns 0 on success and -errno on failure
270 * Errors are: 280 * Errors are:
@@ -281,6 +291,12 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
281{ 291{
282 long n; 292 long n;
283 293
294 /*
295 * There's a "schedule_timeout" inside of these wait
296 * primitives, during which the op is out of the hands of the
297 * user process that needs something done and is being
298 * manipulated by the client-core process.
299 */
284 if (interruptible) 300 if (interruptible)
285 n = wait_for_completion_interruptible_timeout(&op->waitq, 301 n = wait_for_completion_interruptible_timeout(&op->waitq,
286 timeout); 302 timeout);