[Bug 269328] nfs client: data corruption using fspacectl and mmap

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 04 Feb 2023 22:02:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269328

            Bug ID: 269328
           Summary: nfs client: data corruption using fspacectl and mmap
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org
 Attachment #239910 text/plain
         mime type:

Created attachment 239910
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=239910&action=edit
Test program that triggers the error on the NFS client

Similar to 269261, it is possible to trigger data corruption on an NFS client
(In my setup, NFS 4.2 served by FreeBSD 13.1 backed by ZFS) by using fspacectl
on an mmap()ed file.

Steps to reproduce:
0) Install a Rust toolchain
1) checkout https://github.com/asomers/fsx-rs.git at rev c3e726d
2) cd fsx-rs
3) cargo build
4) Somehow mount an nfs file system
5) cat <<HERE > fsx.toml
  flen = 1048576
  nomsyncafterwrite = true
  [opsize]
  max = 393216
  [weights]
  read = 0
  write = 0
  mapread = 10
  mapwrite = 10
  truncate = 0
  punch_hole = 10
HERE
6) cargo run -- -f fsx.toml -N 1000 -P /tmp -S 9361357600271583733
~/tmp/fsx.bin

Alternate steps to reproduce:
1) Compile the attached program
2) ./fspace-and-mmap /path/to/nfs_filesystem/x.bin"

-- 
You are receiving this mail because:
You are the assignee for the bug.