recovery: revoke all layouts and device info on client recovery

12.7.4. Recovery from Metadata Server Restart
"The client MUST stop using layouts and delete the device ID to device address mappings it previously received from the metadata server."

during client state recovery, call pnfs_file_layout_recall() to revoke all layouts and devices held by the client

LAYOUTGET, LAYOUTRETURN, and GETDEVICEINFO are all sent under their respective locks, and pnfs_file_layout_recall() requires a lock on each layout and device it operates on, so this would cause a deadlock if one of those operations triggered the recovery.  to avoid this, LAYOUTGET, LAYOUTRETURN, and GETDEVICEINFO are all sent with try_recovery=FALSE.  this behavior is preferable for recovery, because errors in the pnfs path cause us to fall back to the metadata server

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-12-02 10:41:21 -05:00
parent 9cd9744567
commit 81051ddce1
2 changed files with 10 additions and 3 deletions

View file

@ -27,6 +27,7 @@
#include "nfs41_compound.h"
#include "nfs41_xdr.h"
#include "nfs41_ops.h"
#include "nfs41_callback.h"
#include "name_cache.h"
#include "daemon_debug.h"
@ -153,6 +154,7 @@ static int recover_open(
AcquireSRWLockExclusive(&open->lock);
open->layout = NULL;
stateid.type = STATEID_OPEN;
stateid.open = open;
@ -187,6 +189,8 @@ static int recover_client_state(
IN nfs41_session *session,
IN nfs41_client *client)
{
const struct cb_layoutrecall_args recall = { PNFS_LAYOUTTYPE_FILE,
PNFS_IOMODE_ANY, TRUE, { PNFS_RETURN_ALL } };
struct client_state *state = &session->client->state;
struct list_entry *entry;
nfs41_open_state *open;
@ -202,6 +206,9 @@ static int recover_client_state(
}
LeaveCriticalSection(&state->lock);
/* revoke all of the client's layouts */
pnfs_file_layout_recall(client, &recall);
if (status != NFS4ERR_BADSESSION) {
/* send reclaim_complete, but don't fail on errors */
status = nfs41_reclaim_complete(session);