pnfs: new locking model for layouts

exclusive locks are no longer held over LAYOUTGET, LAYOUTRETURN, or GETDEVICEINFO rpcs.  this prevents a deadlock when CB_LAYOUTRECALL needs an exclusive lock while another operation is on the wire

introduced a 'pending' condition variable to protect access to state->layout while the layout's lock is not held

updated file_layout_recall() to compare the stateid sequence numbers to determine if the server has processed an outstanding LAYOUTGET or LAYOUTRETURN, where we're required to reply with NFS4ERR_DELAY

LAYOUTGET, LAYOUTRETURN, and GETDEVICEINFO can now be sent with try_recovery=TRUE because they no longer hold an exclusive lock.  this makes it possible for recover_client_state() to recall all of the client's layouts without deadlocking

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-03-10 12:46:34 -05:00 committed by unknown
parent c9585d937f
commit bf53e3dc1a
4 changed files with 77 additions and 24 deletions

View file

@ -1643,7 +1643,7 @@ enum nfsstat4 pnfs_rpc_layoutget(
ZeroMemory(&layoutget_res, sizeof(layoutget_res));
layoutget_res.u.res_ok = layoutget_res_ok;
status = compound_encode_send_decode(session, &compound, FALSE);
status = compound_encode_send_decode(session, &compound, TRUE);
if (status)
goto out;
@ -1768,7 +1768,7 @@ enum nfsstat4 pnfs_rpc_layoutreturn(
layoutreturn_args.length = length;
layoutreturn_args.stateid = stateid;
status = compound_encode_send_decode(session, &compound, FALSE);
status = compound_encode_send_decode(session, &compound, TRUE);
if (status)
goto out;
@ -1806,7 +1806,7 @@ enum nfsstat4 pnfs_rpc_getdeviceinfo(
getdeviceinfo_args.notify_types.count = 0;
getdeviceinfo_res.u.res_ok.device = device;
status = compound_encode_send_decode(session, &compound, FALSE);
status = compound_encode_send_decode(session, &compound, TRUE);
if (status)
goto out;