Commit graph

162 commits

Author SHA1 Message Date
Casey Bodley
f63528064c build.vc10: updated warning settings for visual studio projects
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-10 13:49:37 -05:00
unknown
21ee8ccaad fix for nfs41_rpc_clnt_create 2010-12-10 12:54:17 -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
unknown
168821c7fb removing daemon and libtirpc from ddk build 2010-12-10 11:26:05 -05:00
unknown
2ae743efe7 tracking open state in setattr for reboot recovery 2010-12-10 11:25:01 -05:00
unknown
a645f7030c fixing memory leaks in rpc client 2010-12-09 18:36:05 -05:00
Olga Kornievskaia
0d0b00a93b [cosmetic] moved reboot recovery code into separate function 2010-12-09 14:13:13 -05:00
Olga Kornievskaia
b0f1cff30e small fix for standalone nfsd version 2010-12-09 13:17:33 -05:00
Olga Kornievskaia
35d76cf593 fixing tirpc handle of auth_refresh
(a) auth_refresh recursively calls clnt_call() which will call
clnt_vc_call() and will try to acquire a lock on the socket which we have
already acquires. thus a change to see if the thread trying to acquire the
lock is the same holding the lock.

(b) authsspi_fresh() needed to check if we were called to refresh the
context due to the error (ie 2nd argument non-null) and if so, destroy
the old context and then reacquire a new sspi context.

it seems that InitializeSecurityContext() also requires new creds as well
so after initially calling AcquireCreds() we don't need to worry about
refreshing credentials.
2010-12-08 18:24:53 -05:00
Olga Kornievskaia
c596742659 fixing rbtree patch
name cache parent entry was never initialized. thus causing entries never to be removed from the name cache.
2010-12-07 16:50:45 -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
3ecd38e414 recovery: operations take stateid_arg instead of stateid4
operations that require a stateid now take stateid_arg for recovery information.  these operations include close, setattr, lock/unlock, layoutget, and read/write (including pnfs)

nfs41_open_stateid_arg() locks nfs41_open_state and copies its stateid into a stateid_arg
nfs41_lock_stateid_arg() locks nfs41_open_state.last_lock and copies its stateid into a stateid_arg; if there is no lock state, it falls back to nfs41_open_stateid_arg()

pnfs_read/write() now take nfs41_open_state so they can generate stateid_args

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:28 -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
7240c69b5d recovery: client keeps list of associated open state
open state is added to the client's list on a successful call to nfs41_open(), and removed from the list on nfs41_close() regardless of success

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:16 -05:00
Casey Bodley
3ca917f6b3 recovery: nfs41_open_reclaim()
added types and xdr for CLAIM_PREVIOUS, used by new function nfs41_open_reclaim()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:10 -05:00
Olga Kornievskaia
ab906f25b8 adding --noldap startup option 2010-12-02 17:43:12 -05:00
Olga Kornievskaia
3fe8b2800a fixing pattern_init
shouldn't have been freeing pattern caz it's on the stack.
instead deference the reference we get on the layout.
2010-12-02 14:22:08 -05:00
Olga Kornievskaia
dd3701932f fixing memory leak in get_client_for_netaddr 2010-12-02 14:22:07 -05:00
Olga Kornievskaia
50350df66f fixing memory leak in nfs41_client_create 2010-12-02 14:22:07 -05:00
Olga Kornievskaia
cac63b1f37 memory leak in nfs41_root_create
if nfs41_client_onwer fails, allocated memory for "root" is never removed
2010-12-02 14:22:06 -05:00
Olga Kornievskaia
f7a9932cb3 creating nfs client per security flavor 2010-12-02 14:22:05 -05:00
Olga Kornievskaia
3b9f37d5a1 adding sec flavor to upcall 2010-12-02 14:22:05 -05:00
Olga Kornievskaia
b9494c3ccc first stab at SSPI leaving gss calls in 2010-12-02 14:22:04 -05:00
Casey Bodley
32f9fa9334 replace rbtree implementation with tree.h from freebsd
added tree.h from freebsd repository and ported our name cache and client owner code

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-01 10:25:29 -05:00
Casey Bodley
91f584ba4b name cache: avoid copying strings for dprintf
use printf("%.*s", len, string) to print non-null-terminated strings

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-24 12:06:11 -05:00
Olga Kornievskaia
a66dc99c48 removed 2 compile warnings 2010-11-08 12:54:43 -05:00
Olga Kornievskaia
24c28df19d doing mount with non-fake uid gid 2010-11-08 12:54:42 -05:00
Olga Kornievskaia
a25a5221d9 adding version to the upcall
to determine that the daemon has restarted -- rather that daemon is receiving upcalls from the kernel that were processed by the old instance of the daemon -- add a version to the upcall mechanism.

