Bug 15993

Summary: Invalid stat (ls -l) information on NFS mounted directories
Product: [Retired] Red Hat Linux Reporter: Thor Nolen <nolen>
Component: kernelAssignee: Michael K. Johnson <johnsonm>
Status: CLOSED DEFERRED QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: alan
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard: Winston gold
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-08-19 10:16:57 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Thor Nolen 2000-08-11 10:12:13 EDT
fh_verify (in fs/nfsd/nfsfh.c) uses dentry->inode and its contents
(eg., i_size) without ever calling the fileysstem revalidate op.
The result is bad (out-of-date) stat information).

 Puting the following code into fh_verify avoids this:

      inode = dentry->d_inode;

      /* Before using this inode, it must be revalidated with the
filesystem. */
      if (inode->i_op && inode->i_op->revalidate)
      {
        error = inode->i_op->revalidate(dentry);
        if (error)
          goto out;
     
}
Comment 1 Glen Foster 2000-08-13 15:51:02 EDT
Changing product to Red Hat Linux beta
Comment 2 Glen Foster 2000-08-13 15:51:41 EDT
This defect is considered MUST-FIX for Winston Gold-release
Comment 3 Phil Knirsch 2000-08-18 04:43:55 EDT
I might be wrong, but isn't that a bug that has been hanging around for ages? If
i remember correctly the effect of this bug is that sometimes after saving a
file on a server you have to wait a couple of seconds before these updates are
reflected on the client. Here a small example:
You are working on a package, edit a file directly on a server and recompile it
over NFS. If you start the make very quickly after the save often the saved file
was not recompiled!
So this really should be done. I'm looking into the fix if it is doing the right
thing(tm) and doesn't break anything else.
Comment 4 Phil Knirsch 2000-08-18 06:35:44 EDT
Hmmm. After testing it it doesn't show up that way anymore. It still might be a
good idea to include this patch in the kernel as this would ensure the
revalidation of the inode. It is being used at various other places in the
filesystem tree, so i guess we can safely assume that it will work :)

Can someone put this patch into the kernel source:

--- linux/fs/nfsd/nfsfh.c.orig  Fri Aug 18 12:32:30 2000
+++ linux/fs/nfsd/nfsfh.c       Fri Aug 18 12:32:47 2000
@@ -1195,6 +1195,16 @@
 check_type:
        dentry = fhp->fh_dentry;
        inode = dentry->d_inode;
+
+       /* Before using this inode, it must be revalidated with the
+          filesystem.
+        */
+       if (inode->i_op && inode->i_op->revalidate) {
+               error = inode->i_op->revalidate(dentry);
+               if (error)
+                       goto out;
+       }
+
        error = nfserr_stale;
        /* On a heavily loaded SMP machine, more than one identical
           requests may run at the same time on different processors.

Comment 5 Preston Brown 2000-08-19 10:16:53 EDT
Michael, please take a look at this one.  Doug is ignoring us.
Comment 6 Michael K. Johnson 2000-08-21 16:42:00 EDT
We can't evaluate this change in time, I'm deferring it.
Comment 7 Michael K. Johnson 2000-08-31 18:09:30 EDT
Alan, could you please comment on this one?
Comment 8 Alan Cox 2000-12-28 11:55:03 EST
NFS is not cache coherent. So it was never truely a bug. Its just an
undesirable. 2.2.18 NFS changes should have killed this one off