Commit graph

465 commits

Author SHA1 Message Date
Casey Bodley
b9b3b00e76 recovery: support for CLAIM_DELEGATE_PREV, DELEGPURGE
10.2.1. Delegation Recovery (re: client restart/lease expiration)
A server MAY support claim types of CLAIM_DELEGATE_PREV and CLAIM_DELEG_PREV_FH, and if it does, it MUST NOT remove delegations upon a CREATE_SESSION that confirm a client ID created by EXCHANGE_ID.  Instead, the server MUST, for a period of time no less than that of the value of the lease_time attribute, maintain the client's delegations to allow time for the client to send CLAIM_DELEGATE_PREV and/or CLAIM_DELEG_PREV_FH requests.  The server that supports CLAIM_DELEGATE_PREV and/or CLAIM_DELEG_PREV_FH MUST support the DELEGPURGE operation.

if there's a delegation to reclaim, recover_open_no_grace() now tries CLAIM_DELEGATE_PREV (supported by emc server, but not linux) before falling back to CLAIM_NULL
nfs41_client_delegation_recovery() sends DELEGPURGE to indicate that we're finished reclaiming delegations

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:21 -04:00
Casey Bodley
8e310c5711 recovery: handle delegation.recalled on reclaim
while the server is required to grant us delegations we reclaim through CLAIM_PREVIOUS, it may set the flag recalled=TRUE if it's not ready to grant the delegation.  the client is then responsible for flushing modified state to the server and returning the delegation

new function nfs41_client_delegation_recovery() cleans up after delegation recovery by a) returning any delegations flagged as recalled, and b) 'forgetting' any delegations that we failed to reclaim.  this function is called under the client's state recovery lock, directly after open and delegation state is recovered

added 'try_recovery' argument to delegation_return(), allowing it to be called during client state recovery.  split out the code that removes the delegation from the client and its opens into delegation_remove(), which is what nfs41_client_delegation_recovery() uses to 'forget' a delegation

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:20 -04:00
Casey Bodley
d44470c877 recovery: recover from delegation stateid errors
delegation stateid arguments to DELEGRETURN and OPEN are now stateid_arg, for use with recover_stateid_delegation().  added a nfs41_delegation_state pointer to stateid_arg, for when a delegation stateid is used in the absence of nfs41_open_state (DELEGRETURN, SETATTR)

recovery during a call to nfs41_delegation_to_open() requires special attention; recover_stateid_delegation() has to handle the case where recover_open() already reclaimed the open stateid.  it does this by returning BAD_STATEID instead of retrying the OPEN (which would generate yet another open stateid)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:20 -04:00
Casey Bodley
4f47ae9a37 recovery: reboot recovery of delegation stateids
recover_client_state() flags all delegations as revoked before starting open state recovery.  if recover_open() finds that its delegation is revoked, it attempts to recover it using CLAIM_PREVIOUS.  if its delegation has already been reclaimed by another open, it can skip reclaiming the open stateid (provided it has no byte-range locks to reclaim).  after all opens have been reclaimed, any delegations still marked 'revoked' are passed to recover_delegation().  recover_delegation() also uses CLAIM_PREVIOUS (or CLAIM_NULL outside of the grace period) to reclaim the delegation, but has to throw away the open stateid with CLOSE

added a try_recovery argument to nfs41_delegreturn() and nfs41_delegation_granted(), so it can be called by recover_open() if OPEN grants an unexpected open

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:19 -04:00
Casey Bodley
3734527757 recovery: avoid reclaim attempts out of grace period
nfs41_recover_client_state() remembers whether it's seen NFS4ERR_NO_GRACE, and will avoid sending RECLAIM_COMPLETE and the recovery versions of OPEN and LOCK

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:18 -04:00
Casey Bodley
115ed7c1d3 recovery: open and lock recovery in separate functions
moved recovery of lock stateids from recover_open() to new function recover_locks()
split nfs41_recover_stateid() into recover_stateid_open() and recover_stateid_lock()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:18 -04:00
Casey Bodley
6878e71ec0 open: clean up patch for nfs41_rpc_open()
nfs41_open() in open.c is no longer used for recovery, so made static and renamed to do_open().  renamed nfs41_rpc_open() back to nfs41_open()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:17 -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
Olga Kornievskaia
316dfe568a query owner and group attr only on specific getattrs
previously we'd query owner and group file attributes on all getattrs and
storing that in nfs41_file_info structure which was caused a problem for
readdirs.
2011-07-18 15:24:25 -04:00
Casey Bodley
83d17fcb69 deleg: use SETATTR for OPEN4_CREATE
prevent an OPEN with OPEN4_CREATE from breaking a write delegation by sending a SETATTR instead
moved static function remove_unsupported_attrs() from setattr.c to nfs41_superblock_supported_attrs() in nfs41_superblock.c, now used by both setattr.c and delegation.c

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:24 -04:00
Casey Bodley
bc6471d981 deleg: return delegation before conflicting operations
new function nfs41_delegation_return() for synchronous delegation return.  uses a condition variable to wait if another thread is already returning the delegation
if nfs41_delegate_open() would conflict with a delegation, return it before sending the OPEN
return the delegation before sending LINK, RENAME, REMOVE, and SETATTR

