HomeFreeBSD

nfscl: Fix must_commit/writeverf handling for Direct I/O

Description

nfscl: Fix must_commit/writeverf handling for Direct I/O

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.

(cherry picked from commit ead50c94cb604594987e6512289268891a427725)

Details

Provenance
rmacklemAuthored on Dec 11 2021, 11:00 PM
Parents
rGcc3114e17b24: ocs_fc: Populate subvendor and subdevice ids.
Branches
Unknown
Tags
Unknown