diff options
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 |