19 Nov, 2016
2 commits
-
If the reply to a successful CLOSE call races with an OPEN to the same
file, we can end up scribbling over the stateid that represents the
new open state.
The race looks like:Client Server
====== ======CLOSE stateid A on file "foo"
CLOSE stateid A, return stateid C
OPEN file "foo"
OPEN "foo", return stateid B
Receive reply to OPEN
Reset open state for "foo"
Associate stateid B to "foo"Receive CLOSE for A
Reset open state for "foo"
Replace stateid B with CThe fix is to examine the argument of the CLOSE, and check for a match
with the current stateid "other" field. If the two do not match, then
the above race occurred, and we should just ignore the CLOSE.Reported-by: Benjamin Coddington
Signed-off-by: Trond Myklebust
Signed-off-by: Anna Schumaker -
We don't want to call nfs4_free_revoked_stateid() in the case where
the delegreturn was successful.Reported-by: Benjamin Coddington
Signed-off-by: Trond Myklebust
Signed-off-by: Anna Schumaker
11 Nov, 2016
1 commit
-
When a LOCALINV WR is flushed, the frmr is marked STALE, then
frwr_op_unmap_sync DMA-unmaps the frmr's SGL. These STALE frmrs
are then recovered when frwr_op_map hunts for an INVALID frmr to
use.All other cases that need frmr recovery leave that SGL DMA-mapped.
The FRMR recovery path unconditionally DMA-unmaps the frmr's SGL.To avoid DMA unmapping the SGL twice for flushed LOCAL_INV WRs,
alter the recovery logic (rather than the hot frwr_op_unmap_sync
path) to distinguish among these cases. This solution also takes
care of the case where multiple LOCAL_INV WRs are issued for the
same rpcrdma_req, some complete successfully, but some are flushed.Reported-by: Vasco Steinmetz
Signed-off-by: Chuck Lever
Tested-by: Vasco Steinmetz
Signed-off-by: Anna Schumaker
08 Nov, 2016
4 commits
-
Fix the following warn:
fs/nfs/nfs4session.c: In function ‘nfs4_slot_seqid_in_use’:
fs/nfs/nfs4session.c:203:54: warning: ‘cur_seq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
if (nfs4_slot_get_seqid(tbl, slotid, &cur_seq) == 0 &&
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
cur_seq == seq_nr && test_bit(slotid, tbl->used_slots))
~~~~~~~~~~~~~~~~~Signed-off-by: Shuah Khan
Signed-off-by: Anna Schumaker -
We used to check for a valid layout type id before verifying pNFS flags
as an indicator for if we are using pNFS. This changed in 3132e49ece
with the introduction of multiple layout types, since now we are passing
an array of ids instead of just one. Since then, users have been seeing
a KERN_ERR printk show up whenever mounting NFS v4 without pNFS. This
patch restores the original behavior of exiting set_pnfs_layoutdriver()
early if we aren't using pNFS.Fixes 3132e49ece ("pnfs: track multiple layout types in fsinfo
structure")
Reviewed-by: Jeff Layton
Signed-off-by: Anna Schumaker -
cl_rpcclient starts as ERR_PTR(-EINVAL), and connections like that
are floating freely through the system. Most places check whether
pointer is valid before dereferencing it, but newly added code
in nfs_match_client does not.Which causes crashes when more than one NFS mount point is present.
Signed-off-by: Petr Vandrovec
Signed-off-by: Anna Schumaker -
We need to hold the rcu_read_lock() when calling rcu_dereference(),
otherwise we can't guarantee that the object being dereferenced still
exists.Fixes: 39e5d2df ("SUNRPC search xprt switch for sockaddr")
Signed-off-by: Anna Schumaker
25 Oct, 2016
2 commits
-
A bugfix introduced a harmless gcc warning in nfs4_slot_seqid_in_use
if we enable -Wmaybe-uninitialized again:fs/nfs/nfs4session.c:203:54: error: 'cur_seq' may be used uninitialized in this function [-Werror=maybe-uninitialized]
gcc is not smart enough to conclude that the IS_ERR/PTR_ERR pair
results in a nonzero return value here. Using PTR_ERR_OR_ZERO()
instead makes this clear to the compiler.The warning originally did not appear in v4.8 as it was globally
disabled, but the bugfix that introduced the warning got backported
to stable kernels which again enable it, and this is now the only
warning in the v4.7 builds.Fixes: e09c978aae5b ("NFSv4.1: Fix Oopsable condition in server callback races")
Signed-off-by: Arnd Bergmann
Cc: Trond Myklebust
Signed-off-by: Anna Schumaker -
A NFSv4 mount of a subdirectory will show an extra slash (as in
'server://path') in proc's mountinfo which will not match the device name
and path. This can cause problems for programs searching for the mount.
Fix this by checking for a leading slash in the dentry path, if so trim
away any trailing slashes in the device name.Signed-off-by: Benjamin Coddington
Signed-off-by: Anna Schumaker
20 Oct, 2016
1 commit
-
A bugfix introduced a harmless warning for update_open_stateid:
fs/nfs/nfs4proc.c:1548:2: error: missing braces around initializer [-Werror=missing-braces]
Removing the zero in the initializer will do the right thing here
and initialize the entire structure to zero.Fixes: 1393d9612ba0 ("NFSv4: Fix a race when updating an open_stateid")
Signed-off-by: Arnd Bergmann
Signed-off-by: Anna Schumaker
14 Oct, 2016
1 commit
-
Commit 41963c10c47a35185e68cb9049f7a3493c94d2d7 sets the block layout's
last written byte to the offset of the end of the extent rather than the
end of the write which incorrectly updates the inode's size for
partial-page writes.Fixes: 41963c10c47a ("pnfs/blocklayout: update last_write_offset atomically with extents")
Signed-off-by: Benjamin Coddington
Reviewed-by: Christoph Hellwig
Tested-by: Christoph Hellwig
Cc: stable@vger.kernel.org # 4.8+
Signed-off-by: Anna Schumaker
05 Oct, 2016
2 commits
-
The caller of rpc_run_task also gets a reference that must be put.
Signed-off-by: Jeff Layton
Cc: stable@vger.kernel.org # 4.2+
Signed-off-by: Trond Myklebust
Signed-off-by: Anna Schumaker -
boot_time is represented as a struct timespec.
struct timespec and CURRENT_TIME are not y2038 safe.
Overall, the plan is to use timespec64 and ktime_t for
all internal kernel representation of timestamps.
CURRENT_TIME will also be removed.boot_time is used to construct the nfs client boot verifier.
Use ktime_t to represent boot_time and ktime_get_real() for
the boot_time value.Following Trond's request https://lkml.org/lkml/2016/6/9/22 ,
use ktime_t instead of converting to struct timespec64.Use higher and lower 32 bit parts of ktime_t for the boot
verifier.Use the lower 32 bit part of ktime_t for the authsys_parms
stamp field.Signed-off-by: Deepa Dinamani
Reviewed-by: Arnd Bergmann
Cc: Trond Myklebust
Cc: Anna Schumaker
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Anna Schumaker
01 Oct, 2016
5 commits
-
Replace the generic code to hash the auth_cred with the call to
the auth-specific hash function in the rpc_authops struct.Signed-off-by: Frank Sorenson
Signed-off-by: Anna Schumaker -
Add a hash_cred() function for RPCSEC_GSS, using only the
uid from the auth_cred.Signed-off-by: Frank Sorenson
Signed-off-by: Anna Schumaker -
Add a hash_cred() function for auth_unix, using both the
uid and gid from the auth_cred.Signed-off-by: Frank Sorenson
Signed-off-by: Anna Schumaker -
Add a hash_cred() function for generic_auth, using both the
uid and gid from the auth_cred.Signed-off-by: Frank Sorenson
Signed-off-by: Anna Schumaker -
Currently, a single hash algorithm is used to hash the auth_cred for
the credcache for all rpc_auth types. Add a hash_cred() function to
the rpc_authops struct to allow a hash function specific to each
auth flavor.Signed-off-by: Frank Sorenson
Signed-off-by: Anna Schumaker
30 Sep, 2016
1 commit
-
If an operation got interrupted, then since we don't know if the
server processed it on not, we keep the seq#. Upon reuse of slot
and seq# if we get reply from the cache (ie EREMOTEIO) then we
need to retry the operation after bumping the seq#Signed-off-by: Olga Kornievskaia
Signed-off-by: Anna Schumaker
28 Sep, 2016
21 commits
-
Fix the code so that we always mark the atime as invalid in nfs4_read_done().
Currently, the expectation appears to be that the pNFS drivers should always
do this, with the result that most of them don't.Signed-off-by: Trond Myklebust
Signed-off-by: Anna Schumaker -
sunrpc uses workqueue to clean cache regulary. There is no real dependency
of executing work on the cpu which queueing it.On a idle system, especially for a heterogeneous systems like big.LITTLE,
it is observed that the big idle cpu was woke up many times just to service
this work, which against the principle of power saving. It would be better
if we can schedule it on a cpu which the scheduler believes to be the most
appropriate one.After apply this patch, system_wq will be replaced by
system_power_efficient_wq for sunrpc. This functionality is enabled when
CONFIG_WQ_POWER_EFFICIENT is selected.Signed-off-by: Ke Wang
Signed-off-by: Anna Schumaker -
TEST_STATEID only tells you that you have a valid open stateid. It doesn't
tell the client anything about whether or not it holds the required share
locks.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
[Anna: Wrap nfs_open_stateid_recover_openmode in CONFIG_NFS_V4_1 checks]
Signed-off-by: Anna Schumaker -
Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
_nfs41_free_stateid() needs to be cached by the session, but
nfs41_test_stateid() may return NFS4ERR_RETRY_UNCACHED_REP (in which
case we should just retry).Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If the file permissions change on the server, then we may not be able to
recover open state. If so, we need to ensure that we mark the file
descriptor appropriately.Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
We need to test the NFS_OPEN_STATE flag for whether or not the
open_stateid is valid.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If we're not yet sure that all state has expired or been revoked, we
should try to do a minimal recovery on just the one stateid.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
Don't rely on nfs_inode_detach_delegation() succeeding. That can race...
Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If we're replacing an old stateid which has a different 'other' field,
then we probably need to free the old stateid.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If we race with a delegreturn before taking the spin lock, we
currently end up dropping the delegation stateid.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
The actual stateid used in the READ or WRITE can represent a delegation,
a lock or a stateid, so it is useful to pass it as an argument to the
exception handler when an expired/revoked response is received from the
server. It also ensures that we don't re-label the state as needing
recovery if that has already occurred.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
Handle revoked open/lock/delegation stateids when LAYOUTGET tells us
the state was revoked.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If the server tells us our stateid has expired, then handle that as if
it was revoked.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If the server tells us our stateid has expired, then handle that as if
it was revoked.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
Modify the helper nfs_inode_find_state_and_recover() so that it
can check all open/lock/delegation state trackers on that inode for
whether or not they need are affected by a revoked stateid error.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
This fixes a potential infinite loop in nfs_reap_expired_delegations.
Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
If a server returns NFS4ERR_ADMIN_REVOKED, NFS4ERR_DELEG_REVOKED
or NFS4ERR_EXPIRED on a call to close, open_downgrade, delegreturn, or
locku, we should call FREE_STATEID before attempting to recover.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
Nothing should need to be serialised with FREE_STATEID on the client,
so let's make the RPC call always asynchronous. Also constify the
stateid argument.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker -
Right now, we're only running TEST/FREE_STATEID on the locks if
the open stateid recovery succeeds. The protocol requires us to
always do so.
The fix would be to move the call to TEST/FREE_STATEID and do it
before we attempt open recovery.Signed-off-by: Trond Myklebust
Tested-by: Oleg Drokin
Signed-off-by: Anna Schumaker