windows server does not allow for removing of opened file and instead
errors with nfs41err_file_open. we were failing the remove the silly
renamed file.
this addresses two error cases:
1) when the src entry is negative or does not exist: the dst entry could be negative or point to something else, so it needs to be removed
2) when the dst_parent entry is negative or does not exist: src needs to be made a negative entry
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
the namecache/delegation feedback code in nfs41_ops.c:open_update_cache() is interfering with delegation recovery. if its call to nfs41_name_cache_insert() fails with ERROR_TOO_MANY_OPEN_FILES, the delegation is returned instead of being recovered. this shouldn't happen during recovery, because we're replacing a delegation rather than adding a new one
nfs41_open() now remembers whether we already had a delegation. if we did, open_update_cache() will pass OPEN_DELEGATE_NONE to nfs41_name_cache_insert() to prevent it from returning ERROR_TOO_MANY_OPEN_FILES. if we didn't already have a delegation, the nfs41_delegreturn() needs to be called with the same try_recovery flag from nfs41_open()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
nfs41_name_cache_remove() needs to update the 'numlinks' attribute for other links, even if the file being removed is not found in the cache. to search for its attr cache entry, nfs41_name_cache_remove() now requires a fileid argument. nfs41_remove() only gets a pointer to the parent's filehandle, so it also needs the target fileid argument
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
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>
in the case of ds writes returning FILE_SYNC, we don't need to send a COMMIT or LAYOUTCOMMIT to the mds. COMMIT and LAYOUTCOMMIT, however, are the places where we do GETATTR(size) to update the attribute cache. so we must add a separate call to GETATTR to accomplish this after ds writes return FILE_SYNC
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
small mds writes were using DATA_SYNC4 and were not followed by COMMITs, so there was no guarantee of an updated file size before returning success
use FILE_SYNC4 for these small writes, and send COMMITs for both UNSTABLE4 and DATA_SYNC4
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
we were previously only verifying that the server didn't reboot between WRITEs. COMMIT returns a verifier that needs to be checked as well
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
avoid unnecessary calls to SystemTimeToFileTime() in get_file_epoch() by hardcoding the FILETIME value of jan_1_1970
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
on CB_GETATTR, search for a delegation with the given filehandle. if found, use its fileid to get its cached attributes. when encoding the response, only include change and size attributes
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
the out_err_deleg: case of nfs41_name_cache_insert() was forgetting to increment cache->delegations, leading to a decrement past 0. once that happens, the cache stops accepting delegations because it's comparing cache->max_delegations against UINT_MAX
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
iozone tests were failing intermittently against emc-2 due to out-of-order LAYOUTCOMMITs that both specified new_last_offset
nfs41_open_state now maintains a cached value of the last_offset, and avoids sending it with LAYOUTCOMMIT unless the new last_offset is greater than the cached offset. this cached value is initialized on open/delegation, and updated on setattr for size
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
sorry, earlier Casey, but the patch 'threading by io unit instead of stripe' from 6/20/2010 was nuts! with PNFS_THREAD_BY_SERVER disabled, we definitely -don't- want to create a separate thread for each io unit (each READ/WRITE request to a ds). we just want the one per stripe, as the intended alternative to PNFS_THREAD_BY_SERVER
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
cancel_lock() can't rely on checking upcall.status, because a handle_lock() success could be overwritten by upcall_marshall() or failure to allocate the upcall reply buffer. added new flag lock_upcall_args.acquired for this purpose
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
now that cancel_lock() and handle_unlock() depend on finding lock state in the open, the comment /* ignore errors from open_lock_add(); they just mean we won't be able to recover the lock after reboot */ no longer applies. allocate the lock state at the top of handle_lock(), so we can bail immediately on failure
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
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>