all of this functionality is dependent on the preprocessor define DELEGATION_RETURN_ON_CONFLICT (on by default).  if not defined, nfs41_delegation_return() is a noop

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:24 -04:00
Casey Bodley
38259e0017 deleg: delegation support for name/attr cache
when a delegation is granted by OPEN, its delegation type is passed to nfs41_name_cache_insert().  as long as the delegation is held, its name_cache_entry is kept out of the cache.exp_entries list to prevent it from expiring.  an extra reference is held on the attr_cache_entry as well, so it sticks around even if the name_cache_entry is removed (a parent expires, for example).  new function nfs41_name_cache_delegreturn() adds the name_cache_entry back to the list, and releases the extra attr_cache_entry reference

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:23 -04:00
Casey Bodley
ee71a62af2 deleg: make use of delegation stateids
combined nfs41_lock_stateid_arg() into nfs41_open_stateid_arg().  if a delegation is present, use the delegation stateid before looking at lock/open stateids.  if a delegation recall is in progress, wait on its condition variable before falling back to the open stateid

made nfs41_lock_stateid_arg() static to lock.c because of its special semantics; open_to_lock_owner4 for LOCK won't accept a delegation stateid, so nfs41_delegation_to_open() is called to convert it

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:22 -04:00
Casey Bodley
02216cbf28 deleg: return delegation on CB_RECALL
moved thread creation from callback_server.c to nfs41_delegation_recall() in delegation.c

nfs41_delegation_recall() first searches for the delegation, and returns NFS4ERR_BADHANDLE if not found.  otherwise, it spawns a thread to handle the recall and returns NFS4_OK

delegation_return() calls nfs41_delegation_to_open() for each nfs41_open_state associated with the delegation

nfs41_delegation_to_open() sends OPEN with CLAIM_DELEGATE_CUR to reclaim an open stateid, and uses a condition variable in nfs41_open_state to prevent multiple threads from attempting reclaim

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:22 -04:00
Casey Bodley
0bee545e91 deleg: use delegations to satisfy opens locally
added delegation.c and .h

nfs41_client stores a list of nfs41_delegation_state
new function nfs41_delegate_open() to look for a compatible delegation before calling nfs41_open()
if nfs41_open() is granted a delegation, call nfs41_delegation_granted() to register it with the client
client calls nfs41_client_delegation_free() on unmount to free list of delegations

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:21 -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
Casey Bodley
2b5a5fb071 daemon: cleaned up compiler warnings
raised warning level to /Wall
changed nfs41_file_info.owner, owner_group to char[] to avoid casting

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:20 -04:00
Olga Kornievskaia
e493d339c8 adding auth_sys to cb sec types
in create_session we were sending auth_none as available security types
for the callback channel. Adding auth_sys to the list. No enforcement of
these creds happens.
2011-07-18 15:24:19 -04:00
Olga Kornievskaia
c722076d09 [driver] removing mrxsetinfoatcleanup
this function was called before writes and was setting time and size
attributes of the file. we were translating it into a setattr. reads
were also followed by a setattr of timestamp (unnecessarily)
2011-07-18 15:24:19 -04:00
Casey Bodley
144642e2cd setattr: add GETATTR to capture side effects
instead of updating the attribute cache with the values given to SETATTR, add a GETATTR to the compound; this will capture changes to time_modify and change that the client could otherwise miss, and get the server's value of timestamps sent with SET_TO_SERVER_TIME4

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:18 -04:00
Casey Bodley
2f0393e7d3 callback: clear replay cache on session recovery
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 10:52:39 -04:00
Casey Bodley
96e560c9db readme: updated known issues
removed issue for nfs_mount.exe not listing mounted drives
modified issue for renaming on top of an open file (now returns an error)
added issue suggesting DisableDfs

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-01 11:52:44 -04:00
Casey Bodley
98dc722ccc pnfs: xdr for CB_NOTIFY_DEVICEID
calls stub function pnfs_file_device_notify() for each deviceid

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-01 11:33:52 -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
939db9c80b dont dereference root if mount fails
if mount failed and mount upcall was canceled cancle_mount() function tries
to dereference an invalid handle value
2011-06-29 18:29:21 -04:00
Olga Kornievskaia
0d0cee6ad6 [acl] converting group sid to GROUP@
when we process aces from windows, if we see an ace with sids of
the primary group, replace that with GROUP@ special who identifier.
2011-06-27 16:01:34 -04:00
Olga Kornievskaia
2db91a3001 deny setattr for size if not opened for write
proposes an alternate solution for attempts to set file size without an open sta
teid.  instead of acquiring one by sending OPEN, fail the request with ACCESS_DE
NIED

according the MS File System Algorithms documentation for setting FileAllocation
Information and FileEndOfFileInformation [http://msdn.microsoft.com/en-us/librar
y/ff469355%28v=PROT.10%29.aspx]:
"If Open.GrantedAccess does not contain FILE_WRITE_DATA, the operation MUST be f
ailed with STATUS_ACCESS_DENIED"

