[Bug 270842] [nfsclient] sees out-of-date metadata until stat(1)

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 14 Apr 2023 16:34:41 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270842

            Bug ID: 270842
           Summary: [nfsclient] sees out-of-date metadata until stat(1)
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

Using the NFS 4.2 client, I sometimes see out-of-date metadata, but it always
gets corrected by a stat(1) call.

BACKGROUND:
I do Rust development using three systems:
* FreeBSD 13.1 file server
* FreeBSD 13.1 editor client, mounting home dirs with NFS 4.2
* FreeBSD 14.0 build client, mounting home dirs with NFS 4.2

PROBLEM:
Frequently when I save a file on the editor client, the "cargo" command on the
build client thinks that the file is unchanged.  Occasionally "git diff" or
"git status" also show the file is unchanged.  However if I do "stat
/path/to/file" on the build client, then afterwards git and cargo behave
correctly.

ANALYSIS:
I don't know how cargo or git are checking the file's metadata and/or contents.
 My best guess is that they're using READDIRPLUS, whereas stat(1) uses GETATTR.
 Or maybe they both check attributes the same way, but stat(1) does something
else that causes the client to refresh attributes from the server.

This problem happens frequently enough that I can try to debug it using dtrace
or anything else, if somebody can suggest what to look at.  It usually happens
a few times per day during heavy development.

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