lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 313/355] NFSv4: Fix a regression in nfs_set_open_stateid_locked()
    Date
    From: Trond Myklebust <trond.myklebust@hammerspace.com>

    [ Upstream commit 01d29f87fcfef38d51ce2b473981a5c1e861ac0a ]

    If we already hold open state on the client, yet the server gives us a
    completely different stateid to the one we already hold, then we
    currently treat it as if it were an out-of-sequence update, and wait for
    5 seconds for other updates to come in.
    This commit fixes the behaviour so that we immediately start processing
    of the new stateid, and then leave it to the call to
    nfs4_test_and_free_stateid() to decide what to do with the old stateid.

    Fixes: b4868b44c562 ("NFSv4: Wait for stateid updates after CLOSE/OPEN_DOWNGRADE")
    Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    fs/nfs/nfs4proc.c | 15 ++++++++-------
    1 file changed, 8 insertions(+), 7 deletions(-)

    diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
    index 5ecaf7b6b0fa1..fb3d1532f11dd 100644
    --- a/fs/nfs/nfs4proc.c
    +++ b/fs/nfs/nfs4proc.c
    @@ -1549,15 +1549,16 @@ static bool nfs_stateid_is_sequential(struct nfs4_state *state,
    {
    if (test_bit(NFS_OPEN_STATE, &state->flags)) {
    /* The common case - we're updating to a new sequence number */
    - if (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
    - nfs4_stateid_is_next(&state->open_stateid, stateid)) {
    - return true;
    + if (nfs4_stateid_match_other(stateid, &state->open_stateid)) {
    + if (nfs4_stateid_is_next(&state->open_stateid, stateid))
    + return true;
    + return false;
    }
    - } else {
    - /* This is the first OPEN in this generation */
    - if (stateid->seqid == cpu_to_be32(1))
    - return true;
    + /* The server returned a new stateid */
    }
    + /* This is the first OPEN in this generation */
    + if (stateid->seqid == cpu_to_be32(1))
    + return true;
    return false;
    }

    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-15 19:26    [W:4.080 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site