Commit graph

20 commits

Author SHA1 Message Date
Casey Bodley
b7e1be5dc1 recovery: recover from BAD_STATEID errors
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:38 -05:00
Casey Bodley
9c59af4da5 fixes for bind_conn_to_session()
fixes for xdr encoding of bind_conn_to_session, after testing against linux server

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-01-12 12:40:39 -05:00
Casey Bodley
757b637607 create_session uses compound_encode_send_decode()
send CREATE_SESSION with compound_encode_send_decode() instead of nfs41_send_compound() for its NFS4ERR_DELAY and NFS4ERR_STALE_CLIENTID handling

added 'try_recovery' argument to nfs41_create_session(), which is passed on to compound_encode_send_decode().  nfs41_session_renew() uses try_recovery=FALSE, because it handles the NFS4ERR_STALE_CLIENTID error on its own.  nfs41_session_create() uses try_recovery=TRUE to make use of the NFS4ERR_STALE_CLIENTID error handling.  modified the NFS4ERR_STALE_CLIENTID block to call nfs41_client_renew() and retry the operation (i.e. CREATE_SESSION), instead of falling through to session recovery

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-01-10 15:16:17 -05:00
Casey Bodley
81051ddce1 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>
2011-01-04 14:26:28 -05:00
Casey Bodley
853dcc385e recovery: lock_owner to open_owner
if we're recovering a lock stateid for a LOCK operation, and the file has no outstanding locks, we won't be able to recover a lock stateid.  resend the LOCK with an open stateid instead

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-13 13:35:56 -05:00
Casey Bodley
1d9981e59e fix for retry on stateid recovery
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-10 14:51:46 -05:00
Olga Kornievskaia
1196182a8e minor changes
cosmetic: renaming do_recovery to recover_stateid

removing client_state_remove() from setattr because we'll do it on close
2010-12-10 11:39:28 -05:00
Olga Kornievskaia
0d0b00a93b [cosmetic] moved reboot recovery code into separate function 2010-12-09 14:13:13 -05:00
Casey Bodley
0a309c4350 recovery: use normal OPEN/LOCK on ERR_NO_GRACE
if we see NFS4ERR_NO_GRACE from recovery operations, it means we lost our state due to a lease expiration rather than a server reboot.  in this case, it's possible that conflicting locks were granted to other clients, so we have to try normal OPEN/LOCK operations to recover our state.  because they're sent during recovery, nfs41_open() and nfs41_lock() take a new 'bool_t try_recovery' argument so we can avoid recursion

if these operations fail due to conflicting locks, we have no choice but to return errors to the application.  using a stateid that was revoked due to lease expiration results in NFS4ERR_EXPIRED, and we map this error to ERROR_FILE_INVALID: The volume for a file has been externally altered so that the opened file is no longer valid.

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:29:32 -05:00
Casey Bodley
222c1bf020 recovery: remember byte-range locks and reclaim during recovery
nfs41_open_state maintains a list of outstanding byte-range locks by calling open_lock_add() and open_lock_remove() in lock.c

during client state recovery, after reclaiming each OPEN stateid, send LOCK requests with reclaim=TRUE for each lock it owns, and update the open's lock stateid with the result

added 'bool_t reclaim' argument to nfs41_lock(); when set, compound_encode_send_decode() is called with try_recovery=FALSE to avoid recursive recovery

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:29:25 -05:00
Casey Bodley
1906610544 cosmetic: moved client state recovery to separate function
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:29:10 -05:00
Casey Bodley
7c8f58b992 recovery: avoid recursive state recovery
avoid the recursive case where state recovery operations (OPEN for reclaim and RECLAIM_COMPLETE) return BADSESSION, which kicks off another round of recovery

added a 'bool_t try_recovery' argument to compound_encode_send_decode() in place of its unused 'bufsize_in' and 'bufsize_out'.  when try_recovery=FALSE, return BADSESSION/STALE_CLIENTID errors instead of attempting recovery.  nfs41_open_reclaim(), nfs41_reclaim_complete(), and nfs41_destroy_session() now pass try_recovery=FALSE

during state recovery, we can now check the return values of nfs41_open_reclaim() and nfs41_reclaim_complete() for BADSESSION, and use a goto to restart session recovery

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:29:01 -05:00
Olga Kornievskaia
80cb5b5f57 recovery updated handling of BADSESSION
moved recovery-related fields into struct nfs41_client.recovery.  now uses a com
bination of CRITICAL_SECTION and CONDITION_VARIABLE for use with SleepConditionV
ariableCS()

renamed check_renew_in_progress() to recovery_start_or_wait(), and fixed the loc
king so that we atomically check/set in_recovery

when recovery is finished (including error conditions), call recovery_finish() t
o reset the recovery status and wake any waiting threads

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:28:13 -05:00
Casey Bodley
8616b03597 recovery: recover from STALE_STATEID errors
consider an operation that takes a stateid, and results in a BADSESSION error due to server reboot.  we'll recover the client and session, and send OPENs to reclaim all of the client's state.  but after recovery, we'll resend the original operation with the original stateid, and this will result in a STALE_STATEID error

we handle this by making use of the information in stateid_arg.  if we determine that stateid_arg.stateid is different from the nfs41_open_state's stateid, we copy the new stateid into stateid_arg.stateid and retry

note that if another thread is in recovery, it hasn't finished reclaiming its open state yet; so we wait on recovery to finish before comparing the stateids

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:34 -05:00
Casey Bodley
d59d17c3b4 recovery: reclaim opens on client renewal
after the client and session have been recovered, loop through the client's list of open state, calling nfs41_open_reclaim() and updating the stateid on success

nfs41_open_state saves the share_access and share_deny fields from the initial open, for use with nfs41_open_reclaim()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:22 -05:00
Casey Bodley
38813e13d8 cosmetic: cleaning up small functions
attempted to get rid of short functions that are only called from one place

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-05 15:10:20 -04:00
Olga Kornievskaia
e51ba46d8b adding tags to compounds
contributed by Tigran
2010-10-27 15:00:12 -04:00
U-fast\aglo
f01f1304da bumping seq if decoded successfully
before, we would not bump the sequence if we couldn't decode an
operation in the received compound.
2010-10-13 14:46:25 -04:00
Casey Bodley
db5e8f9d34 ERR_STALE: skip recovery on NULL path
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 12:11:43 -04:00
Casey Bodley
0ad4db4fad fresh git tree for public release
we regretfully had to remove our git history for licensing reasons

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:15:48 -04:00