diff options
-rw-r--r-- | fs/nfs/dir.c | 2 | ||||
-rw-r--r-- | fs/nfs/inode.c | 41 | ||||
-rw-r--r-- | fs/nfs/symlink.c | 2 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 1 |
4 files changed, 3 insertions, 43 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 3c7f03b669fb..a1f6b4438fb1 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -560,7 +560,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
560 | desc->entry = &my_entry; | 560 | desc->entry = &my_entry; |
561 | 561 | ||
562 | nfs_block_sillyrename(dentry); | 562 | nfs_block_sillyrename(dentry); |
563 | res = nfs_revalidate_mapping_nolock(inode, filp->f_mapping); | 563 | res = nfs_revalidate_mapping(inode, filp->f_mapping); |
564 | if (res < 0) | 564 | if (res < 0) |
565 | goto out; | 565 | goto out; |
566 | 566 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index e8b41170d295..dbaaf7d2a188 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -754,7 +754,7 @@ int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
754 | return __nfs_revalidate_inode(server, inode); | 754 | return __nfs_revalidate_inode(server, inode); |
755 | } | 755 | } |
756 | 756 | ||
757 | static int nfs_invalidate_mapping_nolock(struct inode *inode, struct address_space *mapping) | 757 | static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) |
758 | { | 758 | { |
759 | struct nfs_inode *nfsi = NFS_I(inode); | 759 | struct nfs_inode *nfsi = NFS_I(inode); |
760 | 760 | ||
@@ -775,49 +775,10 @@ static int nfs_invalidate_mapping_nolock(struct inode *inode, struct address_spa | |||
775 | return 0; | 775 | return 0; |
776 | } | 776 | } |
777 | 777 | ||
778 | static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) | ||
779 | { | ||
780 | int ret = 0; | ||
781 | |||
782 | mutex_lock(&inode->i_mutex); | ||
783 | if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_DATA) { | ||
784 | ret = nfs_sync_mapping(mapping); | ||
785 | if (ret == 0) | ||
786 | ret = nfs_invalidate_mapping_nolock(inode, mapping); | ||
787 | } | ||
788 | mutex_unlock(&inode->i_mutex); | ||
789 | return ret; | ||
790 | } | ||
791 | |||
792 | /** | ||
793 | * nfs_revalidate_mapping_nolock - Revalidate the pagecache | ||
794 | * @inode - pointer to host inode | ||
795 | * @mapping - pointer to mapping | ||
796 | */ | ||
797 | int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping) | ||
798 | { | ||
799 | struct nfs_inode *nfsi = NFS_I(inode); | ||
800 | int ret = 0; | ||
801 | |||
802 | if ((nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE) | ||
803 | || nfs_attribute_timeout(inode) || NFS_STALE(inode)) { | ||
804 | ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | ||
805 | if (ret < 0) | ||
806 | goto out; | ||
807 | } | ||
808 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) | ||
809 | ret = nfs_invalidate_mapping_nolock(inode, mapping); | ||
810 | out: | ||
811 | return ret; | ||
812 | } | ||
813 | |||
814 | /** | 778 | /** |
815 | * nfs_revalidate_mapping - Revalidate the pagecache | 779 | * nfs_revalidate_mapping - Revalidate the pagecache |
816 | * @inode - pointer to host inode | 780 | * @inode - pointer to host inode |
817 | * @mapping - pointer to mapping | 781 | * @mapping - pointer to mapping |
818 | * | ||
819 | * This version of the function will take the inode->i_mutex and attempt to | ||
820 | * flush out all dirty data if it needs to invalidate the page cache. | ||
821 | */ | 782 | */ |
822 | int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | 783 | int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) |
823 | { | 784 | { |
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 412738dbfbc7..2ea9e5c27e55 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c | |||
@@ -50,7 +50,7 @@ static void *nfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
50 | struct page *page; | 50 | struct page *page; |
51 | void *err; | 51 | void *err; |
52 | 52 | ||
53 | err = ERR_PTR(nfs_revalidate_mapping_nolock(inode, inode->i_mapping)); | 53 | err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping)); |
54 | if (err) | 54 | if (err) |
55 | goto read_failed; | 55 | goto read_failed; |
56 | page = read_cache_page(&inode->i_data, 0, | 56 | page = read_cache_page(&inode->i_data, 0, |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index b789d85bff82..1a0b85aa151e 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -347,7 +347,6 @@ extern int nfs_attribute_timeout(struct inode *inode); | |||
347 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); | 347 | extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); |
348 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); | 348 | extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); |
349 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); | 349 | extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); |
350 | extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); | ||
351 | extern int nfs_setattr(struct dentry *, struct iattr *); | 350 | extern int nfs_setattr(struct dentry *, struct iattr *); |
352 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | 351 | extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); |
353 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 352 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |