aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 5c7325c5c5e6..ebeb94ce1b0b 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -107,13 +107,19 @@ u64 nfs_compat_user_ino64(u64 fileid)
107 return ino; 107 return ino;
108} 108}
109 109
110int nfs_drop_inode(struct inode *inode)
111{
112 return NFS_STALE(inode) || generic_drop_inode(inode);
113}
114EXPORT_SYMBOL_GPL(nfs_drop_inode);
115
110void nfs_clear_inode(struct inode *inode) 116void nfs_clear_inode(struct inode *inode)
111{ 117{
112 /* 118 /*
113 * The following should never happen... 119 * The following should never happen...
114 */ 120 */
115 BUG_ON(nfs_have_writebacks(inode)); 121 WARN_ON_ONCE(nfs_have_writebacks(inode));
116 BUG_ON(!list_empty(&NFS_I(inode)->open_files)); 122 WARN_ON_ONCE(!list_empty(&NFS_I(inode)->open_files));
117 nfs_zap_acl_cache(inode); 123 nfs_zap_acl_cache(inode);
118 nfs_access_zap_cache(inode); 124 nfs_access_zap_cache(inode);
119 nfs_fscache_release_inode_cookie(inode); 125 nfs_fscache_release_inode_cookie(inode);
@@ -155,10 +161,12 @@ static void nfs_zap_caches_locked(struct inode *inode)
155 nfsi->attrtimeo_timestamp = jiffies; 161 nfsi->attrtimeo_timestamp = jiffies;
156 162
157 memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf)); 163 memset(NFS_I(inode)->cookieverf, 0, sizeof(NFS_I(inode)->cookieverf));
158 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) 164 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
159 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; 165 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
160 else 166 nfs_fscache_invalidate(inode);
167 } else {
161 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE; 168 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL|NFS_INO_REVAL_PAGECACHE;
169 }
162} 170}
163 171
164void nfs_zap_caches(struct inode *inode) 172void nfs_zap_caches(struct inode *inode)
@@ -173,6 +181,7 @@ void nfs_zap_mapping(struct inode *inode, struct address_space *mapping)
173 if (mapping->nrpages != 0) { 181 if (mapping->nrpages != 0) {
174 spin_lock(&inode->i_lock); 182 spin_lock(&inode->i_lock);
175 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; 183 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
184 nfs_fscache_invalidate(inode);
176 spin_unlock(&inode->i_lock); 185 spin_unlock(&inode->i_lock);
177 } 186 }
178} 187}
@@ -685,7 +694,10 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
685 if (ctx->cred != NULL) 694 if (ctx->cred != NULL)
686 put_rpccred(ctx->cred); 695 put_rpccred(ctx->cred);
687 dput(ctx->dentry); 696 dput(ctx->dentry);
688 nfs_sb_deactive(sb); 697 if (is_sync)
698 nfs_sb_deactive(sb);
699 else
700 nfs_sb_deactive_async(sb);
689 kfree(ctx->mdsthreshold); 701 kfree(ctx->mdsthreshold);
690 kfree(ctx); 702 kfree(ctx);
691} 703}
@@ -872,7 +884,7 @@ static int nfs_invalidate_mapping(struct inode *inode, struct address_space *map
872 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 884 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
873 spin_unlock(&inode->i_lock); 885 spin_unlock(&inode->i_lock);
874 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE); 886 nfs_inc_stats(inode, NFSIOS_DATAINVALIDATE);
875 nfs_fscache_reset_inode_cookie(inode); 887 nfs_fscache_wait_on_invalidate(inode);
876 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n", 888 dfprintk(PAGECACHE, "NFS: (%s/%Ld) data cache invalidated\n",
877 inode->i_sb->s_id, (long long)NFS_FILEID(inode)); 889 inode->i_sb->s_id, (long long)NFS_FILEID(inode));
878 return 0; 890 return 0;
@@ -948,6 +960,10 @@ static unsigned long nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr
948 i_size_write(inode, nfs_size_to_loff_t(fattr->size)); 960 i_size_write(inode, nfs_size_to_loff_t(fattr->size));
949 ret |= NFS_INO_INVALID_ATTR; 961 ret |= NFS_INO_INVALID_ATTR;
950 } 962 }
963
964 if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
965 nfs_fscache_invalidate(inode);
966
951 return ret; 967 return ret;
952} 968}
953 969
@@ -1196,8 +1212,10 @@ static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr
1196 struct nfs_inode *nfsi = NFS_I(inode); 1212 struct nfs_inode *nfsi = NFS_I(inode);
1197 1213
1198 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE; 1214 nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
1199 if (S_ISDIR(inode->i_mode)) 1215 if (S_ISDIR(inode->i_mode)) {
1200 nfsi->cache_validity |= NFS_INO_INVALID_DATA; 1216 nfsi->cache_validity |= NFS_INO_INVALID_DATA;
1217 nfs_fscache_invalidate(inode);
1218 }
1201 if ((fattr->valid & NFS_ATTR_FATTR) == 0) 1219 if ((fattr->valid & NFS_ATTR_FATTR) == 0)
1202 return 0; 1220 return 0;
1203 return nfs_refresh_inode_locked(inode, fattr); 1221 return nfs_refresh_inode_locked(inode, fattr);
@@ -1485,6 +1503,9 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1485 (save_cache_validity & NFS_INO_REVAL_FORCED)) 1503 (save_cache_validity & NFS_INO_REVAL_FORCED))
1486 nfsi->cache_validity |= invalid; 1504 nfsi->cache_validity |= invalid;
1487 1505
1506 if (invalid & NFS_INO_INVALID_DATA)
1507 nfs_fscache_invalidate(inode);
1508
1488 return 0; 1509 return 0;
1489 out_err: 1510 out_err:
1490 /* 1511 /*