diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-27 22:12:39 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-27 22:12:39 -0400 |
commit | decf491f3076190262d4c649bed877650623903a (patch) | |
tree | 8f67577349fe451b0267b68435db1578ec1273a4 /fs/nfs/inode.c | |
parent | 33801147a8fda6b04d7e9afe1d42f1c01d3d6837 (diff) |
NFS: Don't let nfs_end_data_update() clobber attribute update information
Since we almost always call nfs_end_data_update() after we called
nfs_refresh_inode(), we now end up marking the inode metadata
as needing revalidation immediately after having updated it.
This patch rearranges things so that we mark the inode as needing
revalidation _before_ we call nfs_refresh_inode() on those operations
that need it.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b7d4f8f13ac2..6b3156e15350 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -1236,13 +1236,12 @@ void nfs_end_data_update(struct inode *inode) | |||
1236 | struct nfs_inode *nfsi = NFS_I(inode); | 1236 | struct nfs_inode *nfsi = NFS_I(inode); |
1237 | 1237 | ||
1238 | if (!nfs_have_delegation(inode, FMODE_READ)) { | 1238 | if (!nfs_have_delegation(inode, FMODE_READ)) { |
1239 | /* Mark the attribute cache for revalidation */ | 1239 | /* Directories and symlinks: invalidate page cache */ |
1240 | spin_lock(&inode->i_lock); | 1240 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) { |
1241 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 1241 | spin_lock(&inode->i_lock); |
1242 | /* Directories and symlinks: invalidate page cache too */ | ||
1243 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) | ||
1244 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1242 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
1245 | spin_unlock(&inode->i_lock); | 1243 | spin_unlock(&inode->i_lock); |
1244 | } | ||
1246 | } | 1245 | } |
1247 | nfsi->cache_change_attribute = jiffies; | 1246 | nfsi->cache_change_attribute = jiffies; |
1248 | atomic_dec(&nfsi->data_updates); | 1247 | atomic_dec(&nfsi->data_updates); |
@@ -1360,6 +1359,33 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1360 | return status; | 1359 | return status; |
1361 | } | 1360 | } |
1362 | 1361 | ||
1362 | /** | ||
1363 | * nfs_post_op_update_inode - try to update the inode attribute cache | ||
1364 | * @inode - pointer to inode | ||
1365 | * @fattr - updated attributes | ||
1366 | * | ||
1367 | * After an operation that has changed the inode metadata, mark the | ||
1368 | * attribute cache as being invalid, then try to update it. | ||
1369 | */ | ||
1370 | int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) | ||
1371 | { | ||
1372 | struct nfs_inode *nfsi = NFS_I(inode); | ||
1373 | int status = 0; | ||
1374 | |||
1375 | spin_lock(&inode->i_lock); | ||
1376 | if (unlikely((fattr->valid & NFS_ATTR_FATTR) == 0)) { | ||
1377 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; | ||
1378 | goto out; | ||
1379 | } | ||
1380 | status = nfs_update_inode(inode, fattr, fattr->time_start); | ||
1381 | if (time_after_eq(fattr->time_start, nfsi->cache_change_attribute)) | ||
1382 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME|NFS_INO_REVAL_PAGECACHE); | ||
1383 | nfsi->cache_change_attribute = jiffies; | ||
1384 | out: | ||
1385 | spin_unlock(&inode->i_lock); | ||
1386 | return status; | ||
1387 | } | ||
1388 | |||
1363 | /* | 1389 | /* |
1364 | * Many nfs protocol calls return the new file attributes after | 1390 | * Many nfs protocol calls return the new file attributes after |
1365 | * an operation. Here we update the inode to reflect the state | 1391 | * an operation. Here we update the inode to reflect the state |