diff options
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d349fb2245da..e8c143d182c4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -76,19 +76,14 @@ int nfs_write_inode(struct inode *inode, int sync) | |||
76 | 76 | ||
77 | void nfs_clear_inode(struct inode *inode) | 77 | void nfs_clear_inode(struct inode *inode) |
78 | { | 78 | { |
79 | struct nfs_inode *nfsi = NFS_I(inode); | ||
80 | struct rpc_cred *cred; | ||
81 | |||
82 | /* | 79 | /* |
83 | * The following should never happen... | 80 | * The following should never happen... |
84 | */ | 81 | */ |
85 | BUG_ON(nfs_have_writebacks(inode)); | 82 | BUG_ON(nfs_have_writebacks(inode)); |
86 | BUG_ON (!list_empty(&nfsi->open_files)); | 83 | BUG_ON(!list_empty(&NFS_I(inode)->open_files)); |
84 | BUG_ON(atomic_read(&NFS_I(inode)->data_updates) != 0); | ||
87 | nfs_zap_acl_cache(inode); | 85 | nfs_zap_acl_cache(inode); |
88 | cred = nfsi->cache_access.cred; | 86 | nfs_access_zap_cache(inode); |
89 | if (cred) | ||
90 | put_rpccred(cred); | ||
91 | BUG_ON(atomic_read(&nfsi->data_updates) != 0); | ||
92 | } | 87 | } |
93 | 88 | ||
94 | /** | 89 | /** |
@@ -242,13 +237,13 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
242 | /* Why so? Because we want revalidate for devices/FIFOs, and | 237 | /* Why so? Because we want revalidate for devices/FIFOs, and |
243 | * that's precisely what we have in nfs_file_inode_operations. | 238 | * that's precisely what we have in nfs_file_inode_operations. |
244 | */ | 239 | */ |
245 | inode->i_op = NFS_SB(sb)->rpc_ops->file_inode_ops; | 240 | inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->file_inode_ops; |
246 | if (S_ISREG(inode->i_mode)) { | 241 | if (S_ISREG(inode->i_mode)) { |
247 | inode->i_fop = &nfs_file_operations; | 242 | inode->i_fop = &nfs_file_operations; |
248 | inode->i_data.a_ops = &nfs_file_aops; | 243 | inode->i_data.a_ops = &nfs_file_aops; |
249 | inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info; | 244 | inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info; |
250 | } else if (S_ISDIR(inode->i_mode)) { | 245 | } else if (S_ISDIR(inode->i_mode)) { |
251 | inode->i_op = NFS_SB(sb)->rpc_ops->dir_inode_ops; | 246 | inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops; |
252 | inode->i_fop = &nfs_dir_operations; | 247 | inode->i_fop = &nfs_dir_operations; |
253 | if (nfs_server_capable(inode, NFS_CAP_READDIRPLUS) | 248 | if (nfs_server_capable(inode, NFS_CAP_READDIRPLUS) |
254 | && fattr->size <= NFS_LIMIT_READDIRPLUS) | 249 | && fattr->size <= NFS_LIMIT_READDIRPLUS) |
@@ -290,7 +285,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) | |||
290 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); | 285 | nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); |
291 | nfsi->attrtimeo_timestamp = jiffies; | 286 | nfsi->attrtimeo_timestamp = jiffies; |
292 | memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); | 287 | memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); |
293 | nfsi->cache_access.cred = NULL; | 288 | nfsi->access_cache = RB_ROOT; |
294 | 289 | ||
295 | unlock_new_inode(inode); | 290 | unlock_new_inode(inode); |
296 | } else | 291 | } else |
@@ -722,13 +717,11 @@ void nfs_end_data_update(struct inode *inode) | |||
722 | { | 717 | { |
723 | struct nfs_inode *nfsi = NFS_I(inode); | 718 | struct nfs_inode *nfsi = NFS_I(inode); |
724 | 719 | ||
725 | if (!nfs_have_delegation(inode, FMODE_READ)) { | 720 | /* Directories: invalidate page cache */ |
726 | /* Directories and symlinks: invalidate page cache */ | 721 | if (S_ISDIR(inode->i_mode)) { |
727 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) { | 722 | spin_lock(&inode->i_lock); |
728 | spin_lock(&inode->i_lock); | 723 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
729 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 724 | spin_unlock(&inode->i_lock); |
730 | spin_unlock(&inode->i_lock); | ||
731 | } | ||
732 | } | 725 | } |
733 | nfsi->cache_change_attribute = jiffies; | 726 | nfsi->cache_change_attribute = jiffies; |
734 | atomic_dec(&nfsi->data_updates); | 727 | atomic_dec(&nfsi->data_updates); |
@@ -847,6 +840,12 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
847 | * | 840 | * |
848 | * After an operation that has changed the inode metadata, mark the | 841 | * After an operation that has changed the inode metadata, mark the |
849 | * attribute cache as being invalid, then try to update it. | 842 | * attribute cache as being invalid, then try to update it. |
843 | * | ||
844 | * NB: if the server didn't return any post op attributes, this | ||
845 | * function will force the retrieval of attributes before the next | ||
846 | * NFS request. Thus it should be used only for operations that | ||
847 | * are expected to change one or more attributes, to avoid | ||
848 | * unnecessary NFS requests and trips through nfs_update_inode(). | ||
850 | */ | 849 | */ |
851 | int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) | 850 | int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr) |
852 | { | 851 | { |
@@ -1025,7 +1024,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
1025 | out_fileid: | 1024 | out_fileid: |
1026 | printk(KERN_ERR "NFS: server %s error: fileid changed\n" | 1025 | printk(KERN_ERR "NFS: server %s error: fileid changed\n" |
1027 | "fsid %s: expected fileid 0x%Lx, got 0x%Lx\n", | 1026 | "fsid %s: expected fileid 0x%Lx, got 0x%Lx\n", |
1028 | NFS_SERVER(inode)->hostname, inode->i_sb->s_id, | 1027 | NFS_SERVER(inode)->nfs_client->cl_hostname, inode->i_sb->s_id, |
1029 | (long long)nfsi->fileid, (long long)fattr->fileid); | 1028 | (long long)nfsi->fileid, (long long)fattr->fileid); |
1030 | goto out_err; | 1029 | goto out_err; |
1031 | } | 1030 | } |
@@ -1109,6 +1108,8 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) | |||
1109 | INIT_LIST_HEAD(&nfsi->dirty); | 1108 | INIT_LIST_HEAD(&nfsi->dirty); |
1110 | INIT_LIST_HEAD(&nfsi->commit); | 1109 | INIT_LIST_HEAD(&nfsi->commit); |
1111 | INIT_LIST_HEAD(&nfsi->open_files); | 1110 | INIT_LIST_HEAD(&nfsi->open_files); |
1111 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); | ||
1112 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); | ||
1112 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); | 1113 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); |
1113 | atomic_set(&nfsi->data_updates, 0); | 1114 | atomic_set(&nfsi->data_updates, 0); |
1114 | nfsi->ndirty = 0; | 1115 | nfsi->ndirty = 0; |
@@ -1144,6 +1145,10 @@ static int __init init_nfs_fs(void) | |||
1144 | { | 1145 | { |
1145 | int err; | 1146 | int err; |
1146 | 1147 | ||
1148 | err = nfs_fs_proc_init(); | ||
1149 | if (err) | ||
1150 | goto out5; | ||
1151 | |||
1147 | err = nfs_init_nfspagecache(); | 1152 | err = nfs_init_nfspagecache(); |
1148 | if (err) | 1153 | if (err) |
1149 | goto out4; | 1154 | goto out4; |
@@ -1184,6 +1189,8 @@ out2: | |||
1184 | out3: | 1189 | out3: |
1185 | nfs_destroy_nfspagecache(); | 1190 | nfs_destroy_nfspagecache(); |
1186 | out4: | 1191 | out4: |
1192 | nfs_fs_proc_exit(); | ||
1193 | out5: | ||
1187 | return err; | 1194 | return err; |
1188 | } | 1195 | } |
1189 | 1196 | ||
@@ -1198,6 +1205,7 @@ static void __exit exit_nfs_fs(void) | |||
1198 | rpc_proc_unregister("nfs"); | 1205 | rpc_proc_unregister("nfs"); |
1199 | #endif | 1206 | #endif |
1200 | unregister_nfs_fs(); | 1207 | unregister_nfs_fs(); |
1208 | nfs_fs_proc_exit(); | ||
1201 | } | 1209 | } |
1202 | 1210 | ||
1203 | /* Not quite true; I just maintain it */ | 1211 | /* Not quite true; I just maintain it */ |