Commit graph

606 commits

Author SHA1 Message Date
Casey Bodley
ead5bc78a2 namecache: cleanup name_cache_entry_update()
added goto out on attr_cache_find_or_create() failure to avoid calling name_cache_entry_updated()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-26 13:06:01 -04:00
Casey Bodley
a4b39031b9 namecache: cleanup nfs41_name_cache_insert()
removed unused variable 'grandparent'
factored out the call to name_cache_entry_update() from root/non-root paths

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-26 13:05:49 -04:00
Casey Bodley
af80ded902 namecache: check for empty list before scavenging
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-26 13:05:38 -04:00
Olga Kornievskaia
74bb88fac6 [cosmetic] formatting changes, removed unused defines in lookup.c 2011-08-26 12:27:21 -04:00
Olga Kornievskaia
b01b340162 [cosmetic] format and comment changes to namespace.c 2011-08-26 10:46:37 -04:00
Olga Kornievskaia
f45273e407 minor changes to nfs41_compound.c 2011-08-26 09:59:35 -04:00
Olga Kornievskaia
f61f55c660 minor fixes for nfs41_rpc.c 2011-08-25 16:00:37 -04:00
Olga Kornievskaia
a4e3d4d121 minor changes to nfs41_session.c 2011-08-25 15:21:11 -04:00
Olga Kornievskaia
14a6706039 [cosmetic] formatting changes to nfs41_superblock.c 2011-08-25 15:06:48 -04:00
Olga Kornievskaia
328b175cae [cosmetic] formatting changes to open.c 2011-08-25 14:55:32 -04:00
Olga Kornievskaia
74147edb93 [cosmetic] formating changes to pnfs_device.c 2011-08-25 14:32:55 -04:00
Olga Kornievskaia
e7c540464b simplifying argument management in io path 2011-08-25 14:08:45 -04:00
Casey Bodley
6c555e028b namecache: prefer to evict child entries over parents
renamed name_cache_entry_refresh() to name_cache_entry_updated().  this function resets the entry's expiration timer.  new function name_cache_entry_accessed() deals with moving the entry to the end of exp_entries to prevent eviction

name_cache_entry_accessed() now does the same for its parents as well.  cache consistency of the parents is maintained because their expiration timers are unchanged.  by 'refreshing' the parents of each name cache entry inserted, the eviction policy will always prefer child nodes (which are far less costly to evict)

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-25 14:04:54 -04:00
Casey Bodley
0d86c68138 namecache: delegation-related fixes
open_update_cache() wasn't retrying insert after the open_delegation_return() error case
nfs41_name_cache_delegreturn() needs a check for if (attributes->delegated) to avoid an extra deref when the call to nfs41_name_cache_insert() failed
added a TODO comment to nfs41_client_delegation_return_lru() for improvements to the naive algorithm

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-25 14:04:46 -04:00
Olga Kornievskaia
48fa809fc5 formating changes to pnfs_layout.c 2011-08-25 13:07:12 -04:00
Olga Kornievskaia
0e287a87be simplifying logic in handle_readdir 2011-08-25 13:07:00 -04:00
Olga Kornievskaia
32422a9d7f [cosmetic] formatting changes to readwrite.c 2011-08-24 18:14:02 -04:00
Olga Kornievskaia
8683797d96 [cosmetic] formating changes to recovery.c 2011-08-24 18:01:30 -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
62c00bff40 [cosmetic] formating changes (tabs) to symlink.c 2011-08-24 17:16:02 -04:00
Olga Kornievskaia
9765eb7d52 simplifying logic in upcall_marshall 2011-08-24 17:07:45 -04:00
Olga Kornievskaia
912f6ae500 need to check valid opcode value before refcounting state and root 2011-08-24 16:59:02 -04:00
Olga Kornievskaia
18797690a6 making handle_volume_attributes void 2011-08-24 16:17:06 -04:00
Olga Kornievskaia
bafc1ebdf7 fixing condition when to cancel open
when marshalling of the open downcall or allocating buffer for the downcall
fails, upcall.status gets set but we still need to cancel the open we
just did. instead check for non-allocated open state as evidence that
handle_open() failed and we don't need to cancel vs the other failure.
2011-08-24 16:03:25 -04:00
Olga Kornievskaia
27bc5b862e [driver] ignore label_security queries 2011-08-24 13:22:51 -04:00
Olga Kornievskaia
28992406a7 [driver] caching acl buffer between query security irps
windows api frequently sends a query security with a buffer len of 0
to figure out how big of buffer is needed for a security descriptor.

we send a getattr for acl attribute on the 1st irp, then cache the
returned security descriptor in fobx. on the 2nd query, if the buffer
is cached and it's not "stale", we return that buffer.
2011-08-24 12:23:04 -04:00
Olga Kornievskaia
90b650fab8 renamed do_lookup to open_for_attributes 2011-08-23 12:20:45 -04:00
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