Commit graph

36 commits

Author SHA1 Message Date
Casey Bodley
1905abd027 session: simplify slot table error handling
due to the slot table's use of CRITICAL_SECTION and CONDITION_VARIABLE, the slot table no longer returns errors for following functions:
nfs41_session_bump_seq()
nfs41_session_free_slot()
nfs41_session_get_slot()
nfs41_session_sequence()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-06-01 11:35:40 -04:00
Olga Kornievskaia
3d57b26922 [cosmetic] removed unused define 2012-03-19 15:04:39 -04:00
Olga Kornievskaia
50cdaf6d42 send bind_conn when sr_status_flag.PATH_DOWN is set 2012-03-19 15:04:38 -04:00
Casey Bodley
bbb1ed696c license changed to LGPL: added COPYING file, changed source file comments
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-19 12:24:43 -04:00
Casey Bodley
6c1c300a3b recovery: trigger recovery on RESTART_RECLAIM_NEEDED
adds a check for sequence flag SEQ4_STATUS_RESTART_RECLAIM_NEEDED in nfs41_recover_sequence_flags().  if other _STATE_REVOKED flags are set, call nfs41_client_state_revoked() as normal but follow it up with a RECLAIM_COMPLETE.  otherwise, reclaim all locks with nfs41_recover_client_state().  like other callers of nfs41_recover_client_state(), we need to handle BADSESSION errors because the recovery operations are sent with try_recovery=FALSE.  because this logic is similar to our default NFS4ERR_BADSESSION handling, i moved the common code into a new nfs41_recover_session() function in recovery.c

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-12-19 19:50:50 -05:00
Casey Bodley
ab51beeb98 cosmetic: move sequence status recovery to separate function
new function nfs41_recover_sequence_flags() in recovery.c takes care of checking status flags, entering recovery mode, and reclaiming state

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-12-19 19:50:42 -05:00
Casey Bodley
78a0bb0ac5 recovery: handle state revocation flags in SEQUENCE response
if any of (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED | SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED | SEQ4_STATUS_ADMIN_STATE_REVOKED) are set in the session flags returned by SEQUENCE:
* enter client recovery mode
* determine which state was lost with TEST_STATEID (consider all delegations, opens, locks, and layouts)
* send FREE_STATEID for each stateid revoked
* recall all layouts and forget devices (required by 12.7.2: Dealing with Lease Expiration on the Client)
* call recover_delegation(), recover_open() or recover_locks() to reclaim each lock

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-11-02 11:58:45 -04:00
Olga Kornievskaia
ac9e621c44 [bakeathon] [session] fixing seq_id in recovery
when we are resending a create_session op we need to get possibly
updated initial sequence number from the client data structure.
2011-10-24 11:42:54 -04:00
Olga Kornievskaia
f45273e407 minor changes to nfs41_compound.c 2011-08-26 09:59:35 -04:00
Olga Kornievskaia
969783d46b removing unnecessary ZeroMemory calls
instead of calling ZeroMemory(foobar) to initialize the data structure,
during declaration do struct some_struct foobar = { 0 }
2011-08-24 17:43:20 -04:00
Olga Kornievskaia
04ab888492 [cosmetic] minor license changes
added 2011 year to the copyright line
added authors info to the license
added UofM license to libtirpc files that we modified
(but i probably missed some)
2011-08-12 13:20:12 -04:00
Casey Bodley
8ef3ec9247 cosmetic: recovery.c for client state recovery
recovery.h exposes the following functions for nfs41_compound.c:

nfs41_recovery_start_or_wait()
nfs41_recovery_finish()
nfs41_recover_client_state()
nfs41_recover_stateid()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:17 -04:00
Casey Bodley
0c874a66ba open: nfs41_rpc_open() takes open_claim4 and open_delegation4
combined nfs41_open() and nfs41_open_reclaim() into nfs41_rpc_open() by factoring out the open_claim4 argument.  new function nfs41_open() in open.c deals with the nfs41_open_state, adding it to the client's list, and handles any delegations granted

added xdr for OPEN CLAIM types CLAIM_DELEGATE_CUR, CLAIM_DELEG_CUR_FH, CLAIM_DELEGATE_PREV, CLAIM_DELEG_PREV_FH (the _FH types are new to 4.1, and not supported by linux server)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:21 -04:00
Olga Kornievskaia
c570ba2383 first stab at SECINFO
handling receiving WRONGSEC error in compound_encode_decode function by
sending either SECINFO or SECINFO_NONAME op to find out available
security flavors from the server. then try to establish new security
context given the ordered list returned by the server.

Not handling if parent directory doesn't permit a security flavor of
its child directory. Example "/" exported with only auth_sys and
"/sec" exported with only "gss".
2011-06-30 12:21:07 -04:00
Olga Kornievskaia
54c11cd84b ensuring exactly once semantics for open
if we are doing CREATE_NEW file creation, then based on whether or not
we have a persistent session, we'll send either GUARDED4 create for
persistent session and EXCLUSIVE4_1 create otherwise.
2011-05-24 12:33:58 -04:00
Casey Bodley
ce200a4c2d recovery: fix for expired clientid on retried CREATE_SESSION
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-12 14:09:42 -04:00
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