summaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-02-15 02:15:32 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-02-15 02:15:32 +0000
commit86464aed71025541805e7b1515541aee89879e33 (patch)
treee01a457a4912a8553bc65524aa3125d51f29f810 /fs/nfs/inode.c
parent88f99939ecc6a95a79614574cb7d95ffccfc3466 (diff)
Merge with Linux 2.2.1.
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c78
1 files changed, 36 insertions, 42 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index d11c20ab6..72130244a 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -474,7 +474,7 @@ nfs_fhget(struct dentry *dentry, struct nfs_fh *fhandle,
* unhashed inode to avoid aliasing problems.
*/
if ((dentry->d_parent->d_inode->u.nfs_i.flags & NFS_IS_SNAPSHOT) ||
- (IS_ROOT(dentry->d_parent) && dentry->d_name.len == 9 &&
+ (dentry->d_name.len == 9 &&
memcmp(dentry->d_name.name, ".snapshot", 9) == 0)) {
struct inode *inode = get_empty_inode();
if (!inode)
@@ -597,8 +597,10 @@ printk("nfs_notify_change: revalidate failed, error=%d\n", error);
sattr.gid = attr->ia_gid;
sattr.size = (u32) -1;
- if ((attr->ia_valid & ATTR_SIZE) && S_ISREG(inode->i_mode))
+ if ((attr->ia_valid & ATTR_SIZE) && S_ISREG(inode->i_mode)) {
sattr.size = attr->ia_size;
+ nfs_flush_trunc(inode, sattr.size);
+ }
sattr.mtime.seconds = sattr.mtime.useconds = (u32) -1;
if (attr->ia_valid & ATTR_MTIME) {
@@ -624,7 +626,6 @@ printk("nfs_notify_change: revalidate failed, error=%d\n", error);
if (sattr.size != fattr.size)
printk("nfs_notify_change: sattr=%d, fattr=%d??\n",
sattr.size, fattr.size);
- nfs_truncate_dirty_pages(inode, sattr.size);
inode->i_size = sattr.size;
inode->i_mtime = fattr.mtime.seconds;
}
@@ -700,12 +701,6 @@ dentry->d_parent->d_name.name, dentry->d_name.name, inode->i_ino, status);
#endif
goto out;
}
- if (fattr.mtime.seconds == NFS_OLDMTIME(inode)) {
- /* Update attrtimeo value */
- if ((NFS_ATTRTIMEO(inode) <<= 1) > NFS_MAXATTRTIMEO(inode))
- NFS_ATTRTIMEO(inode) = NFS_MAXATTRTIMEO(inode);
- }
- NFS_OLDMTIME(inode) = fattr.mtime.seconds;
dfprintk(PAGECACHE, "NFS: %s/%s revalidation complete\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
out:
@@ -749,54 +744,55 @@ nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT))
goto out_changed;
+ inode->i_mode = fattr->mode;
+ inode->i_nlink = fattr->nlink;
+ inode->i_uid = fattr->uid;
+ inode->i_gid = fattr->gid;
+
+ inode->i_blocks = fattr->blocks;
+ inode->i_atime = fattr->atime.seconds;
+ inode->i_ctime = fattr->ctime.seconds;
+
/*
- * If we have pending write-back entries, we don't want
- * to look at the size the server sends us too closely..
- * In particular, ignore the server if it tells us that
- * the file is smaller or older than we locally think it
- * is..
+ * Update the read time so we don't revalidate too often.
*/
- if (NFS_WRITEBACK(inode)) {
- if (inode->i_size > fattr->size)
- fattr->size = inode->i_size;
- if (inode->i_mtime > fattr->mtime.seconds)
- fattr->mtime.seconds = inode->i_mtime;
- }
+ NFS_READTIME(inode) = jiffies;
+ error = 0;
/*
- * If the size or mtime changed from outside, we want
- * to invalidate the local caches immediately.
+ * If we have pending write-back entries, we don't want
+ * to look at the size or the mtime the server sends us
+ * too closely, as we're in the middle of modifying them.
*/
+ if (NFS_WRITEBACK(inode))
+ goto out;
+
if (inode->i_size != fattr->size) {
#ifdef NFS_DEBUG_VERBOSE
printk("NFS: size change on %x/%ld\n", inode->i_dev, inode->i_ino);
#endif
+ inode->i_size = fattr->size;
invalid = 1;
}
+
if (inode->i_mtime != fattr->mtime.seconds) {
#ifdef NFS_DEBUG_VERBOSE
printk("NFS: mtime change on %x/%ld\n", inode->i_dev, inode->i_ino);
#endif
+ inode->i_mtime = fattr->mtime.seconds;
invalid = 1;
}
- inode->i_mode = fattr->mode;
- inode->i_nlink = fattr->nlink;
- inode->i_uid = fattr->uid;
- inode->i_gid = fattr->gid;
-
- inode->i_size = fattr->size;
- inode->i_blocks = fattr->blocks;
- inode->i_atime = fattr->atime.seconds;
- inode->i_mtime = fattr->mtime.seconds;
- inode->i_ctime = fattr->ctime.seconds;
- /*
- * Update the read time so we don't revalidate too often.
- */
- NFS_READTIME(inode) = jiffies;
- error = 0;
if (invalid)
goto out_invalid;
+
+ /* Update attrtimeo value */
+ if (fattr->mtime.seconds == NFS_OLDMTIME(inode)) {
+ if ((NFS_ATTRTIMEO(inode) <<= 1) > NFS_MAXATTRTIMEO(inode))
+ NFS_ATTRTIMEO(inode) = NFS_MAXATTRTIMEO(inode);
+ }
+ NFS_OLDMTIME(inode) = fattr->mtime.seconds;
+
out:
return error;
@@ -810,6 +806,7 @@ inode->i_ino, inode->i_mode, fattr->mode);
#endif
fattr->mode = inode->i_mode; /* save mode */
make_bad_inode(inode);
+ nfs_inval(inode);
inode->i_mode = fattr->mode; /* restore mode */
/*
* No need to worry about unhashing the dentry, as the
@@ -824,12 +821,9 @@ out_invalid:
#ifdef NFS_DEBUG_VERBOSE
printk("nfs_refresh_inode: invalidating %ld pages\n", inode->i_nrpages);
#endif
- if (!S_ISDIR(inode->i_mode)) {
- /* This sends off all dirty pages off to the server.
- * Note that this function must not sleep. */
- nfs_inval(inode);
+ if (!S_ISDIR(inode->i_mode))
invalidate_inode_pages(inode);
- } else
+ else
nfs_invalidate_dircache(inode);
NFS_CACHEINV(inode);
NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);