summaryrefslogtreecommitdiffstats
path: root/fs
Commit message (Collapse)AuthorAgeFilesLines
* NFS: Clean up nfs_attribute_timeout()Trond Myklebust2016-12-191-7/+7
| | | | | | It can be made static. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Remove unused function nfs_revalidate_inode_rcu()Trond Myklebust2016-12-191-9/+0
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Fix and clean up the access cache validity checkingTrond Myklebust2016-12-191-9/+9
| | | | | | | The access cache needs to check whether or not the mode bits, ownership, or ACL has changed or the cache has timed out. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Only look at the change attribute cache state in nfs_weak_revalidate()Trond Myklebust2016-12-191-2/+3
| | | | | | | | Just like in nfs_check_verifier(), we want to use nfs_mapping_need_revalidate_inode() to check our knowledge of the change attribute is up to date. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Clean up cache validity checkingTrond Myklebust2016-12-193-22/+34
| | | | | | | Consolidate the open-coded checking of NFS_I(inode)->cache_validity into a couple of helper functions. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Don't revalidate the file on close if we hold a delegationTrond Myklebust2016-12-191-0/+2
| | | | | | | If we're holding a delegation, we can skip sending the close-to-open GETATTR until we're returning that delegation. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: Don't discard the attributes returned by asynchronous DELEGRETURNTrond Myklebust2016-12-191-4/+1
| | | | | | | | | DELEGRETURN will always carry a reference to the inode except when the latter is being freed, so let's ensure that we always use that inode information to ensure close-to-open cache consistency, even when the DELEGRETURN call is asynchronous. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: Update the attribute cache info in update_changeattrTrond Myklebust2016-12-191-1/+8
| | | | | | | | | | | | | | If we successfully updated the change attribute, we should timestamp the cache. While we do know that the other attributes are not completely up to date, we have the NFS_INO_INVALID_ATTR flag that let us know that, so it is valid to say that the cache has not timed out. We can also clear NFS_INO_REVAL_PAGECACHE, since our change attribute is now known to be valid. Conversely, if the change attribute did not match, we should make sure to also revalidate the access and ACL caches. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* nfs: add support for the umask attributeAndreas Gruenbacher2016-12-093-17/+42
| | | | | | | | | | | | | Clients can set the umask attribute when creating files to cause the server to apply it always except when inheriting permissions from the parent directory. That way, the new files will end up with the same permissions as files created locally. See https://tools.ietf.org/html/draft-ietf-nfsv4-umask-02 for more details. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Ensure we have enough buffer for layoutreturnTrond Myklebust2016-12-092-6/+27
| | | | | | | | | | The flexfiles client can piggyback both layout errors and layoutstats as part of the layoutreturn. Both these payloads can get large, with 20 layout error entries taking up about 1.2K, and 4 layoutstats entries taking up another 1K. This patch allows a maximum payload of 4k by allocating a full page. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Remove a redundant parameter in ff_layout_encode_ioerr()Trond Myklebust2016-12-091-6/+4
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Fix a deadlock on LAYOUTGETFred Isaman2016-12-083-46/+43
| | | | | | | | | | | | | | | We encountered a deadlock where the SEQUENCE that accompanied the LAYOUTGET triggered a session drain, while ff_layout_alloc_lseg triggered a GETDEVICEINFO. The GETDEVICEINFO hung waiting for the session drain, while the LAYOUTGET held the slot waiting for alloc_lseg to finish. Avoid this by moving the call to nfs4_find_get_deviceid out of ff_layout_alloc_lseg and into nfs4_ff_layout_prepare_ds. Signed-off-by: Fred Isaman <fred.isaman@gmail.com> [dros@primarydata.com: pNFS/flexfiles: fix races in ff_layout_mirror_valid] Signed-off-by: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Layoutreturn must free the layout after the layout-private dataTrond Myklebust2016-12-071-2/+2
| | | | | | | | | | The layout-private data may depend on the layout and/or the inode still existing when it does post-processing and frees its data, so we need to free them after calling lrp->ld_private.ops->free(). This fixes a mirror list corruption issue in the flexfiles driver. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Fix ff_layout_add_ds_error_locked()Trond Myklebust2016-12-071-1/+2
| | | | | | | When we're merging an old entry into our new entry, we want to ensure that we add the list entry in the correct place. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: Add missing nfs_put_lock_context()NeilBrown2016-12-071-2/+4
| | | | | | | | | Otherwise the lock context won't be freed when we're done with it. From: NeilBrown <neilb@suse.com> Fixes: 5bd3f817 ("NFSv4: change nfs4_select_rw_stateid to take a lock_context inplace of lock_owner") Signed-off-by: Anna Schumaker <Anna.Schumaker@netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Release NFS_LAYOUT_RETURN when invalidating the layout stateidTrond Myklebust2016-12-051-9/+12
| | | | | | | | Ensure we release the NFS_LAYOUT_RETURN lock when we invalidate the layout stateid, so that processes and RPC tasks that are waiting on the layout return can continue. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4.1: Don't schedule lease recovery in nfs4_schedule_session_recovery()Trond Myklebust2016-12-041-1/+1
| | | | | | | | If the session has an error, then we want to start by recovering the session, as any SEQUENCE we send is going to fail with a session error. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4.1: Handle NFS4ERR_BADSESSION/NFS4ERR_DEADSESSION replies to OP_SEQUENCETrond Myklebust2016-12-041-0/+4
| | | | | | | | In the case where SEQUENCE receives a NFS4ERR_BADSESSION or NFS4ERR_DEADSESSION error, we just want to report the session as needing recovery, and then we want to retry the operation. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Only look at the change attribute cache state in nfs_check_verifierTrond Myklebust2016-12-042-9/+7
| | | | | | | | | | | | | When looking at whether or not our dcache is valid, we really don't care about the general state of the directory attribute cache. Instead, we we only care about the state of the change attribute. This fixes a performance issue when the client is responsible for changing the directory contents; a number of NFSv4 operations will atomically update the directory change attribute, but may not return all the other attributes. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Fix incorrect size revalidation when holding a delegationTrond Myklebust2016-12-041-1/+4
| | | | | | | | We should only care about checking the attributes if the page cache is marked as dubious (using NFS_INO_REVAL_PAGECACHE) and the NFS_INO_REVAL_FORCED flag is set. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Fix incorrect mapping revalidation when holding a delegationTrond Myklebust2016-12-041-3/+9
| | | | | | | | We should only care about checking the attributes if the page cache is marked as dubious (using NFS_INO_REVAL_PAGECACHE) and the NFS_INO_REVAL_FORCED flag is set. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Support sending layoutstats in layoutreturnTrond Myklebust2016-12-032-6/+79
| | | | | | | Add the ability to send an array of layoutstats entries as part of layoutreturn. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Minor refactoring before adding iostats to layoutreturnTrond Myklebust2016-12-034-31/+43
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Fix up read of mirror statsTrond Myklebust2016-12-031-0/+2
| | | | | | Need to lock while reading in order to ensure 64-bit reads are correct. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Clean up layoutstatsTrond Myklebust2016-12-031-20/+7
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Refactor encoding of the layoutreturn payloadTrond Myklebust2016-12-033-31/+124
| | | | | | | | Add the layout error payload to the flexfiles layoutreturn private data, and set up the encoding mechanisms. This is a refactoring in preparation for adding the layout iostats payload. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Add a layoutreturn callback to performa layout-private setupTrond Myklebust2016-12-032-1/+14
| | | | | | | Add a callback to allow the flexfiles layout driver to initialise the layout private payload. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Allow layout drivers to manage private data in struct nfs4_layoutreturnTrond Myklebust2016-12-023-1/+10
| | | | | | | Cleanup to allow layout drivers to attach private data to layoutreturn, and manage the data. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Only send layoutstats updates for mirrors that were updatedTrond Myklebust2016-12-022-0/+9
| | | | | | | If there have been no reads or writes to a given mirror since the last layoutstats update, then don't resend the same data. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS/flexfiles: Don't attempt to send layoutstats if there are no entriesTrond Myklebust2016-12-021-0/+5
| | | | | | If the list of mirrors is empty, then don't send an RPC call. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Allow getattr to also report readdirplus cache hitsTrond Myklebust2016-12-023-5/+18
| | | | | | | | | | | If the use called stat() on an 'ls -l' workload, and the attribute cache was successfully revalidate by READDIRPLUS, then we want to report that back so that the readdir code continues to use readdirplus. Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Tested-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Be more targeted about readdirplus use when doing lookup/revalidationTrond Myklebust2016-12-021-11/+19
| | | | | | | | | | | | There is little point in setting NFS_INO_ADVISE_RDPLUS in nfs_lookup and nfs_lookup_revalidate() unless a process is actually doing readdir on the parent directory. Furthermore, there is little point in using readdirplus if we're trying to revalidate a negative dentry. Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Tested-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Fix a performance regression in readdirTrond Myklebust2016-12-021-13/+2
| | | | | | | | | | | | | | | | | | | | | | Ben Coddington reports that commit 311324ad1713, by adding the function nfs_dir_mapping_need_revalidate() that checks page cache validity on each call to nfs_readdir() causes a performance regression when the directory is being modified. If the directory is changing while we're iterating through the directory, POSIX does not require us to invalidate the page cache unless the user calls rewinddir(). However, we still do want to ensure that we use readdirplus in order to avoid a load of stat() calls when the user is doing an 'ls -l' workload. The fix should be to invalidate the page cache immediately when we're setting the NFS_INO_ADVISE_RDPLUS bit. Reported-by: Benjamin Coddington <bcodding@redhat.com> Fixes: 311324ad1713 ("NFS: Be more aggressive in using readdirplus...") Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Tested-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: fix typo in parameter descriptionWei Yongjun2016-12-011-1/+1
| | | | | | | | | Fix typo in parameter description. Fixes: 5405fc44c337 ("NFSv4.x: Add kernel parameter to control the callback server") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: discard nfs_lockowner structure.NeilBrown2016-12-014-5/+5
| | | | | | | | | It now has only one field and is only used in one structure. So replaced it in that structure by the field it contains. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: enhance nfs4_copy_lock_stateid to use a flock stateid if there is oneNeilBrown2016-12-011-5/+9
| | | | | | | | | | | | | A process can have two possible lock owner for a given open file: a per-process Posix lock owner and a per-open-file flock owner Use both of these when searching for a suitable stateid to use. With this patch, READ/WRITE requests will use the correct stateid if a flock lock is active. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: change nfs4_select_rw_stateid to take a lock_context inplace of ↵NeilBrown2016-12-013-16/+12
| | | | | | | | | | | | | | | lock_owner The only time that a lock_context is not immediately available is in setattr, and now that it has an open_context, it can easily find one with nfs_get_lock_context. This removes the need for the on-stack nfs_lockowner. This change is preparation for correctly support flock stateids. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: change nfs4_do_setattr to take an open_context instead of a nfs4_state.NeilBrown2016-12-011-15/+13
| | | | | | | | | | | The open_context can always lead directly to the state, and is always easily available, so this is a straightforward change. Doing this makes more information available to _nfs4_do_setattr() for use in the next patch. Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFSv4: add flock_owner to open contextNeilBrown2016-12-014-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An open file description (struct file) in a given process can be associated with two different lock owners. It can have a Posix lock owner which will be different in each process that has a fd on the file. It can have a Flock owner which will be the same in all processes. When searching for a lock stateid to use, we need to consider both of these owners So add a new "flock_owner" to the "nfs_open_context" (of which there is one for each open file description). This flock_owner does not need to be reference-counted as there is a 1-1 relation between 'struct file' and nfs open contexts, and it will never be part of a list of contexts. So there is no need for a 'flock_context' - just the owner is enough. The io_count included in the (Posix) lock_context provides no guarantee that all read-aheads that could use the state have completed, so not supporting it for flock locks in not a serious problem. Synchronization between flock and read-ahead can be added later if needed. When creating an open_context for a non-openning create call, we don't have a 'struct file' to pass in, so the lock context gets initialized with a NULL owner, but this will never be used. The flock_owner is not used at all in this patch, that will come later. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: remove l_pid field from nfs_lockownerNeilBrown2016-12-014-8/+2
| | | | | | | | | | | | | | | | | | this field is not used in any important way and probably should have been removed by Commit: 8003d3c4aaa5 ("nfs4: treat lock owners as opaque values") which removed the pid argument from nfs4_get_lock_state. Except in unusual and uninteresting cases, two threads with the same ->tgid will have the same ->files pointer, so keeping them both for comparison brings no benefit. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Remove unused argument from nfs_direct_write_complete()Anna Schumaker2016-12-011-6/+6
| | | | | | | | This parameter hasn't been used since 2a009ec9 (Linux 3.13-rc3), so let's remove it from this function. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* NFS: Remove unused authflavour parameter from nfs_get_client()Anna Schumaker2016-12-018-43/+23
| | | | | | | | This parameter hasn't been used since f8407299 (Linux 3.11-rc2), so let's remove it from this function and callers. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* nfs: fix false positives in nfs40_walk_client_list()J. Bruce Fields2016-12-011-1/+21
| | | | | | | | | | | | | | | | | | | | It's possible that two different servers can return the same (clientid, verifier) pair purely by coincidence. Both are 64-bit values, but depending on the server implementation, they can be highly predictable and collisions may be quite likely, especially when there are lots of servers. So, check for this case. If the clientid and verifier both match, then we actually know they *can't* be the same server, since a new SETCLIENTID to an already-known server should have changed the verifier. This helps fix a bug that could cause the client to mount a filesystem from the wrong server. Reviewed-by: Jeff Layton <jlayton@redhat.com> Tested-by: Yongcheng Yang <yoyang@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Skip invalid stateids when doing a bulk destroyTrond Myklebust2016-12-011-0/+2
| | | | | | If the layout stateid is already invalid, we have no work to do. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Wait on outstanding layoutreturns to complete in pnfs_roc()Trond Myklebust2016-12-011-0/+9
| | | | Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Don't mark the layout as freed if the last lseg is marked for returnTrond Myklebust2016-12-011-0/+2
| | | | | | Address another memory leak. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Sync the layout state bits in pnfs_cache_lseg_for_layoutreturnTrond Myklebust2016-12-011-14/+15
| | | | | | | | Ensure that the layout state bits are synced when we cache a layout segment for layoutreturn using an appropriate call to pnfs_set_plh_return_info. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Fix bugs in _pnfs_return_layoutTrond Myklebust2016-12-011-3/+10
| | | | | | | | | | | We need to honour the NFS_LAYOUT_RETURN_REQUESTED bit regardless of whether or not there are layout segments pending. Furthermore, we should ensure that we leave the plh_return_segs list empty. This patch fixes a memory leak of the layout segments on plh_return_segs. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Clear all layout segment state in pnfs_mark_layout_stateid_invalidTrond Myklebust2016-12-011-1/+18
| | | | | | | When the layout state is invalidated, then so is the layout segment state, and hence we do need to clean up the state bits. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
* pNFS: Prevent unnecessary layoutreturns after delegreturnTrond Myklebust2016-12-011-2/+4
| | | | | | | | | | | | If we cannot grab the inode or superblock, then we cannot pin the layout header, and so we cannot send a layoutreturn as part of an async delegreturn call. In this case, we currently end up sending an extra layoutreturn after the delegreturn. Since the layout was implicitly returned by the delegreturn, that just gets a BAD_STATEID. The fix is to simply complete the return-on-close immediately. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
OpenPOWER on IntegriCloud