Bug 30971

Summary: [nfs] NFS client modification time resolution is not high enough, which may cause client side cache inconsistent
Product: Base System Reporter: Wencheng Chai <wchai>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description Wencheng Chai 2001-10-01 23:30:00 UTC
The NFS client side stores the value of va_mtime only in total number 
of seconds(va_mtime.tv_sec), even the server sends the mtime in term of
seconds and nanoseconds.

Fix: ======================================================================

======================================================================


======================================================================--B7L25IHA1UoJhWtDrMwCJianooNVdt4gwwpHW9kZvm9uKpuo
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

*** /usr/src/sys/nfs/nfs_bio.c  Tue Aug 21 12:39:09 2001
--- nfs_bio.c   Wed Sep 12 03:45:03 2001
***************
*** 394,410 ****
                        if (error)
                                return (error);
                        np->n_mtime = vattr.va_mtime.tv_sec;
                } else {
                        error = VOP_GETATTR(vp, &vattr, cred, p);
                        if (error)
                                return (error);
!                       if (np->n_mtime != vattr.va_mtime.tv_sec) {
                                if (vp->v_type == VDIR)
                                        nfs_invaldir(vp);
                                error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
                                if (error)
                                        return (error);
                                np->n_mtime = vattr.va_mtime.tv_sec;
                        }
                }
        }
--- 394,415 ----
                        if (error)
                                return (error);
                        np->n_mtime = vattr.va_mtime.tv_sec;
+                       np->n_vattr.va_mtime.tv_sec = vattr.va_mtime.tv_sec;
+                       np->n_vattr.va_mtime.tv_nsec = vattr.va_mtime.tv_nsec;
                } else {
                        error = VOP_GETATTR(vp, &vattr, cred, p);
                        if (error)
                                return (error);
!                       if ((np->n_vattr.va_mtime.tv_sec != vattr.va_mtime.tv_se
c)||((np->n_vattr.va_mtime.tv_sec == vattr.va_mtime.tv_sec)&&(np->n_vattr.va_mti
me.tv_nsec != vattr.va_mtime.tv_nsec))) {
                                if (vp->v_type == VDIR)
                                        nfs_invaldir(vp);
                                error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
                                if (error)
                                        return (error);
                                np->n_mtime = vattr.va_mtime.tv_sec;
+                               np->n_vattr.va_mtime.tv_sec = vattr.va_mtime.tv_
sec;
+                               np->n_vattr.va_mtime.tv_nsec = vattr.va_mtime.tv
_nsec;
+
                        }
                }
        }
How-To-Repeat: Two NFS clients mounted from the same exported FS,
Type "touch file1" and "touch file2" from different 
clients simultaneously, then type "ls -l" from the 
first client, the output of "ls" only shows file1.
Comment 1 Doug Barton freebsd_committer freebsd_triage 2001-10-06 23:29:08 UTC
Responsible Changed
From-To: freebsd-bugs->peter


Looks like a job for EvilPete
Comment 2 K. Macy freebsd_committer freebsd_triage 2007-11-16 17:31:12 UTC
State Changed
From-To: open->feedback


Is this still a problem? I haven't seen this. 


Comment 3 K. Macy freebsd_committer freebsd_triage 2007-11-16 17:31:12 UTC
Responsible Changed
From-To: peter->freebsd-bugs


Is this still a problem? I haven't seen this.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2008-03-01 19:57:43 UTC
State Changed
From-To: feedback->closed

Feedback timeout (> 3 months).