list_add_tail(&op->list, &htable_ops_in_progress[index]);
}
+/*
+ * find the op with this tag and remove it from the in progress
+ * hash table.
+ */
static struct orangefs_kernel_op_s *orangefs_devreq_remove_op(__u64 tag)
{
struct orangefs_kernel_op_s *op, *next;
return -EAGAIN;
}
- gossip_debug(GOSSIP_DEV_DEBUG, "orangefs: reading op tag %llu %s\n",
- llu(cur_op->tag), get_opname_string(cur_op));
+ gossip_debug(GOSSIP_DEV_DEBUG, "%s: reading op tag %llu %s\n",
+ __func__,
+ llu(cur_op->tag),
+ get_opname_string(cur_op));
/*
* Such an op should never be on the list in the first place. If so, we
spin_unlock(&orangefs_request_list_lock);
return -EAGAIN;
}
+
list_del_init(&cur_op->list);
spin_unlock(&orangefs_request_list_lock);
return -EPROTO;
}
+ /* remove the op from the in progress hash table */
op = orangefs_devreq_remove_op(head.tag);
if (!op) {
gossip_err("WARNING: No one's waiting for tag %llu\n",
gossip_debug(GOSSIP_DEV_DEBUG, "ORANGEFS Device Close: Filesystem(s) %s\n",
(unmounted ? "UNMOUNTED" : "MOUNTED"));
- /*
- * Walk through the list of ops in the request list, mark them
- * as purged and wake them up.
- */
purge_waiting_ops();
- /*
- * Walk through the hash table of in progress operations; mark
- * them as purged and wake them up
- */
purge_inprogress_ops();
orangefs_bufmap_run_down();
if (gossip_debug_mask != 0)
kernel_mask_set_mod_init = true;
- /* print information message to the system log */
- pr_info("orangefs: orangefs_init called with debug mask: :%s: :%llx:\n",
- kernel_debug_string,
- (unsigned long long)gossip_debug_mask);
+ pr_info("%s: called with debug mask: :%s: :%llx:\n",
+ __func__,
+ kernel_debug_string,
+ (unsigned long long)gossip_debug_mask);
ret = bdi_init(&orangefs_backing_dev_info);
/* Initialize the orangefsdev subsystem. */
ret = orangefs_dev_init();
if (ret < 0) {
- gossip_err("orangefs: could not initialize device subsystem %d!\n",
+ gossip_err("%s: could not initialize device subsystem %d!\n",
+ __func__,
ret);
goto cleanup_inode;
}
/*
* If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
- * aquiring the request_mutex because we're servicing a
+ * acquiring the request_mutex because we're servicing a
* high priority remount operation and the request_mutex is
* already taken.
*/
if (ret < 0) {
op->downcall.status = ret;
gossip_debug(GOSSIP_WAIT_DEBUG,
- "orangefs: service_operation interrupted.\n");
+ "%s: service_operation interrupted.\n",
+ __func__);
return ret;
}
}
ret,
op);
+ /* got matching downcall; make sure status is in errno format */
if (!ret) {
spin_unlock(&op->lock);
- /* got matching downcall; make sure status is in errno format */
op->downcall.status =
orangefs_normalize_to_errno(op->downcall.status);
ret = op->downcall.status;
}
/*
- * remove waiting ops from the request list or
- * remove in-progress ops from the in-progress list.
+ * remove a waiting op from the request list or
+ * remove an in-progress op from the in-progress list.
*/
orangefs_clean_up_interrupted_operation(op);
return ret;
}
+/* This can get called on an I/O op if it had a bad service_operation. */
bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
{
u64 tag = op->tag;
spin_unlock(&op->lock);
spin_unlock(&orangefs_request_list_lock);
- gossip_debug(GOSSIP_UTILS_DEBUG,
+ gossip_debug(GOSSIP_WAIT_DEBUG,
"Attempting ORANGEFS operation cancellation of tag %llu\n",
llu(tag));
return true;
}
-static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
+/*
+ * Change an op to the "given up" state and remove it from its list.
+ */
+static void
+ orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s *op)
{
/*
* handle interrupted cases depending on what state we were in when
- * the interruption is detected. there is a coarse grained lock
- * across the operation.
+ * the interruption is detected.
*
* Called with op->lock held.
*/
+
+ /*
+ * List manipulation code elsewhere will ignore ops that
+ * have been given up upon.
+ */
op->op_state |= OP_VFS_STATE_GIVEN_UP;
- /* from that point on it can't be moved by anybody else */
+
if (list_empty(&op->list)) {
/* caught copying to/from daemon */
BUG_ON(op_state_serviced(op));
}
/*
- * sleeps on waitqueue waiting for matching downcall.
- * if client-core finishes servicing, then we are good to go.
+ * Sleeps on waitqueue waiting for matching downcall.
+ * If client-core finishes servicing, then we are good to go.
* else if client-core exits, we get woken up here, and retry with a timeout
*
- * Post when this call returns to the caller, the specified op will no
- * longer be on any list or htable.
+ * When this call returns to the caller, the specified op will no
+ * longer be in either the in_progress hash table or on the request list.
*
* Returns 0 on success and -errno on failure
* Errors are:
{
long n;
+ /*
+ * There's a "schedule_timeout" inside of these wait
+ * primitives, during which the op is out of the hands of the
+ * user process that needs something done and is being
+ * manipulated by the client-core process.
+ */
if (interruptible)
n = wait_for_completion_interruptible_timeout(&op->waitq,
timeout);