Commit graph

51 commits

Author SHA1 Message Date
Casey Bodley
c66771cda6 ea: QueryEaInfo support for index, restart, single
nfs41_open_state stores current ea index, and increments it for each successful entry returned.  index is set to 0 when the 'restart' argument is given.  cached directory listing is freed after the listing is complete

QueryEaInfo now sends up its output buffer size, and the daemon uses this to limit its results.  added checks for buffer overflows, which required changes to the downcall structure

updated driver error mappings for map_setea_error()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:58:42 -04:00
Olga Kornievskaia
17aac16946 use readdir to generate ea list
when given a null for FILE_GET_EA_INFORMATION, use READDIR to construct one with
 the full named attribute directory listing

new function read_entire_dir() allocates an initial buffer for readdir entries a
nd calls nfs41_readdir() repeatedly to fill it.  the buffer is realloc()ed as mo
re space is required, allowing the function to return a complete listing in a si
ngle buffer

new function calculate_ea_list_length() calculates the exact length of the FILE_
GET_EA_INFORMATION buffer required to hold all of the names from the directory l
isting

once the FILE_GET_EA_INFORMATION buffer is allocated, it is filled by populate_e
a_list() and cached with nfs41_open_state

handle_getexattr() remains largely unchanged

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:58:36 -04:00
Casey Bodley
b2e6a60710 ea: refactor SetEaInfo for use on open
when open is given an ea buffer, pass it to new function nfs41_ea_set() after successful file creation.  matches NTFS behavior on all dispositions: sets EAs on FILE_CREATE, FILE_OVERWRITE, FILE_OVERWRITE_IF, FILE_SUPERSEDE.  does not set EAs on FILE_OPEN.  only sets EAs on FILE_OPEN_IF if file did not previously exist.  see new function create_with_ea()

nfs41_ea_set() returns nfs error codes.  uses NFS4ERR_FBIG when the EaValueLength exceeds NFS4_EASIZE (256).  this gets mapped to windows error ERROR_FILE_TOO_LARGE, which the driver now converts to STATUS_EA_TOO_LARGE

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-03 10:58:24 -04:00
Casey Bodley
49693532a2 locks: serialize lock requests
adds a critical section to nfs41_open_state.  this lock is taken before generating the stateid/seqid, and released after updated stateid is saved to nfs41_open_state

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-05-02 18:36:15 -04:00
Casey Bodley
2baeeb855b volume: cache volume attributes on mount
struct NFS41_V_NET_ROOT_EXTENSION now stores only the FILE_FS_ATTRIBUTE_INFORMATION (without the extra buffer space for a name).  on QueryVolumeInfo() for FileFsAttributeInformation on the root directory, the FILE_FS_ATTRIBUTE_INFORMATION is copied into the output buffer, and the name is added there.  QueryVolumeInfo() only makes upcalls when FileFsAttributeInformation queries are not for the root directory

new function is_root_directory() uses the logic from Set/GetReparsePoint() to determine whether it's operating on the root directory

moved logic from volume.c:handle_volume_attributes() to superblock.c:nfs41_superblock_fs_attributes().  the mount downcall copies the FILE_FS_ATTRIBUTE_INFORMATION buffer down to the driver.  the driver reads this buffer directly into VNetRootContext->FsAttrs

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-20 15:03:14 -04:00
Casey Bodley
b3229d20f6 ea: query each superblock for named attr support
adds a new function nfs41_superblock_getattr(), which adds an OPENATTR call with createdir=0 after the GETATTR to check for named attribute support.  OPENATTR will either return ERR_NOTSUPP if not supported, or OK/ERR_NOENT depending on whether named attributes are present on the given file.  we can't query for the 'named_attr' attribute, because it only tells us whether the given file contains named attributes

if named attributes are supported on a superblock, it will return FILE_SUPPORTS_EXTENDED_ATTRIBUTES for associated volume queries

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-09 15:01:12 -04:00
Casey Bodley
c59124dd20 superblock: mask getattr requests with supported_attrs
on creation of a new superblock, construct a bitmap for the default attribute mask to be used for GETATTR and READDIR requests on that filesystem.  mask out any unsupported attributes, and store the bitmap in the field nfs41_superblock.default_getattr

replaced function init_getattr_request() with nfs41_superblock_getattr_mask(), which returns a copy of superblock->default_getattr

