Commit graph

411 commits

Author SHA1 Message Date
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
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
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
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
ec461ad428 [cosmetic] fixing line-endings in rpc_error_string 2011-06-02 13:20:52 -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
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
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
3a69a29ff6 dont call upcall_cleanup if versions were mismatched 2011-04-27 16:47:40 -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
48081b9f00 printing received nfs4 access mask 2011-04-14 20:14:48 -04:00
Olga Kornievskaia
529d7ce6db moving session and open_state in upcall header
every upcall (except few) pass session and open_state pointer, so
add that to marshal_nfs41_header() in the driver. remove passing
of session and open_state elsewhere in marshal functions.

in the deamon, upcall.c now reads and stores pointers to session
and open_state in nfs41_upcall datastructure instead of having
each individual upcall store their own pointers. setattrl
and readdir args keeping pointer because the rest of the code
uses them a lot.

in upcall_parse() up refcounts on session and open_state if
valid handles were passed in. down refcounts upcall_cleanup() as
before. but need to be careful with count value for mount and open
upcalls. we need to take an extra ref because upcall_cleanup() now
will always decrement it.
2011-04-13 20:07:37 -04:00
Olga Kornievskaia
71269e293c [acls] setattr of owner and group attributes 2011-04-12 19:59:58 -04:00
Olga Kornievskaia
f78cc24925 more acl
reformated some of the old functions.

finalized mapping functions for windows to nfs4 access mask bits.

satisfying nfs41_acl_query for dacl.

when doing setacl and creating "who" field of the format user@nfs4domain,
use dns domain name of the windows client machine
2011-04-12 16:47:14 -04:00
Olga Kornievskaia
80b3d11609 changing getacl downcall
instead of passing sids for the owner and group, create a security
descriptor and pass that back. this way we can add all the security
information that was queried in the daemon and pass a fully formed
security descriptor back to the kernel.

notice: irp_mj_query_security provides a pointer to the buffer that
suppose to hold the security descriptor. that memory is valid only
in the context of the process doing the security irp. we can't use
this pointer in then upcall entry and try to write the security
descriptor directly there as we process the downcall. that leads
to kernel oops.

thus we have to first allocate memory to hold the security descriptor
then copy bytes passed to us from the daemon. then do another copy
with the context of the security irp.
2011-04-12 15:57:04 -04:00
Olga Kornievskaia
c00085bfb4 daemon portion of setacl upcall
this commit does NOT have correct windows to nfs4 acl mappings but
rather has the wrapper functions defined for mapping them.

cthon tests still work with these mappings.
2011-04-12 15:56:55 -04:00
Olga Kornievskaia
72c675f03b [acls] adding acl related debug print functions 2011-04-12 15:48:04 -04:00
Olga Kornievskaia
be9fb49680 [acls] adding acls related constants 2011-04-12 15:47:23 -04:00
Olga Kornievskaia
40fce431f0 adding print_hexbuf_no_asci without asci content 2011-04-12 15:40:51 -04:00
Olga Kornievskaia
d059ee1eae getdomainname stores machine's domain name
need this for acls
2011-04-12 15:40:26 -04:00
Olga Kornievskaia
e09a179f66 fattr4_word0_acl query during nfs41_acl_query upcall
querying the server for the acl attribute during the nfs41_acl_query upcall.

no mapping of the nfs41 acl to the windows dacl yet.
2011-04-12 15:37:49 -04:00
Casey Bodley
cc2efe6a96 callback: replay cache for back channel
nfs41_cb_session stores the last cb_compound reply (whether or not cachethis was set) to handle retry attempts, along with the cb_compound arguments for improved NFS4ERR_SEQ_FALSE_RETRY detection

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-12 15:32:47 -04:00
Casey Bodley
ce200a4c2d recovery: fix for expired clientid on retried CREATE_SESSION
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-12 14:09:42 -04:00
Casey Bodley
7da9740908 bug fix for DESTROY_CLIENTID sending wrong clientid
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-12 14:09:32 -04:00
Olga Kornievskaia
b6d81b3419 xdr encode decode acl and dacl attributes
acls are lists of arbitrary length, so xdr_array() is used to allocate the array
 during decode.  because this memory is allocated by the tirpc library, it needs
 to be freed there as well; added function nfsacl41_free() to do this with XDR_F
REE

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-12 14:07:24 -04:00
Olga Kornievskaia
b9e369fac6 adding query for FileInternalInformation infoclass
this query asks for a file index which is unique identifier for a file which
we can satisfy from file attribute called "fileid"
2011-04-12 14:06:13 -04:00
Olga Kornievskaia
6aab42a4b5 adding cancel routine to mount
a user process can start a mount command and ctl-c it before it completes.
the deamon then would have a mount that we can never unmount.
2011-03-25 13:17:23 -04:00
Olga Kornievskaia
ab55e6e8c5 first stab at handling security irp
Basic handling of owner and group security query (no dacl).

Added new upcall for NFS41_ACL_QUERY (driver and daemon code).

Daemon, upon getting NFS41_ACL_QUERY first places a getattr that has
owner, group attribute request. We currently don't cache them!!!

Then, we parse nfs4name format (ie user@domain or group@domain)
into user and domain. We currently ignore domain part!!!

Then, we assume that whatever we are mapping is "known" locally
(ie LookupAccountName() api which retrieves a SID for a given name).
Mapping from name to SID can only be done in the userland. We then
copy the bytes via the upcall pipe to the kernel. If the received
user or group cant be mapped via LookupAccoundName(), we create a
well known null SID as the reply.

Kernel creates a security descriptor in the absolute-format and adds
owner and group sids to it. Important: RtlSetOwner/Group functions only
work with absolute-format security descriptor, however the reply to the
user needs to be in the self-relative format.

The way security query works is that it passes us a buffer to be filled
with the security context. However the user doesn't know how big the
buffer should be so, the user is allowed to pass a null buffer and have
the kernel return how much memory is needed. This leads to 2 security
queries => 2 NFS41_ACL_QUERY upcalls => 2 getattr rpcs... It should be
improved.

TODO:
- need to add caching of owner/group attributes for a file?
- need to add calls to LDAP for more general mapping?
- need to cache reply of the ACL if supplied length is 0?
2011-03-22 17:21:13 -04:00
Olga Kornievskaia
d2ba08614c returning acl support to driver 2011-03-22 17:21:12 -04:00
Olga Kornievskaia
887caeb922 failing rename of onto an opened file
adding a check to see if the destination filename is currently opened by
looking through the list of open states stored for a given client.

fail rename with ERROR_FILE_EXISTS if we find an open.
2011-03-22 14:49:28 -04:00
Olga Kornievskaia
8d171e71a0 send DESTROY_CLIENTID on unmount 2011-03-22 14:49:28 -04:00
Olga Kornievskaia
4355e06153 fixing compile warnings in nfs41_xdr.c 2011-03-22 14:49:26 -04:00