• Jeff Layton's avatar
    nfsd: ensure that seqid morphing operations are atomic wrt to copies · 9767feb2
    Jeff Layton authored
    Bruce points out that the increment of the seqid in stateids is not
    serialized in any way, so it's possible for racing calls to bump it
    twice and end up sending the same stateid. While we don't have any
    reports of this problem it _is_ theoretically possible, and could lead
    to spurious state recovery by the client.
    
    In the current code, update_stateid is always followed by a memcpy of
    that stateid, so we can combine the two operations. For better
    atomicity, we add a spinlock to the nfs4_stid and hold that when bumping
    the seqid and copying the stateid.
    Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    9767feb2
state.h 21.9 KB