-removes open_owner_id, access_mask, access_mode from setattr upcall arguments
-moves map_access_2_allowdeny() back to open.c as a static function, since handl
e_setattr() was its only other call site
2011-06-27 14:51:15 -04:00
Olga Kornievskaia
9f2587c3b3 [driver] abandoned upcalls dont delete security context
Deleting client's security context was causing kernel crashes.

During upcall, we remember a pointer to the client's security context,
then on close we delete the security context. Previously we would also
delete the context if the upcall was abandoned.

Apparently, windows will always send a close for the fcb that was used
for the abandoned upcall. Close deletes the context. Then when upcall
was done, it would try to delete the context again (oops).
2011-06-22 11:42:30 -04:00
U-fast\aglo
c24c79f3cc handling rpc_autherr
instead of trying to restablish the rpc client and auth_client for
autherr, instead just create a new auth_client.
2011-06-20 12:15:25 -04:00
Casey Bodley
c1b603ad7f pnfs: fix for BADLAYOUT error from LAYOUTGET
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-20 10:50:16 -04:00
Casey Bodley
6269b2b112 pnfs: tag pnfs reads and writes with 'ds'
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-20 10:50:04 -04:00
U-fast\aglo
f80d7ec365 cache volume attrs with superblock 2011-06-20 10:49:53 -04:00
Casey Bodley
a4c726f92d name cache: no longer copies fh for negative entries
nfs41_name_cache_lookup() was returning FILE_NOT_FOUND on negative entries, but still copying the target filehandle

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-14 12:36:07 -04:00
U-fast\aglo
6a9a9bb932 [libtirpc] fixing infinite loop in autherr
refreshes if not static was causing infinite recursive calling.
2011-06-14 12:00:05 -04:00
Casey Bodley
49890fe1b1 namedattr: xdr for OPENATTR
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-14 11:57:52 -04:00
Casey Bodley
fd59b56add pnfs: fix for ERR_DELAY on CB_LAYOUTRECALL
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-13 13:37:35 -04:00
Casey Bodley
d98da23d49 lock: address differences in lock semantics
zero-length ranges: valid on windows, but nfs servers MUST return NFS4ERR_INVAL for LOCK with length=0. use MRxIsLockRealizable() to return STATUS_NOT_SUPPORTED for zero-length ranges (avoiding the lock upcall and rpc)

ranges that extend past UINT64_MAX: not valid on windows. NFS expects length=UINT64_MAX for locking to end-of-file. use length=UINT64_MAX if length >= UINT64_MAX-offset (making lock ranges consistent with linux client)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-06-13 12:02:59 -04:00
Olga Kornievskaia
2d252266c2 [driver] fixing dereference of upcall entry after free if we fail to get security context 2011-06-08 12:54:31 -04:00
Olga Kornievskaia
25cf92a60b [driver] changing logic in volume query
previously, if the supplied buffer length was smaller than the result
of the volume query we returned SUCCESS and no data (ie. it was needed
because Notepad passes in a buffer too small but doesn't like a
buffer_too_small error.) However, it does work with buffer_overflow
error and then a partial resulted returned.
2011-06-06 18:44:59 -04:00
Olga Kornievskaia
8153733a77 [driver] fixing volume label length 2011-06-06 11:25:02 -04:00
Olga Kornievskaia
ec461ad428 [cosmetic] fixing line-endings in rpc_error_string 2011-06-02 13:20:52 -04:00
Olga Kornievskaia
faec978ad5 [dll] fixing drive enumeration
setacl tool was calling into our dll to enumerate mounted drives. the
index was not updated after we returned the results and caused an
infinite loop.
2011-06-01 12:36:46 -04:00
Olga Kornievskaia
bb8de9c266 [libtirpc] catching network errors
if during recv we received an error, then propagate that to the caller.
otherwise, do time out check. also do timeout check if the thread's xid
didn't match received xid (making sure we'll timeout if we have a starving
thread that will never receive a reply)
2011-05-27 10:38:59 -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
Olga Kornievskaia
cb54018555 asking for persistent session from a server 2011-05-23 16:35:38 -04:00
Olga Kornievskaia
9f9401d6c8 adding WRONGSEC error to mapping function 2011-05-19 14:55:36 -04:00
Olga Kornievskaia
eb5a1d721c xdr for SECINFO and SECINFO_NO_NAME 2011-05-19 12:09:57 -04:00
Olga Kornievskaia
ee955a10b2 saving uid/gid in rpc client 2011-05-19 12:05:39 -04:00
Olga Kornievskaia
aa4c8603ee [cosmetic] adding gssauth_string for debug 2011-05-19 12:02:06 -04:00
Olga Kornievskaia
c9e507f231 fixed memory if AcquireCred fails
if mount -o sec=krb5 fails because the user doesn't have kerberos credentials,
we were not freeing memory allocated for sec context.
2011-05-18 18:07:56 -04:00