Commit graph

434 commits

Author SHA1 Message Date
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
Olga Kornievskaia
741e8bf0bf non-blocking rpc receive
we already drop the lock between sending and receiving the rpc packets. now making it so that receive doesn't block for too long (ie 100ms) before unlocking the socket. this is needed for the callback. original rpc is sent and it triggers a callback from the server. we fork another thread to handle it, ie it needs to send a deleg_return rpc. if original rpc gets control and blocks on trying to receive its reply, it'll timeout and original rpc will return an error. instead we need to not block for long and allow the deleg_return to go thru so that the server can reply successfully to the original rpc.
2011-03-08 11:04:44 -05:00
Casey Bodley
d7e438be5e pnfs: only return-on-close for last close
added pnfs_layout.open_count to count open references, and only return the layout when pnfs_open_state_close() takes the open_count to 0

use InterlockedIncrement/Decrement to avoid an exclusive lock on the layout

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:43 -05:00
Olga Kornievskaia
83ab0b3f86 fixing error handling in sspi context establishment 2011-03-08 11:04:43 -05:00
Olga Kornievskaia
e0fc4cf985 check for null client session before BIND_CONN 2011-03-08 11:04:42 -05:00
Olga Kornievskaia
5cf32c11c2 fixing gss destroy context 2011-03-08 11:04:41 -05:00
Casey Bodley
0c2148da5b pnfs: support for mdsthreshold attribute
hacked up and tested against bluearc server

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:41 -05:00
Casey Bodley
e3c67c0bfa volume: use actual fh instead of rootfh for volume queries
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:40 -05:00
Casey Bodley
db5983734d cosmetic: removed unused nfs41_renew_in_progress()
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:40 -05:00
Casey Bodley
f0607487d6 cosmetic: remove ; from #define
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:39 -05:00
Casey Bodley
b7e1be5dc1 recovery: recover from BAD_STATEID errors
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:38 -05:00
Casey Bodley
d06b3997ec xdr: encode CREATE_SESSION4args.csa_sec_parms
encode an array of { AUTH_NONE } for callback security params

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-03-08 11:04:38 -05:00
Casey Bodley
19867b892f driver: made UNLOCK upcalls uninterruptible
connectathon locking tests trigger an interrupted UNLOCK upcall, which leads to the bugcheck in CloseSrvOpen() when freeing the security context

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-02-15 15:04:57 -05:00
Casey Bodley
c29710b47d readme: fixed typo date->data
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-02-03 15:25:23 -05:00
Casey Bodley
3f54cfd615 readme: added mount option and known issue for security
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-02-03 15:09:05 -05:00
Olga Kornievskaia
47b0ccda9c turning callback off for krb5p
sspi requires strict ordering of messages. we can't have more than 1 outstanding rpc thus, hold the lock over send and receive and turn off callbacks.
2011-02-03 13:13:10 -05:00
Olga Kornievskaia
67ae1eddaf making all but CLOSE interruptable
leaving CLOSE upcall non-interruptable as it leads to issues with security context.

making all other upcalls interruptable so that when something goes wrong we can ctrl-c out of a user application. otherwise, the machine requires a reboot (ie caz the wait we made the wait non-interrutable so nothing can kill it).
2011-02-03 11:46:51 -05:00
Olga Kornievskaia
4411d3d807 first stab at integrity and privacy
note: privacy will not work when we have more than 1 outstanding rpcs which generates out of order replies which sspi does not allow when privacy is enabled.

adding auth_wrap() and auth_unwrap() to per-message gss token protection required adding these methods to auth_sys and auth_non.

linux server doesnt support v2 kerberos tokens that have rotated data. sspi will always produce such tokens for aes. thus thus code was only tested for v1 kerberos tokens (ie des).
2011-01-27 13:52:08 -05:00
Olga Kornievskaia
b6120b41fd setting error status in rpc_reconnect if send_null fails
we were checking for error result of send_null but not setting
status, then going to "out_unlock" and since status is NO_ERROR
trying to send bind_conn_to_session
2011-01-17 11:55:36 -05:00
Olga Kornievskaia
3a60f23c91 cosmetic changing printouts in check_execute_access
adding the filename to the printouts and changing eprintf back to dprintf as it it happens too often.
2011-01-13 11:41:49 -05:00
Olga Kornievskaia
06f40459df making upcall wait uninterruptable
switching user's upcall wait from being UserMode and TRUE (interruptable) to KernelMode and FALSE. msdn doc does recommend for simplicity of the drivers to do that.

it seems to no longer generate interrupts on close irps but we are still able to ctrl-c running tests.
2011-01-12 12:44:42 -05:00
Olga Kornievskaia
4c07c25dbb saving security context in fobx
instead of getting security context on every upcall, acquire security context on open and save it in fobx. cache manager does read and write calls in a system csecurity context not in users, thus we need to use the context of the open instead.
2011-01-12 12:44:42 -05:00