Commit graph

341 commits

Author SHA1 Message Date
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
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
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
e0fc4cf985 check for null client session before BIND_CONN 2011-03-08 11:04:42 -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