• Rick Macklem's avatar
    nfscl: Fix must_commit/writeverf handling for Direct I/O · ead50c94
    Rick Macklem authored
    Without this patch, the KASSERT(must_commit == 0,..) can be
    triggered by the writeverf in the Direct I/O write reply changing.
    This is not a situation that should cause a panic(). Correct
    handling is to ignore the change in "writeverf" for Direct
    I/O, since it is done with NFSWRITE_FILESYNC.
    
    This patch modifies the semantics of the "must_commit"
    argument slightly, allowing an initial value of 2 to indicate
    that a change in "writeverf" should be ignored.
    It also fixes the KASSERT()s.
    
    This bug would affect few, since Direct I/O is not enabled
    by default and "writeverf" rarely changes. Normally "writeverf"
    only changes when a NFS server reboots, however I found the
    bug when testing against a Linux 5.15.1 kernel nfsd, which
    replied to a NFSWRITE_FILESYNC write with a "writeverf" of all
    0x0 bytes.
    
    MFC after:	2 weeks
    ead50c94