From owner-freebsd-bugs Sat Apr 27 5: 0:16 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 7C80837B404 for ; Sat, 27 Apr 2002 05:00:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g3RC02h28749; Sat, 27 Apr 2002 05:00:02 -0700 (PDT) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B29E137B419 for ; Sat, 27 Apr 2002 04:52:13 -0700 (PDT) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g3RBqDm27744; Sat, 27 Apr 2002 04:52:13 -0700 (PDT) (envelope-from nobody) Message-Id: <200204271152.g3RBqDm27744@freefall.freebsd.org> Date: Sat, 27 Apr 2002 04:52:13 -0700 (PDT) From: Robert Morris To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/37502: NFS client ignores mtime.tv_usec for open/close cache consistency Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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