diff options
Diffstat (limited to 'fs/nfs/file.c')
-rw-r--r-- | fs/nfs/file.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 70d124a61b98..b039a17ee941 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -16,6 +16,7 @@ | |||
16 | * nfs regular file handling functions | 16 | * nfs regular file handling functions |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/module.h> | ||
19 | #include <linux/time.h> | 20 | #include <linux/time.h> |
20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
21 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
@@ -52,6 +53,7 @@ int nfs_check_flags(int flags) | |||
52 | 53 | ||
53 | return 0; | 54 | return 0; |
54 | } | 55 | } |
56 | EXPORT_SYMBOL_GPL(nfs_check_flags); | ||
55 | 57 | ||
56 | /* | 58 | /* |
57 | * Open file | 59 | * Open file |
@@ -84,6 +86,7 @@ nfs_file_release(struct inode *inode, struct file *filp) | |||
84 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); | 86 | nfs_inc_stats(inode, NFSIOS_VFSRELEASE); |
85 | return nfs_release(inode, filp); | 87 | return nfs_release(inode, filp); |
86 | } | 88 | } |
89 | EXPORT_SYMBOL_GPL(nfs_file_release); | ||
87 | 90 | ||
88 | /** | 91 | /** |
89 | * nfs_revalidate_size - Revalidate the file size | 92 | * nfs_revalidate_size - Revalidate the file size |
@@ -137,6 +140,7 @@ loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | |||
137 | 140 | ||
138 | return generic_file_llseek(filp, offset, origin); | 141 | return generic_file_llseek(filp, offset, origin); |
139 | } | 142 | } |
143 | EXPORT_SYMBOL_GPL(nfs_file_llseek); | ||
140 | 144 | ||
141 | /* | 145 | /* |
142 | * Flush all dirty pages, and check for write errors. | 146 | * Flush all dirty pages, and check for write errors. |
@@ -165,6 +169,7 @@ nfs_file_flush(struct file *file, fl_owner_t id) | |||
165 | /* Flush writes to the server and return any errors */ | 169 | /* Flush writes to the server and return any errors */ |
166 | return vfs_fsync(file, 0); | 170 | return vfs_fsync(file, 0); |
167 | } | 171 | } |
172 | EXPORT_SYMBOL_GPL(nfs_file_flush); | ||
168 | 173 | ||
169 | ssize_t | 174 | ssize_t |
170 | nfs_file_read(struct kiocb *iocb, const struct iovec *iov, | 175 | nfs_file_read(struct kiocb *iocb, const struct iovec *iov, |
@@ -189,6 +194,7 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov, | |||
189 | } | 194 | } |
190 | return result; | 195 | return result; |
191 | } | 196 | } |
197 | EXPORT_SYMBOL_GPL(nfs_file_read); | ||
192 | 198 | ||
193 | ssize_t | 199 | ssize_t |
194 | nfs_file_splice_read(struct file *filp, loff_t *ppos, | 200 | nfs_file_splice_read(struct file *filp, loff_t *ppos, |
@@ -211,6 +217,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos, | |||
211 | } | 217 | } |
212 | return res; | 218 | return res; |
213 | } | 219 | } |
220 | EXPORT_SYMBOL_GPL(nfs_file_splice_read); | ||
214 | 221 | ||
215 | int | 222 | int |
216 | nfs_file_mmap(struct file * file, struct vm_area_struct * vma) | 223 | nfs_file_mmap(struct file * file, struct vm_area_struct * vma) |
@@ -232,6 +239,7 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma) | |||
232 | } | 239 | } |
233 | return status; | 240 | return status; |
234 | } | 241 | } |
242 | EXPORT_SYMBOL_GPL(nfs_file_mmap); | ||
235 | 243 | ||
236 | /* | 244 | /* |
237 | * Flush any dirty pages for this process, and check for write errors. | 245 | * Flush any dirty pages for this process, and check for write errors. |
@@ -270,6 +278,7 @@ nfs_file_fsync_commit(struct file *file, loff_t start, loff_t end, int datasync) | |||
270 | ret = status; | 278 | ret = status; |
271 | return ret; | 279 | return ret; |
272 | } | 280 | } |
281 | EXPORT_SYMBOL_GPL(nfs_file_fsync_commit); | ||
273 | 282 | ||
274 | static int | 283 | static int |
275 | nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | 284 | nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) |
@@ -447,8 +456,11 @@ static int nfs_release_page(struct page *page, gfp_t gfp) | |||
447 | 456 | ||
448 | dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page); | 457 | dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page); |
449 | 458 | ||
450 | /* Only do I/O if gfp is a superset of GFP_KERNEL */ | 459 | /* Only do I/O if gfp is a superset of GFP_KERNEL, and we're not |
451 | if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL) { | 460 | * doing this memory reclaim for a fs-related allocation. |
461 | */ | ||
462 | if (mapping && (gfp & GFP_KERNEL) == GFP_KERNEL && | ||
463 | !(current->flags & PF_FSTRANS)) { | ||
452 | int how = FLUSH_SYNC; | 464 | int how = FLUSH_SYNC; |
453 | 465 | ||
454 | /* Don't let kswapd deadlock waiting for OOM RPC calls */ | 466 | /* Don't let kswapd deadlock waiting for OOM RPC calls */ |
@@ -611,6 +623,7 @@ out_swapfile: | |||
611 | printk(KERN_INFO "NFS: attempt to write to active swap file!\n"); | 623 | printk(KERN_INFO "NFS: attempt to write to active swap file!\n"); |
612 | goto out; | 624 | goto out; |
613 | } | 625 | } |
626 | EXPORT_SYMBOL_GPL(nfs_file_write); | ||
614 | 627 | ||
615 | ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe, | 628 | ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe, |
616 | struct file *filp, loff_t *ppos, | 629 | struct file *filp, loff_t *ppos, |
@@ -642,6 +655,7 @@ ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe, | |||
642 | nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, written); | 655 | nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, written); |
643 | return ret; | 656 | return ret; |
644 | } | 657 | } |
658 | EXPORT_SYMBOL_GPL(nfs_file_splice_write); | ||
645 | 659 | ||
646 | static int | 660 | static int |
647 | do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) | 661 | do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) |
@@ -802,6 +816,7 @@ int nfs_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
802 | out_err: | 816 | out_err: |
803 | return ret; | 817 | return ret; |
804 | } | 818 | } |
819 | EXPORT_SYMBOL_GPL(nfs_lock); | ||
805 | 820 | ||
806 | /* | 821 | /* |
807 | * Lock a (portion of) a file | 822 | * Lock a (portion of) a file |
@@ -819,6 +834,15 @@ int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) | |||
819 | if (!(fl->fl_flags & FL_FLOCK)) | 834 | if (!(fl->fl_flags & FL_FLOCK)) |
820 | return -ENOLCK; | 835 | return -ENOLCK; |
821 | 836 | ||
837 | /* | ||
838 | * The NFSv4 protocol doesn't support LOCK_MAND, which is not part of | ||
839 | * any standard. In principle we might be able to support LOCK_MAND | ||
840 | * on NFSv2/3 since NLMv3/4 support DOS share modes, but for now the | ||
841 | * NFS code is not set up for it. | ||
842 | */ | ||
843 | if (fl->fl_type & LOCK_MAND) | ||
844 | return -EINVAL; | ||
845 | |||
822 | if (NFS_SERVER(inode)->flags & NFS_MOUNT_LOCAL_FLOCK) | 846 | if (NFS_SERVER(inode)->flags & NFS_MOUNT_LOCAL_FLOCK) |
823 | is_local = 1; | 847 | is_local = 1; |
824 | 848 | ||
@@ -831,6 +855,7 @@ int nfs_flock(struct file *filp, int cmd, struct file_lock *fl) | |||
831 | return do_unlk(filp, cmd, fl, is_local); | 855 | return do_unlk(filp, cmd, fl, is_local); |
832 | return do_setlk(filp, cmd, fl, is_local); | 856 | return do_setlk(filp, cmd, fl, is_local); |
833 | } | 857 | } |
858 | EXPORT_SYMBOL_GPL(nfs_flock); | ||
834 | 859 | ||
835 | /* | 860 | /* |
836 | * There is no protocol support for leases, so we have no way to implement | 861 | * There is no protocol support for leases, so we have no way to implement |
@@ -843,6 +868,7 @@ int nfs_setlease(struct file *file, long arg, struct file_lock **fl) | |||
843 | file->f_path.dentry->d_name.name, arg); | 868 | file->f_path.dentry->d_name.name, arg); |
844 | return -EINVAL; | 869 | return -EINVAL; |
845 | } | 870 | } |
871 | EXPORT_SYMBOL_GPL(nfs_setlease); | ||
846 | 872 | ||
847 | const struct file_operations nfs_file_operations = { | 873 | const struct file_operations nfs_file_operations = { |
848 | .llseek = nfs_file_llseek, | 874 | .llseek = nfs_file_llseek, |
@@ -862,3 +888,4 @@ const struct file_operations nfs_file_operations = { | |||
862 | .check_flags = nfs_check_flags, | 888 | .check_flags = nfs_check_flags, |
863 | .setlease = nfs_setlease, | 889 | .setlease = nfs_setlease, |
864 | }; | 890 | }; |
891 | EXPORT_SYMBOL_GPL(nfs_file_operations); | ||