orangefs: bufmap rewrite

new waiting-for-slot logics:
	* make request for slot wait for bufmap to be set up if it
comes before it's installed *OR* while it's running down
	* make closing control device wait for all slots to be freed
	* waiting itself rewritten to (open-coded) analogues of wait_event_...
primitives - we would need wait_event_locked() and, pardon an obscenely
long name, wait_event_interruptible_exclusive_timeout_locked().
	* we never wait for more than slot_timeout_secs in total and,
if during the wait the daemon goes away, we only allow
ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS for it to come back.
	* (cosmetical) bitmap is used instead of an array of zeroes and ones
	* old (and only reached if we are about to corrupt memory) waiting
for daemon restart in service_operation() removed.

[Martin's fixes folded]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
Al Viro
2016-02-13 21:01:21 -05:00
committed by Mike Marshall
parent 178041848a
commit ea2c9c9f65
4 changed files with 174 additions and 247 deletions

View File

@@ -155,67 +155,6 @@ retry_servicing:
* system
*/
goto retry_servicing;
/* op uses shared memory */
if (orangefs_get_bufmap_init() == 0) {
WARN_ON(1);
/*
* This operation uses the shared memory system AND
* the system is not yet ready. This situation occurs
* when the client-core is restarted AND there were
* operations waiting to be processed or were already
* in process.
*/
gossip_debug(GOSSIP_WAIT_DEBUG,
"uses_shared_memory is true.\n");
gossip_debug(GOSSIP_WAIT_DEBUG,
"Client core in-service status(%d).\n",
is_daemon_in_service());
gossip_debug(GOSSIP_WAIT_DEBUG, "bufmap_init:%d.\n",
orangefs_get_bufmap_init());
gossip_debug(GOSSIP_WAIT_DEBUG,
"operation's status is 0x%0x.\n",
op->op_state);
/*
* let process sleep for a few seconds so shared
* memory system can be initialized.
*/
prepare_to_wait(&orangefs_bufmap_init_waitq,
&wait_entry,
TASK_INTERRUPTIBLE);
/*
* Wait for orangefs_bufmap_initialize() to wake me up
* within the allotted time.
*/
ret = schedule_timeout(
ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS * HZ);
gossip_debug(GOSSIP_WAIT_DEBUG,
"Value returned from schedule_timeout:"
"%d.\n",
ret);
gossip_debug(GOSSIP_WAIT_DEBUG,
"Is shared memory available? (%d).\n",
orangefs_get_bufmap_init());
finish_wait(&orangefs_bufmap_init_waitq, &wait_entry);
if (orangefs_get_bufmap_init() == 0) {
gossip_err("%s:The shared memory system has not started in %d seconds after the client core restarted. Aborting user's request(%s).\n",
__func__,
ORANGEFS_BUFMAP_WAIT_TIMEOUT_SECS,
get_opname_string(op));
return -EIO;
}
/*
* Return to the calling function and re-populate a
* shared memory buffer.
*/
return -EAGAIN;
}
}
out: