Commit graph

605 commits

Author SHA1 Message Date
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
Olga Kornievskaia
5628175fbb [driver] handling UNC paths 2011-04-20 12:36:02 -04:00
Olga Kornievskaia
089a283a3a [driver] [cosmetic] changing printfs 2011-04-19 14:00:45 -04:00
Olga Kornievskaia
20493b9e88 turning off caching if WRITE_THROUGH or NO_BUFFERING is set 2011-04-14 20:14:59 -04:00
Olga Kornievskaia
48081b9f00 printing received nfs4 access mask 2011-04-14 20:14:48 -04:00
Olga Kornievskaia
7f5f903b0a [driver] [cosmetic] restructuring debugging output 2011-04-14 20:14:21 -04:00
Olga Kornievskaia
7a77e95bcd [driver] removed unused Lock.handle 2011-04-13 20:17:59 -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
ea390c1d25 [driver] moving session and open_state out of upcall union
also passing session, open_state and version to upcallcreate function
2011-04-13 15:28:48 -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
2b5e3fd64f [acls] driver portion of setacl upcall 2011-04-12 15:56:20 -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
32be705e4d test: asio.exe for async reads and writes
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-04-12 14:49:32 -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
a67636605c fixing authdestroy called twice for non-existing target names 2011-04-12 14:09:14 -04:00
Olga Kornievskaia
36ea0af8e7 fixing typo in marshal_nfs41_getacl 2011-04-12 14:09:01 -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
3a06ec9080 [driver] fixing kernel crash when mount quits
Problem: say nfsd is not running but the redirector is active already
(ie. start deamon, stop deamon). problem doesn't exist if nfsd has never
been started. now a user process executes a mount command, the kernel
ends up creating a system thread to handle creation of the vnetroot.
that thread places a mount upcall and waits for the down call. now
kill the user process. now start the nfsd. it will pick up a queued up
upcall entry. however, in the arguments there are pointers to server name
and mount point values that are stored in the memory of the user process
that started the mount but now ended.

Solution: check that Mount.srv_name and Mount.root are still valid
addresses before dereferencing them.
2011-03-25 13:11:08 -04:00
Olga Kornievskaia
5482c0e51f [sspi] fixing memory leaks during sspi context establishment failure 2011-03-24 14:51:10 -04:00
Olga Kornievskaia
4222bd6f2b [sspi] passing gss seq# to sspi privacy api 2011-03-24 14:41:31 -04:00
U-ultimate\aglo
332f9331a2 [sspi] removing size constraints on contest tokens
MIT KDC don't issue tickets that are better than 1K.

Windows KDC carry authorization payloads with their service tickets
and thus much bigger than MIT's tickets.
2011-03-24 11:38:51 -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
5e5d1d21d5 fixing compile warnings and funciton name typos 2011-03-22 14:49:27 -04:00
Olga Kornievskaia
4355e06153 fixing compile warnings in nfs41_xdr.c 2011-03-22 14:49:26 -04:00
Olga Kornievskaia
b6d6767341 define for nfs4stateid.other constant 2011-03-22 14:49:26 -04:00
Casey Bodley
49f141680a pnfs: validate stripe unit and count to prevent div/0
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:49:25 -04:00
Casey Bodley
bf53e3dc1a pnfs: new locking model for layouts
exclusive locks are no longer held over LAYOUTGET, LAYOUTRETURN, or GETDEVICEINFO rpcs.  this prevents a deadlock when CB_LAYOUTRECALL needs an exclusive lock while another operation is on the wire

introduced a 'pending' condition variable to protect access to state->layout while the layout's lock is not held

updated file_layout_recall() to compare the stateid sequence numbers to determine if the server has processed an outstanding LAYOUTGET or LAYOUTRETURN, where we're required to reply with NFS4ERR_DELAY

LAYOUTGET, LAYOUTRETURN, and GETDEVICEINFO can now be sent with try_recovery=TRUE because they no longer hold an exclusive lock.  this makes it possible for recover_client_state() to recall all of the client's layouts without deadlocking

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:49:25 -04:00
Casey Bodley
c9585d937f pnfs: readwrite uses pnfs_layout_state
nfs41_lock_stateid_arg() is now called only once in handle_read()/handle_write(), and pnfs_read()/pnfs_write() no longer depend on nfs41_open_state

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:49:24 -04:00
Casey Bodley
8c3da98cde pnfs: update layout state on layoutget/return/recall
on a successful LAYOUTGET, file_layout_fetch() calls layout_update() to copy the first layout segment returned and update the layout stateid
on a successful LAYOUTRETURN, file_layout_return() frees the layout segment and updates/clears the stateid

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:49:24 -04:00
Casey Bodley
159ad405bb pnfs: layoutget, layoutreturn rpcs no longer operate on shared data
LAYOUTGET xdr now supports decoding of multiple layout segments, which are returned in a list with pnfs_layoutget_res_ok
LAYOUTRETURN no longer operates on an existing pnfs_file_layout.  it now takes a copy of the layout stateid, and returns the new stateid with pnfs_layoutreturn_res

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:49:23 -04:00
Casey Bodley
248c14b6ae pnfs: struct pnfs_layout_state to manage layout state
moved state data (stateid, flags, locks, and reference counts) out of struct pnfs_layout, which should represent a layout segment returned by LAYOUTGET
struct pnfs_layout_state now holds this state, along with a pointer to a single pnfs_file_layout
struct pnfs_file_layout_list is now a list of pnfs_layout_states, and was renamed to pnfs_layout_list

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:49:22 -04:00
Casey Bodley
d1683ac060 mount: fix remote name parsing to allow ipv6 addrs
instead of searching for the first :, use strrchr to find the last

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-22 14:48:17 -04:00
Olga Kornievskaia
21a4fdd563 ignoring errors from BIND_CONN_TO_SESSION 2011-03-10 11:35:58 -05:00
Olga Kornievskaia
c11e5ebce2 query for aclsupport per superblock 2011-03-10 11:31:57 -05:00
Casey Bodley
87f1005ea0 pnfs: avoid LAYOUTCOMMIT for DATA_SYNC or commit to mds
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-09 12:53:22 -05:00
Olga Kornievskaia
79455f9855 OP_GETATTR queries OWNER and OWNER_GROUP 2011-03-08 13:34:25 -05:00