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:
parent
9cd9744567
commit
81051ddce1
2 changed files with 10 additions and 3 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include "nfs41_compound.h"
|
#include "nfs41_compound.h"
|
||||||
#include "nfs41_xdr.h"
|
#include "nfs41_xdr.h"
|
||||||
#include "nfs41_ops.h"
|
#include "nfs41_ops.h"
|
||||||
|
#include "nfs41_callback.h"
|
||||||
#include "name_cache.h"
|
#include "name_cache.h"
|
||||||
#include "daemon_debug.h"
|
#include "daemon_debug.h"
|
||||||
|
|
||||||
|
|
@ -153,6 +154,7 @@ static int recover_open(
|
||||||
|
|
||||||
AcquireSRWLockExclusive(&open->lock);
|
AcquireSRWLockExclusive(&open->lock);
|
||||||
|
|
||||||
|
open->layout = NULL;
|
||||||
stateid.type = STATEID_OPEN;
|
stateid.type = STATEID_OPEN;
|
||||||
stateid.open = open;
|
stateid.open = open;
|
||||||
|
|
||||||
|
|
@ -187,6 +189,8 @@ static int recover_client_state(
|
||||||
IN nfs41_session *session,
|
IN nfs41_session *session,
|
||||||
IN nfs41_client *client)
|
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 client_state *state = &session->client->state;
|
||||||
struct list_entry *entry;
|
struct list_entry *entry;
|
||||||
nfs41_open_state *open;
|
nfs41_open_state *open;
|
||||||
|
|
@ -202,6 +206,9 @@ static int recover_client_state(
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&state->lock);
|
LeaveCriticalSection(&state->lock);
|
||||||
|
|
||||||
|
/* revoke all of the client's layouts */
|
||||||
|
pnfs_file_layout_recall(client, &recall);
|
||||||
|
|
||||||
if (status != NFS4ERR_BADSESSION) {
|
if (status != NFS4ERR_BADSESSION) {
|
||||||
/* send reclaim_complete, but don't fail on errors */
|
/* send reclaim_complete, but don't fail on errors */
|
||||||
status = nfs41_reclaim_complete(session);
|
status = nfs41_reclaim_complete(session);
|
||||||
|
|
|
||||||
|
|
@ -1668,7 +1668,7 @@ enum nfsstat4 pnfs_rpc_layoutget(
|
||||||
layoutget_args.maxcount = session->fore_chan_attrs.ca_maxresponsesize - READ_OVERHEAD;
|
layoutget_args.maxcount = session->fore_chan_attrs.ca_maxresponsesize - READ_OVERHEAD;
|
||||||
layoutget_res.u.res_ok.layout = layout;
|
layoutget_res.u.res_ok.layout = layout;
|
||||||
|
|
||||||
status = compound_encode_send_decode(session, &compound, TRUE);
|
status = compound_encode_send_decode(session, &compound, FALSE);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
@ -1783,7 +1783,7 @@ enum nfsstat4 pnfs_rpc_layoutreturn(
|
||||||
layoutreturn_args.length = layout->layout.length;
|
layoutreturn_args.length = layout->layout.length;
|
||||||
layoutreturn_args.stateid = &layout->layout.state;
|
layoutreturn_args.stateid = &layout->layout.state;
|
||||||
|
|
||||||
status = compound_encode_send_decode(session, &compound, TRUE);
|
status = compound_encode_send_decode(session, &compound, FALSE);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
@ -1831,7 +1831,7 @@ enum nfsstat4 pnfs_rpc_getdeviceinfo(
|
||||||
getdeviceinfo_args.notify_types.count = 0;
|
getdeviceinfo_args.notify_types.count = 0;
|
||||||
getdeviceinfo_res.u.res_ok.device = device;
|
getdeviceinfo_res.u.res_ok.device = device;
|
||||||
|
|
||||||
status = compound_encode_send_decode(session, &compound, TRUE);
|
status = compound_encode_send_decode(session, &compound, FALSE);
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue