Re: Change in NFS client behavior

From: Rob Sims
Date: Fri Sep 02 2005 - 10:39:33 EST


On Thu, Sep 01, 2005 at 11:43:17PM -0400, Trond Myklebust wrote:
> to den 01.09.2005 Klokka 19:38 (-0400) skreiv Trond Myklebust:
> > This is a consequence of 2.6 NFS clients optimising away unnecessary
> > truncate calls. Whereas this is correct behaviour for truncate(), it
> > appears to be incorrect for open(O_TRUNC).

> > In fact, local filesystems like xfs and ext3 appear to have the opposite
> > problem: they change ctime if you call ftruncate(0) on the zero-length
> > file, as the attached test shows.

The following patch fixes the problem, at least when applied against
2.6.8:

--- inode.c.orig 2005-08-31 16:54:27.000000000 -0600
+++ inode.c 2005-08-31 17:06:52.000000000 -0600
@@ -756,7 +756,7 @@
int error;

if (attr->ia_valid & ATTR_SIZE) {
- if (!S_ISREG(inode->i_mode) || attr->ia_size == i_size_read(inode))
+ if (!S_ISREG(inode->i_mode))
attr->ia_valid &= ~ATTR_SIZE;
}

> Could you please check if the following patch fixes NFS (and also the
> local filesystems) for you?

I'll try the latest in the flood today. Thanks for all the help!
--
Rob
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/