removed the locking in nfs41_superblock_supported_attrs() and nfs41_superblock_supported_attrs_exclcreat(), as the supported_attrs and suppattr_exclcreat fields are read-only after the superblock is first initialized.  also factored out their common code into a bitmap_intersect() function in util.h

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-04-02 16:34:02 -04:00
Casey Bodley
68d97f5400 open: use suppattr_exclcreat to mask exclusive create attributes
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-29 16:17:48 -04:00
Casey Bodley
bbb1ed696c license changed to LGPL: added COPYING file, changed source file comments
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2012-03-19 12:24:43 -04:00
Olga Kornievskaia
4af8bbf362 [pnfs] allow callbacks to data servers 2012-03-05 18:52:06 -05:00
Olga Kornievskaia
c22c2b6080 data cache invalidation on delegation recalls
when we receive a delegation recall, we need to make a downcall
to the kernel and change a buffering/caching policy on this file.

on each open and close we pass an srv_open pointer to the nfsd to
keep in case it receives a cb_recall. we store srv_open in the
delegation state if we got a delegation.
2012-01-19 19:46:03 -05:00
Olga Kornievskaia
4be25baaee moved getdomainname into start of nfsd
acquire machine's domain name at the start of nfsd and store
in global memory, make is accessible for acl operations.
2011-12-19 19:37:35 -05:00
Casey Bodley
6872152317 pnfs: track last_offset for layoutcommit
iozone tests were failing intermittently against emc-2 due to out-of-order LAYOUTCOMMITs that both specified new_last_offset

nfs41_open_state now maintains a cached value of the last_offset, and avoids sending it with LAYOUTCOMMIT unless the new last_offset is greater than the cached offset.  this cached value is initialized on open/delegation, and updated on setattr for size

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-09-06 17:55:30 -04:00
Olga Kornievskaia
04ab888492 [cosmetic] minor license changes
added 2011 year to the copyright line
added authors info to the license
added UofM license to libtirpc files that we modified
(but i probably missed some)
2011-08-12 13:20:12 -04:00
Casey Bodley
9e556da92c deleg: handle locks locally on write delegation
new flags for nfs41_lock_state: exclusive, delegated, and id
on lock, open_lock_delegate() attempts to register a delegated lock instead of sending a LOCK request to the server
on unlock, open_unlock_delegate() removes/frees delegated locks instead of sending a LOCKU request
on delegreturn, delegation_flush_locks() sends LOCK requests for all delegated locks before returning a delegation
on recovery, recover_locks() avoids lock state recovery for delegated locks

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-12 13:18:56 -04:00
Casey Bodley
4f47ae9a37 recovery: reboot recovery of delegation stateids
recover_client_state() flags all delegations as revoked before starting open state recovery.  if recover_open() finds that its delegation is revoked, it attempts to recover it using CLAIM_PREVIOUS.  if its delegation has already been reclaimed by another open, it can skip reclaiming the open stateid (provided it has no byte-range locks to reclaim).  after all opens have been reclaimed, any delegations still marked 'revoked' are passed to recover_delegation().  recover_delegation() also uses CLAIM_PREVIOUS (or CLAIM_NULL outside of the grace period) to reclaim the delegation, but has to throw away the open stateid with CLOSE

added a try_recovery argument to nfs41_delegreturn() and nfs41_delegation_granted(), so it can be called by recover_open() if OPEN grants an unexpected open

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:19 -04:00
Casey Bodley
6878e71ec0 open: clean up patch for nfs41_rpc_open()
nfs41_open() in open.c is no longer used for recovery, so made static and renamed to do_open().  renamed nfs41_rpc_open() back to nfs41_open()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-08-05 14:32:17 -04:00
Casey Bodley
83d17fcb69 deleg: use SETATTR for OPEN4_CREATE
prevent an OPEN with OPEN4_CREATE from breaking a write delegation by sending a SETATTR instead
moved static function remove_unsupported_attrs() from setattr.c to nfs41_superblock_supported_attrs() in nfs41_superblock.c, now used by both setattr.c and delegation.c

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:24 -04:00
Casey Bodley
bc6471d981 deleg: return delegation before conflicting operations
new function nfs41_delegation_return() for synchronous delegation return.  uses a condition variable to wait if another thread is already returning the delegation
if nfs41_delegate_open() would conflict with a delegation, return it before sending the OPEN
return the delegation before sending LINK, RENAME, REMOVE, and SETATTR

all of this functionality is dependent on the preprocessor define DELEGATION_RETURN_ON_CONFLICT (on by default).  if not defined, nfs41_delegation_return() is a noop

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-07-18 15:24:24 -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
U-fast\aglo
f80d7ec365 cache volume attrs with superblock 2011-06-20 10:49:53 -04:00
Olga Kornievskaia
ee955a10b2 saving uid/gid in rpc client 2011-05-19 12:05:39 -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
d059ee1eae getdomainname stores machine's domain name
need this for acls
2011-04-12 15:40:26 -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
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
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
c11e5ebce2 query for aclsupport per superblock 2011-03-10 11:31:57 -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
9c960aa409 rpc: rebind back channel on reconnect
after reestablishing an rpc connection, send BIND_CONN_TO_SESSION if we need a back channel

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2011-01-12 12:40:40 -05:00
unknown
2ae743efe7 tracking open state in setattr for reboot recovery 2010-12-10 11:25:01 -05:00
Casey Bodley
222c1bf020 recovery: remember byte-range locks and reclaim during recovery
nfs41_open_state maintains a list of outstanding byte-range locks by calling open_lock_add() and open_lock_remove() in lock.c

