Messages in this thread Patch in this message | | | Subject | Re: [PATCH] mtime attribute is not being updated on client | From | Linda Dunaphant <> | Date | Mon, 06 Jun 2005 20:28:27 -0400 |
| |
Trond,
After running for awhile with the mtime related changes that I made to nfs_refresh_inode() on 4/8/05, I noticed that I would sometimes see stale file data on an an NFS client if the file had been updated but it's new filesize was the same as the old filesize. The clients were seeing the correct mtime for the file, but the data was stale.
In my previous change for mtime in nfs_refresh_inode(), the inode was being marked invalid, but the data was not. In the following patch, if the mtime is updated and the data_unstable flag is not true, the inode and the data will both be marked invalid. These changes solved the original mtime issue as well as the stale data problem that I was seeing.
Linda
The following patch is for 2.6.12-rc2:
diff -Nrau base/fs/nfs/inode.c new/fs/nfs/inode.c --- base/fs/nfs/inode.c 2005-04-07 16:04:40.000000000 -0400 +++ new/fs/nfs/inode.c 2005-04-18 21:48:28.000000000 -0400 @@ -1176,9 +1176,17 @@ } /* Verify a few of the more important attributes */ + if (!timespec_equal(&inode->i_mtime, &fattr->mtime)) { + memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime)); +#ifdef NFS_DEBUG_VERBOSE + printk(KERN_DEBUG "NFS: mtime change on %s/%ld\n", inode->i_sb->s_id, inode->i_ino); +#endif + if (!data_unstable) + nfsi->flags |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; + } + if (!data_unstable) { - if (!timespec_equal(&inode->i_mtime, &fattr->mtime) - || cur_size != new_isize) + if (cur_size != new_isize) nfsi->flags |= NFS_INO_INVALID_ATTR; } else if (S_ISREG(inode->i_mode) && new_isize > cur_size) nfsi->flags |= NFS_INO_INVALID_ATTR;
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |