• Oleg Nesterov's avatar
    NFSD: use read_seqbegin() rather than read_seqbegin_or_lock() · f3734cc4
    Oleg Nesterov authored
    The usage of read_seqbegin_or_lock() in nfsd_copy_write_verifier()
    is wrong. "seq" is always even and thus "or_lock" has no effect,
    this code can never take ->writeverf_lock for writing.
    
    I guess this is fine, nfsd_copy_write_verifier() just copies 8 bytes
    and nfsd_reset_write_verifier() is supposed to be very rare operation
    so we do not need the adaptive locking in this case.
    
    Yet the code looks wrong and sub-optimal, it can use read_seqbegin()
    without changing the behaviour.
    
    [ cel: Note also that it eliminates this Sparse warning:
    
    fs/nfsd/nfssvc.c:360:6: warning: context imbalance in 'nfsd_copy_write_verifier' -
    	different lock contexts for basic block
    
    ]
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
    Reviewed-by: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    f3734cc4
nfssvc.c 27 KB