during client state recovery, after reclaiming each OPEN stateid, send LOCK requests with reclaim=TRUE for each lock it owns, and update the open's lock stateid with the result

added 'bool_t reclaim' argument to nfs41_lock(); when set, compound_encode_send_decode() is called with try_recovery=FALSE to avoid recursive recovery

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:29:25 -05:00
Olga Kornievskaia
80cb5b5f57 recovery updated handling of BADSESSION
moved recovery-related fields into struct nfs41_client.recovery.  now uses a com
bination of CRITICAL_SECTION and CONDITION_VARIABLE for use with SleepConditionV
ariableCS()

renamed check_renew_in_progress() to recovery_start_or_wait(), and fixed the loc
king so that we atomically check/set in_recovery

when recovery is finished (including error conditions), call recovery_finish() t
o reset the recovery status and wake any waiting threads

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:28:13 -05:00
Casey Bodley
3ecd38e414 recovery: operations take stateid_arg instead of stateid4
operations that require a stateid now take stateid_arg for recovery information.  these operations include close, setattr, lock/unlock, layoutget, and read/write (including pnfs)

nfs41_open_stateid_arg() locks nfs41_open_state and copies its stateid into a stateid_arg
nfs41_lock_stateid_arg() locks nfs41_open_state.last_lock and copies its stateid into a stateid_arg; if there is no lock state, it falls back to nfs41_open_stateid_arg()

pnfs_read/write() now take nfs41_open_state so they can generate stateid_args

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:28 -05:00
Casey Bodley
d59d17c3b4 recovery: reclaim opens on client renewal
after the client and session have been recovered, loop through the client's list of open state, calling nfs41_open_reclaim() and updating the stateid on success

nfs41_open_state saves the share_access and share_deny fields from the initial open, for use with nfs41_open_reclaim()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:22 -05:00
Casey Bodley
7240c69b5d recovery: client keeps list of associated open state
open state is added to the client's list on a successful call to nfs41_open(), and removed from the list on nfs41_close() regardless of success

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-12-06 14:21:16 -05:00
Olga Kornievskaia
f7a9932cb3 creating nfs client per security flavor 2010-12-02 14:22:05 -05:00
Olga Kornievskaia
3b9f37d5a1 adding sec flavor to upcall 2010-12-02 14:22:05 -05:00
Olga Kornievskaia
24c28df19d doing mount with non-fake uid gid 2010-11-08 12:54:42 -05:00
unknown
7d5e6eead2 storing backpointer to nfs41_root from nfs41_client 2010-11-02 15:17:22 -04:00
Casey Bodley
bcc707d3b8 ref counting for nfs41_root
very similar to the issue with nfs41_open_state, an abandoned upcall could outlive its mount. to prevent their nfs41_root from being freed, upcalls need to hold a reference until they're finished. this also keeps all of its clients/sessions/rpc connections alive

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-27 16:18:23 -04:00
Olga Kornievskaia
006bdfa47a ref counting for nfs41_open_state 2010-10-27 16:18:12 -04:00
Casey Bodley
7e7f73766d readdir cookie is stored with nfs41_open_state
fixes a memory leak that occurs when a readdir loop doesn't complete, since the cookie was only freed on the last readdir upcall.  by storing the cookie with nfs41_open_state, we can avoid passing the cookie to the driver and back, and not worry about having to free it separately

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-27 15:25:27 -04:00
Casey Bodley
4930e7caca each mount has unique client_owner
add the netroot name to the hash for generating its client_owner

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-27 15:21:57 -04:00
Casey Bodley
6d2b631080 max_path: make an abs_path for lookup on mount
in handle_mount(), the call to nfs41_lookup() requires a mutable nfs41_abs_path because it can change on referrals, so make a copy for it

removed unused fields in struct nfs41_root and related arguments to nfs41_root_create()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:10 -04:00
Casey Bodley
f727a1e4b4 max_path: get_name() avoids copying from upcall buffer
because we no longer have to convert strings from unicode, we can avoid copying them out of the upcall buffer

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:36:10 -04:00
Casey Bodley
e67560fd4a timestamps: superblock stores attributes cansettime,time_delta
Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
2010-10-12 10:35:52 -04:00