when daemon starts up it generates a version number (just a timestamp). it passes this value to the driver on start up via "start_ioctl" downcall. the driver saves that value in its device extensions. it uses that value in the mount and shtudown upcalls.

when daemon replies to the mount command it again sends its version as a part of the reply. this reply is stored in driver;s netroot extensions. the driver uses netroot's value in each upcall to the daemon.

if the daemon receives an upcall for an operation where the included version does not equal to the its current version, it fails the upcall (error_code=116).

a restart of the daemon would change driver's device extension value which the driver will then use in the new mount upcalls that would establish new sessions. then the correct daemon version would be returned as a part of the mount downcalled and saved in the netroot.
2010-11-08 12:54:42 -05:00
unknown
765fb43156 [cosmetic] printing windows user name before mapping 2010-11-08 12:54:41 -05:00
Casey Bodley
a320a1b17e idmap: get uid/gid for each upcall
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-08 12:54:40 -05:00
Casey Bodley
cd1251758d idmap.c for ldap caching and configuration
struct idmap_context contains configuration data (struct idmap_config), a cache for users, and a cache for groups.  idmap_context is declared in idmap.c, and only available as an opaque pointer (nfs41_idmapper) elsewhere.  similarly, Winldap.h is only included by idmap.c, and not needed elsewhere

nfs41_idmap_create() allocates the idmap_context, loads the configuration from file, and calls ldap_init().  it does not call ldap_connect(); we'll still be able to start the daemon if ldap isn't configured, or the ldap server is down.  calling ldap_connect() is optional, as any ldap operation that requires a connection will establish it internally.  this behavior, along with the LDAP_OPT_AUTO_RECONNECT option (defaults to on), means that we shouldn't have to maintain a separate connection for each thread

nfs41_idmap_*() functions return windows errors codes.  LDAP_RETCODEs are mapped to windows errors with LdapMapErrorToWin32()

the user and group caches share a common generic interface in struct idmap_cache, which uses a linked list for storage, and protects access with a SRWLOCK.  expiration of cache entries can be adjusted by the config option 'cache_ttl'

struct config_option g_options[] is a table of available config options and their default values.  this patch adds a 'ms-nfs41-idmap.conf' file with all possible options set to default values, and commented out.  the daemon expects to find this file under c:\etc\, and won't start if it can't be opened or parsed

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-08 12:54:40 -05:00
Casey Bodley
8321939c90 fix for warning C4204: non-constant aggregate initializer
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-08 12:29:47 -05:00
Casey Bodley
575200952a tirpc: memory corruption in clnt_vc_destroy()
stop the callback thread before freeing any memory!

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-08 11:17:25 -05:00
Casey Bodley
50dbd847f0 driver: open files for one mount won't prevent unmount another
IOCTL_NFS41_DELCONN had a check for RxDeviceObject->NumberOfActiveFcbs before calling nfs41_DeleteConnection().  this prevents us from unmounting even if the netroot has no open files, and is redundant because nfs41_FinalizeNetRoot() already has the necessary check for NetRoot->NumberOfFcbs/SrvOpens

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-05 15:36:10 -04: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
Casey Bodley
f70e454988 driver: added error mapping for symlink outside filesystem
also fixed print_open_error() to check STATUS_ values, since map_open_errors() is called first

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-05 14:35:28 -04:00
Casey Bodley
b8f0f5673f driver: nfs41_FsCtl() calls print_debug_header()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-05 14:35:27 -04:00
Casey Bodley
3bdabdf918 driver: link and rename print target filename
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-05 14:35:27 -04:00
Casey Bodley
bfb5a55861 driver: print_error() for error messages
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-05 14:35:27 -04:00
Casey Bodley
4398678517 symlinks: GetReparsePoint will return NOT_A_REPARSE_POINT
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-11-04 11:53:04 -04:00
unknown
7eae229661 setting SUPPORTS_HARD_LINKS if link_support is enabled 2010-11-04 11:51:26 -04:00
unknown
8688d75574 adding env.props to mount 2010-11-03 14:18:02 -04:00
unknown
c9bbf91d4b [cosmetic] bumping debug level for remove_unsupported_attrs 2010-11-02 15:55:38 -04:00
unknown
6df50ba65c adding refcount on nfs41_root to callback server 2010-11-02 15:54:50 -04:00
unknown
7d5e6eead2 storing backpointer to nfs41_root from nfs41_client 2010-11-02 15:17:22 -04:00