Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2002 02:50:16 -0700 (PDT)
From:      Robert Morris <rtm@lcs.mit.edu>
To:        freebsd-bugs@FreeBSD.org
Subject:   kern/37502: NFS client ignores mtime.tv_usec for open/close cache consistency
Message-ID:  <200204290950.g3T9oGZ16515@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/37502; it has been noted by GNATS.

From: Robert Morris <rtm@lcs.mit.edu>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: kern/37502: NFS client ignores mtime.tv_usec for open/close cache consistency
Date: Sat, 27 Apr 2002 04:52:13 -0700 (PDT)

 >Number:         37502
 >Category:       kern
 >Synopsis:       NFS client ignores mtime.tv_usec for open/close cache consistency
 >Confidential:   no
 >Severity:       serious
 >Priority:       medium
 >Responsible:    freebsd-bugs
 >State:          open
 >Quarter:        
 >Keywords:       
 >Date-Required:
 >Class:          sw-bug
 >Submitter-Id:   current-users
 >Arrival-Date:   Sat Apr 27 05:00:02 PDT 2002
 >Closed-Date:
 >Last-Modified:
 >Originator:     Robert Morris
 >Release:        4.5
 >Organization:
 MIT/LCS
 >Environment:
 FreeBSD nephron.lcs.mit.edu 4.5-RELEASE FreeBSD 4.5-RELEASE #3: Thu Apr 11 11:59:46 EDT 2002     rtm@nephron.lcs.mit.edu:/usr/src/sys/compile/PDOS-X23  i386
 >Description:
 When you open a file, the NFS client code doesn't always
 correctly notice whether the file has been changed on the
 server, and thus doesn't always correctly ignore stale
 cached blocks for that file. The NFS client code looks to
 see if the file's mtime has changed, but only checks the
 seconds, not the microseconds. So reading a file that changes twice
 in rapid succession may yield stale data.
 >How-To-Repeat:
 Two clients, X and Y, mount the same NFS file system. Do this
 sequence all within the same second of time:
 
 X% echo 111 > foo
 Y% cat foo
 X% echo 222 > foo
 Y% cat foo
 
 The correct answer is 222, but you will sometimes get 111.
 
 >Fix:
 The following code from nfs_bio.c should check whether the
 mtime microseconds (and perhaps file length) have changed,
 as well as checking the seconds:
 
       		error = VOP_GETATTR(vp, &vattr, cred, td);
 		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, td, 1);
 
 >Release-Note:
 >Audit-Trail:
 >Unformatted:
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204290950.g3T9oGZ16515>