Commit graph

304 commits

Author SHA1 Message Date
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
Olga Kornievskaia
d6967ea9ef reestablishing gss context on rpc_reconnect
if we receive an rpc_autherr, just recreate a new rpc client as well
as the rpc auth structure. as it ties into the recovery and handles
that only one thread recovers and reestablishes the rpc auth context.

in theory, reestablishing rpc client does not necessitate new rpc auth
context. we really need to restablish one only if we get rpc autherr. however,
it simplifies the code not to introduce a different synchronization
mechanism for rpc auth in addition to the rpc one.
2011-05-16 18:32:56 -04:00
Olga Kornievskaia
b6beb6f2a9 [libtircp] adding timeout on async recv
once libtirpc blocking recv was changed to a polling receive,
we no longer had a timeout mechanims on waiting for a reply.

solution: save a timestamp before the recv call, on each async recv return
check if the time lapsed does not exceed the timeout value. when timeout
is reach, return TIMEDOUT rpc error.
2011-05-16 15:46:45 -04:00
Olga Kornievskaia
d83fece068 [driver] fixing return value for security query
rdbss doesn't like status_buffer_too_small return and instead needs
status_buffer_overflow
2011-05-02 13:38:41 -04:00
Casey Bodley
90513f177b volume: fix for volume queries over referrals
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-05-02 11:13:23 -04:00
Olga Kornievskaia
42be031364 [mount] adding security option to PrintUsage 2011-04-29 14:48:03 -04:00
Olga Kornievskaia
ab7bdbd125 [cosmetic] adding iostatus printf to fsddispatch 2011-04-29 14:29:54 -04:00
Olga Kornievskaia
3a69a29ff6 dont call upcall_cleanup if versions were mismatched 2011-04-27 16:47:40 -04:00
Olga Kornievskaia
a173395b5a [libtirpc] fix for async rpc + krb5p
don't release the lock if this is krb5p when the receiver finds nothing in
the socket during the recv
2011-04-27 15:56:01 -04:00
Olga Kornievskaia
0d02adba8e [daemon] moving refcount after version checking
in case of daemon restart, we can't update reference count on session
and open state until we know it's a valid upcall (via version checking)
2011-04-27 11:38:40 -04:00
Olga Kornievskaia
dd6f2c1849 [driver] share any session for WILD vnetroot
when vnetroot creation of wild comes in it is always for "AUTH_SYS" but if
there exists a gss_session than use that.
2011-04-27 11:37:27 -04:00
Casey Bodley
880dbf8afc driver: fix for has_nfs_prefix()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-20 12:46:29 -04:00