Commit graph

479 commits

Author SHA1 Message Date
Olga Kornievskaia
dcde6457e7 simplifying nfs41_delegate_open args 2011-08-23 11:45:59 -04:00
Casey Bodley
7b07dcebb8 namecache: limit the number of delegations
to prevent delegations from claiming all available slots in the attribute cache, nfs41_name_cache_insert() now returns ERROR_TOO_MANY_OPEN_FILES when the number of delegated entries reaches 50% of the cache capacity.  see comment 'delegations and cache feedback' in name_cache.c for details

when nfs41_open() sees this error from nfs41_name_cache_insert(), it calls new function nfs41_client_delegation_return_lru() to return the least-recently-used delegation and, if successful, loops back to nfs41_name_cache_insert().  nfs41_client_delegation_return_lru() returns NFS4ERR_BADHANDLE if all delegations are currently in use (associated with an existing open), in which case nfs41_open() returns the newly-granted delegation

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-22 11:51:46 -04:00
Casey Bodley
a0d4403a99 deleg: return delegation on attr cache failure
on opens that grant a delegation, return the delegation immediately if attribute cache insertion fails

nfs41_name_cache_insert() now returns success in the 'out_err_deleg' case, where name cache insertion failed but attr cache insertion was successful

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-22 11:49:52 -04:00
Olga Kornievskaia
edd8f67873 [daemon] checking for memory allocate in downcall 2011-08-22 11:49:42 -04:00
Olga Kornievskaia
8b49beda10 [VS] adding needed cflags for 32bit build 2011-08-19 11:07:21 -04:00
Casey Bodley
28032a0309 namecache: bug fix for name_cache_insert()
once the attribute cache fills up with delegated entries, attr_cache_find_or_create() will start returning ERROR_OUTOFMEMORY.  this is a problem for nfs41_name_cache_insert(), because name_cache_find_or_create() will succeed and then name_cache_entry_update() will fail.  this leaves behind a name cache entry with attributes=NULL, which is treated like a negative entry and causes later lookups to fail with ERROR_FILE_NOT_FOUND

added a call to name_cache_entry_invalidate() to clean up this entry if name_cache_entry_update() fails

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-16 17:53:19 -04:00
Casey Bodley
bd21801819 exchangeid: use higher resolution client verifier
use GetTickCount64() for EXCHANGE_ID's client verifier instead of time().  the higher resolution helps prevent conflicting verifiers

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-15 13:41:12 -04:00
Casey Bodley
14d2b30c2c callback: avoid malloc in nfs41_callback_session_init()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-15 13:41:05 -04:00
Casey Bodley
d8048049d7 bug fix: allow space for 'tcp6' in server addrs
server_addrs_add() was using StringCchCopyA() with len=4, which truncates 'tcp6' to 'tcp\0'

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-15 13:40:57 -04:00
unknown
64cce65b77 [minor] fixed compile warning in delegation.c 2011-08-15 10:47:13 -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
9e556da92c deleg: handle locks locally on write delegation
new flags for nfs41_lock_state: exclusive, delegated, and id
on lock, open_lock_delegate() attempts to register a delegated lock instead of sending a LOCK request to the server
on unlock, open_unlock_delegate() removes/frees delegated locks instead of sending a LOCKU request
on delegreturn, delegation_flush_locks() sends LOCK requests for all delegated locks before returning a delegation
on recovery, recover_locks() avoids lock state recovery for delegated locks

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-12 13:18:56 -04:00
Casey Bodley
284c273999 recovery: fix for nfs41_delegation_to_open()
emc server uses STALE_STATEID error after server reboot, while linux server uses BAD_STATEID

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-11 13:05:38 -04:00
Casey Bodley
8e5ab92b2b recovery: support for WANT_DELEGATION
for delegations without an associated open, try the optional WANT_DELEGATION operation with CLAIM_PREVIOUS before falling back to OPEN/CLAIM_PREVIOUS.  the advantage of WANT_DELEGATION is that it doesn't generate an open stateid, so we don't need the corresponding CLOSE as in recover_delegation_open().  if WANT_DELEGATION fails with NFS4ERR_NOTSUPP, don't try it again during that round of state recovery

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:21 -04:00
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