aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBryan Schumaker <bjschuma@netapp.com>2012-07-30 16:05:25 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-07-30 19:06:52 -0400
commit89d77c8fa8e6d1cb7e2cce95b428be30ddcc6f23 (patch)
tree37a076ec2675209fd78bc6ac0474dbecee8d11e7 /fs
parent1c606fb74c758beafd98cbad9a9133eadeec2371 (diff)
NFS: Convert v4 into a module
This patch exports symbols needed by the v4 module. In addition, I also switch over to using IS_ENABLED() to check if CONFIG_NFS_V4 or CONFIG_NFS_V4_MODULE are set. The module (nfs4.ko) will be created in the same directory as nfs.ko and will be automatically loaded the first time you try to mount over NFS v4. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/Kconfig2
-rw-r--r--fs/nfs/Makefile19
-rw-r--r--fs/nfs/callback.h2
-rw-r--r--fs/nfs/client.c34
-rw-r--r--fs/nfs/delegation.h2
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/direct.c2
-rw-r--r--fs/nfs/dns_resolve.c4
-rw-r--r--fs/nfs/file.c13
-rw-r--r--fs/nfs/inode.c64
-rw-r--r--fs/nfs/internal.h8
-rw-r--r--fs/nfs/namespace.c2
-rw-r--r--fs/nfs/netns.h2
-rw-r--r--fs/nfs/nfs.h17
-rw-r--r--fs/nfs/nfs4_fs.h5
-rw-r--r--fs/nfs/nfs4super.c9
-rw-r--r--fs/nfs/pagelist.c4
-rw-r--r--fs/nfs/pnfs.c2
-rw-r--r--fs/nfs/read.c4
-rw-r--r--fs/nfs/super.c41
-rw-r--r--fs/nfs/write.c13
21 files changed, 147 insertions, 108 deletions
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index f81a729c00e9..195c1ea6151a 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -72,7 +72,7 @@ config NFS_V3_ACL
72 If unsure, say N. 72 If unsure, say N.
73 73
74config NFS_V4 74config NFS_V4
75 bool "NFS client support for NFS version 4" 75 tristate "NFS client support for NFS version 4"
76 depends on NFS_FS 76 depends on NFS_FS
77 select SUNRPC_GSS 77 select SUNRPC_GSS
78 select KEYS 78 select KEYS
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index 01846edc5c94..8bf3a3f6925a 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -9,17 +9,7 @@ nfs-y := client.o dir.o file.o getroot.o inode.o super.o \
9 write.o namespace.o mount_clnt.o \ 9 write.o namespace.o mount_clnt.o \
10 dns_resolve.o cache_lib.o 10 dns_resolve.o cache_lib.o
11nfs-$(CONFIG_ROOT_NFS) += nfsroot.o 11nfs-$(CONFIG_ROOT_NFS) += nfsroot.o
12nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ 12nfs-$(CONFIG_SYSCTL) += sysctl.o
13 nfs4super.o nfs4file.o delegation.o idmap.o \
14 callback.o callback_xdr.o callback_proc.o \
15 nfs4namespace.o nfs4getroot.o nfs4client.o
16nfs-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o
17
18ifeq ($(CONFIG_SYSCTL), y)
19nfs-y += sysctl.o
20nfs-$(CONFIG_NFS_V4) += nfs4sysctl.o
21endif
22
23nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o 13nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o
24 14
25obj-$(CONFIG_NFS_V2) += nfs2.o 15obj-$(CONFIG_NFS_V2) += nfs2.o
@@ -29,6 +19,13 @@ obj-$(CONFIG_NFS_V3) += nfs3.o
29nfs3-y := nfs3super.o nfs3client.o nfs3proc.o nfs3xdr.o 19nfs3-y := nfs3super.o nfs3client.o nfs3proc.o nfs3xdr.o
30nfs3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o 20nfs3-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
31 21
22obj-$(CONFIG_NFS_V4) += nfs4.o
23nfs4-y := nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o nfs4super.o nfs4file.o \
24 delegation.o idmap.o callback.o callback_xdr.o callback_proc.o \
25 nfs4namespace.o nfs4getroot.o nfs4client.o
26nfs4-$(CONFIG_SYSCTL) += nfs4sysctl.o
27nfs4-$(CONFIG_NFS_V4_1) += pnfs.o pnfs_dev.o
28
32obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o 29obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o
33nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o 30nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
34 31
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index a5527c90a5aa..b44d7b128b71 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -192,7 +192,7 @@ extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args,
192 struct cb_process_state *cps); 192 struct cb_process_state *cps);
193extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy, 193extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy,
194 struct cb_process_state *cps); 194 struct cb_process_state *cps);
195#ifdef CONFIG_NFS_V4 195#if IS_ENABLED(CONFIG_NFS_V4)
196extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt); 196extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
197extern void nfs_callback_down(int minorversion); 197extern void nfs_callback_down(int minorversion);
198extern int nfs4_validate_delegation_stateid(struct nfs_delegation *delegation, 198extern int nfs4_validate_delegation_stateid(struct nfs_delegation *delegation,
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 8687b6b6edc1..9fc0d9dfc91b 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -143,24 +143,6 @@ void unregister_nfs_version(struct nfs_subversion *nfs)
143EXPORT_SYMBOL_GPL(unregister_nfs_version); 143EXPORT_SYMBOL_GPL(unregister_nfs_version);
144 144
145/* 145/*
146 * Preload all configured NFS versions during module init.
147 * This function should be edited after each protocol is converted,
148 * and eventually removed.
149 */
150int __init nfs_register_versions(void)
151{
152 return init_nfs_v4();
153}
154
155/*
156 * Remove each pre-loaded NFS version
157 */
158void nfs_unregister_versions(void)
159{
160 exit_nfs_v4();
161}
162
163/*
164 * Allocate a shared client record 146 * Allocate a shared client record
165 * 147 *
166 * Since these are allocated/deallocated very rarely, we don't 148 * Since these are allocated/deallocated very rarely, we don't
@@ -214,7 +196,7 @@ error_0:
214} 196}
215EXPORT_SYMBOL_GPL(nfs_alloc_client); 197EXPORT_SYMBOL_GPL(nfs_alloc_client);
216 198
217#ifdef CONFIG_NFS_V4 199#if IS_ENABLED(CONFIG_NFS_V4)
218/* idr_remove_all is not needed as all id's are removed by nfs_put_client */ 200/* idr_remove_all is not needed as all id's are removed by nfs_put_client */
219void nfs_cleanup_cb_ident_idr(struct net *net) 201void nfs_cleanup_cb_ident_idr(struct net *net)
220{ 202{
@@ -390,6 +372,7 @@ int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
390 } 372 }
391 return 0; 373 return 0;
392} 374}
375EXPORT_SYMBOL_GPL(nfs_sockaddr_match_ipaddr);
393#endif /* CONFIG_NFS_V4_1 */ 376#endif /* CONFIG_NFS_V4_1 */
394 377
395/* 378/*
@@ -456,6 +439,7 @@ int nfs_wait_client_init_complete(const struct nfs_client *clp)
456 return wait_event_killable(nfs_client_active_wq, 439 return wait_event_killable(nfs_client_active_wq,
457 nfs_client_init_is_complete(clp)); 440 nfs_client_init_is_complete(clp));
458} 441}
442EXPORT_SYMBOL_GPL(nfs_wait_client_init_complete);
459 443
460/* 444/*
461 * Found an existing client. Make sure it's ready before returning. 445 * Found an existing client. Make sure it's ready before returning.
@@ -530,6 +514,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init,
530 cl_init->hostname ?: "", PTR_ERR(new)); 514 cl_init->hostname ?: "", PTR_ERR(new));
531 return new; 515 return new;
532} 516}
517EXPORT_SYMBOL_GPL(nfs_get_client);
533 518
534/* 519/*
535 * Mark a server as ready or failed 520 * Mark a server as ready or failed
@@ -540,6 +525,7 @@ void nfs_mark_client_ready(struct nfs_client *clp, int state)
540 clp->cl_cons_state = state; 525 clp->cl_cons_state = state;
541 wake_up_all(&nfs_client_active_wq); 526 wake_up_all(&nfs_client_active_wq);
542} 527}
528EXPORT_SYMBOL_GPL(nfs_mark_client_ready);
543 529
544/* 530/*
545 * Initialise the timeout values for a connection 531 * Initialise the timeout values for a connection
@@ -581,6 +567,7 @@ void nfs_init_timeout_values(struct rpc_timeout *to, int proto,
581 BUG(); 567 BUG();
582 } 568 }
583} 569}
570EXPORT_SYMBOL_GPL(nfs_init_timeout_values);
584 571
585/* 572/*
586 * Create an RPC client handle 573 * Create an RPC client handle
@@ -620,6 +607,7 @@ int nfs_create_rpc_client(struct nfs_client *clp,
620 clp->cl_rpcclient = clnt; 607 clp->cl_rpcclient = clnt;
621 return 0; 608 return 0;
622} 609}
610EXPORT_SYMBOL_GPL(nfs_create_rpc_client);
623 611
624/* 612/*
625 * Version 2 or 3 client destruction 613 * Version 2 or 3 client destruction
@@ -706,6 +694,7 @@ int nfs_init_server_rpcclient(struct nfs_server *server,
706 694
707 return 0; 695 return 0;
708} 696}
697EXPORT_SYMBOL_GPL(nfs_init_server_rpcclient);
709 698
710/** 699/**
711 * nfs_init_client - Initialise an NFS2 or NFS3 client 700 * nfs_init_client - Initialise an NFS2 or NFS3 client
@@ -932,6 +921,7 @@ out_error:
932 dprintk("nfs_probe_fsinfo: error = %d\n", -error); 921 dprintk("nfs_probe_fsinfo: error = %d\n", -error);
933 return error; 922 return error;
934} 923}
924EXPORT_SYMBOL_GPL(nfs_probe_fsinfo);
935 925
936/* 926/*
937 * Copy useful information when duplicating a server record 927 * Copy useful information when duplicating a server record
@@ -948,6 +938,7 @@ void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *sour
948 target->caps = source->caps; 938 target->caps = source->caps;
949 target->options = source->options; 939 target->options = source->options;
950} 940}
941EXPORT_SYMBOL_GPL(nfs_server_copy_userdata);
951 942
952void nfs_server_insert_lists(struct nfs_server *server) 943void nfs_server_insert_lists(struct nfs_server *server)
953{ 944{
@@ -961,6 +952,7 @@ void nfs_server_insert_lists(struct nfs_server *server)
961 spin_unlock(&nn->nfs_client_lock); 952 spin_unlock(&nn->nfs_client_lock);
962 953
963} 954}
955EXPORT_SYMBOL_GPL(nfs_server_insert_lists);
964 956
965static void nfs_server_remove_lists(struct nfs_server *server) 957static void nfs_server_remove_lists(struct nfs_server *server)
966{ 958{
@@ -1020,6 +1012,7 @@ struct nfs_server *nfs_alloc_server(void)
1020 1012
1021 return server; 1013 return server;
1022} 1014}
1015EXPORT_SYMBOL_GPL(nfs_alloc_server);
1023 1016
1024/* 1017/*
1025 * Free up a server record 1018 * Free up a server record
@@ -1048,6 +1041,7 @@ void nfs_free_server(struct nfs_server *server)
1048 nfs_release_automount_timer(); 1041 nfs_release_automount_timer();
1049 dprintk("<-- nfs_free_server()\n"); 1042 dprintk("<-- nfs_free_server()\n");
1050} 1043}
1044EXPORT_SYMBOL_GPL(nfs_free_server);
1051 1045
1052/* 1046/*
1053 * Create a version 2 or 3 volume record 1047 * Create a version 2 or 3 volume record
@@ -1193,7 +1187,7 @@ void nfs_clients_init(struct net *net)
1193 1187
1194 INIT_LIST_HEAD(&nn->nfs_client_list); 1188 INIT_LIST_HEAD(&nn->nfs_client_list);
1195 INIT_LIST_HEAD(&nn->nfs_volume_list); 1189 INIT_LIST_HEAD(&nn->nfs_volume_list);
1196#ifdef CONFIG_NFS_V4 1190#if IS_ENABLED(CONFIG_NFS_V4)
1197 idr_init(&nn->cb_ident_idr); 1191 idr_init(&nn->cb_ident_idr);
1198#endif 1192#endif
1199 spin_lock_init(&nn->nfs_client_lock); 1193 spin_lock_init(&nn->nfs_client_lock);
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index 1f3ccd934635..bbc6a4dba0d8 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -8,7 +8,7 @@
8#ifndef FS_NFS_DELEGATION_H 8#ifndef FS_NFS_DELEGATION_H
9#define FS_NFS_DELEGATION_H 9#define FS_NFS_DELEGATION_H
10 10
11#if defined(CONFIG_NFS_V4) 11#if IS_ENABLED(CONFIG_NFS_V4)
12/* 12/*
13 * NFSv4 delegation 13 * NFSv4 delegation
14 */ 14 */
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 55438c970cbf..627f108ede23 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -936,6 +936,7 @@ void nfs_force_lookup_revalidate(struct inode *dir)
936{ 936{
937 NFS_I(dir)->cache_change_attribute++; 937 NFS_I(dir)->cache_change_attribute++;
938} 938}
939EXPORT_SYMBOL_GPL(nfs_force_lookup_revalidate);
939 940
940/* 941/*
941 * A check for whether or not the parent directory has changed. 942 * A check for whether or not the parent directory has changed.
@@ -1267,7 +1268,7 @@ out:
1267} 1268}
1268EXPORT_SYMBOL_GPL(nfs_lookup); 1269EXPORT_SYMBOL_GPL(nfs_lookup);
1269 1270
1270#ifdef CONFIG_NFS_V4 1271#if IS_ENABLED(CONFIG_NFS_V4)
1271static int nfs4_lookup_revalidate(struct dentry *, unsigned int); 1272static int nfs4_lookup_revalidate(struct dentry *, unsigned int);
1272 1273
1273const struct dentry_operations nfs4_dentry_operations = { 1274const struct dentry_operations nfs4_dentry_operations = {
@@ -1277,6 +1278,7 @@ const struct dentry_operations nfs4_dentry_operations = {
1277 .d_automount = nfs_d_automount, 1278 .d_automount = nfs_d_automount,
1278 .d_release = nfs_d_release, 1279 .d_release = nfs_d_release,
1279}; 1280};
1281EXPORT_SYMBOL_GPL(nfs4_dentry_operations);
1280 1282
1281static fmode_t flags_to_mode(int flags) 1283static fmode_t flags_to_mode(int flags)
1282{ 1284{
@@ -1419,6 +1421,7 @@ no_open:
1419 1421
1420 return finish_no_open(file, res); 1422 return finish_no_open(file, res);
1421} 1423}
1424EXPORT_SYMBOL_GPL(nfs_atomic_open);
1422 1425
1423static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags) 1426static int nfs4_lookup_revalidate(struct dentry *dentry, unsigned int flags)
1424{ 1427{
@@ -2142,6 +2145,7 @@ int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags)
2142{ 2145{
2143 return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags)); 2146 return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags));
2144} 2147}
2148EXPORT_SYMBOL_GPL(nfs_may_open);
2145 2149
2146int nfs_permission(struct inode *inode, int mask) 2150int nfs_permission(struct inode *inode, int mask)
2147{ 2151{
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 899238156b11..b7b4f80968b5 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -460,7 +460,7 @@ static void nfs_inode_dio_write_done(struct inode *inode)
460 inode_dio_done(inode); 460 inode_dio_done(inode);
461} 461}
462 462
463#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 463#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
464static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) 464static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
465{ 465{
466 struct nfs_pageio_descriptor desc; 466 struct nfs_pageio_descriptor desc;
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index b3924b8a6000..31c26c4dcc23 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -8,6 +8,7 @@
8 8
9#ifdef CONFIG_NFS_USE_KERNEL_DNS 9#ifdef CONFIG_NFS_USE_KERNEL_DNS
10 10
11#include <linux/module.h>
11#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/clnt.h>
12#include <linux/dns_resolver.h> 13#include <linux/dns_resolver.h>
13#include "dns_resolve.h" 14#include "dns_resolve.h"
@@ -27,9 +28,11 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
27 kfree(ip_addr); 28 kfree(ip_addr);
28 return ret; 29 return ret;
29} 30}
31EXPORT_SYMBOL_GPL(nfs_dns_resolve_name);
30 32
31#else 33#else
32 34
35#include <linux/module.h>
33#include <linux/hash.h> 36#include <linux/hash.h>
34#include <linux/string.h> 37#include <linux/string.h>
35#include <linux/kmod.h> 38#include <linux/kmod.h>
@@ -345,6 +348,7 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name,
345 ret = -ESRCH; 348 ret = -ESRCH;
346 return ret; 349 return ret;
347} 350}
351EXPORT_SYMBOL_GPL(nfs_dns_resolve_name);
348 352
349int nfs_dns_resolver_cache_init(struct net *net) 353int nfs_dns_resolver_cache_init(struct net *net)
350{ 354{
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 5b3e70389553..1557978ca7b3 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -53,6 +53,7 @@ int nfs_check_flags(int flags)
53 53
54 return 0; 54 return 0;
55} 55}
56EXPORT_SYMBOL_GPL(nfs_check_flags);
56 57
57/* 58/*
58 * Open file 59 * Open file
@@ -85,6 +86,7 @@ nfs_file_release(struct inode *inode, struct file *filp)
85 nfs_inc_stats(inode, NFSIOS_VFSRELEASE); 86 nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
86 return nfs_release(inode, filp); 87 return nfs_release(inode, filp);
87} 88}
89EXPORT_SYMBOL_GPL(nfs_file_release);
88 90
89/** 91/**
90 * nfs_revalidate_size - Revalidate the file size 92 * nfs_revalidate_size - Revalidate the file size
@@ -138,6 +140,7 @@ loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
138 140
139 return generic_file_llseek(filp, offset, origin); 141 return generic_file_llseek(filp, offset, origin);
140} 142}
143EXPORT_SYMBOL_GPL(nfs_file_llseek);
141 144
142/* 145/*
143 * Flush all dirty pages, and check for write errors. 146 * Flush all dirty pages, and check for write errors.
@@ -166,6 +169,7 @@ nfs_file_flush(struct file *file, fl_owner_t id)
166 /* Flush writes to the server and return any errors */ 169 /* Flush writes to the server and return any errors */
167 return vfs_fsync(file, 0); 170 return vfs_fsync(file, 0);
168} 171}
172EXPORT_SYMBOL_GPL(nfs_file_flush);
169 173
170ssize_t 174ssize_t
171nfs_file_read(struct kiocb *iocb, const struct iovec *iov, 175nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
@@ -190,6 +194,7 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
190 } 194 }
191 return result; 195 return result;
192} 196}
197EXPORT_SYMBOL_GPL(nfs_file_read);
193 198
194ssize_t 199ssize_t
195nfs_file_splice_read(struct file *filp, loff_t *ppos, 200nfs_file_splice_read(struct file *filp, loff_t *ppos,
@@ -212,6 +217,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
212 } 217 }
213 return res; 218 return res;
214} 219}
220EXPORT_SYMBOL_GPL(nfs_file_splice_read);
215 221
216int 222int
217nfs_file_mmap(struct file * file, struct vm_area_struct * vma) 223nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
@@ -233,6 +239,7 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
233 } 239 }
234 return status; 240 return status;
235} 241}
242EXPORT_SYMBOL_GPL(nfs_file_mmap);
236 243
237/* 244/*
238 * 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.
@@ -271,6 +278,7 @@ nfs_file_fsync_commit(struct file *file, loff_t start, loff_t end, int datasync)
271 ret = status; 278 ret = status;
272 return ret; 279 return ret;
273} 280}
281EXPORT_SYMBOL_GPL(nfs_file_fsync_commit);
274 282
275static int 283static int
276nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) 284nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
@@ -615,6 +623,7 @@ out_swapfile:
615 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");
616 goto out; 624 goto out;
617} 625}
626EXPORT_SYMBOL_GPL(nfs_file_write);
618 627
619ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe, 628ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe,
620 struct file *filp, loff_t *ppos, 629 struct file *filp, loff_t *ppos,
@@ -646,6 +655,7 @@ ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe,
646 nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, written); 655 nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, written);
647 return ret; 656 return ret;
648} 657}
658EXPORT_SYMBOL_GPL(nfs_file_splice_write);
649 659
650static int 660static int
651do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) 661do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local)
@@ -806,6 +816,7 @@ int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
806out_err: 816out_err:
807 return ret; 817 return ret;
808} 818}
819EXPORT_SYMBOL_GPL(nfs_lock);
809 820
810/* 821/*
811 * Lock a (portion of) a file 822 * Lock a (portion of) a file
@@ -835,6 +846,7 @@ int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
835 return do_unlk(filp, cmd, fl, is_local); 846 return do_unlk(filp, cmd, fl, is_local);
836 return do_setlk(filp, cmd, fl, is_local); 847 return do_setlk(filp, cmd, fl, is_local);
837} 848}
849EXPORT_SYMBOL_GPL(nfs_flock);
838 850
839/* 851/*
840 * There is no protocol support for leases, so we have no way to implement 852 * There is no protocol support for leases, so we have no way to implement
@@ -847,6 +859,7 @@ int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
847 file->f_path.dentry->d_name.name, arg); 859 file->f_path.dentry->d_name.name, arg);
848 return -EINVAL; 860 return -EINVAL;
849} 861}
862EXPORT_SYMBOL_GPL(nfs_setlease);
850 863
851const struct file_operations nfs_file_operations = { 864const struct file_operations nfs_file_operations = {
852 .llseek = nfs_file_llseek, 865 .llseek = nfs_file_llseek,
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 78dfc3e895ec..2ed6138f32ad 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -82,6 +82,7 @@ int nfs_wait_bit_killable(void *word)
82 freezable_schedule(); 82 freezable_schedule();
83 return 0; 83 return 0;
84} 84}
85EXPORT_SYMBOL_GPL(nfs_wait_bit_killable);
85 86
86/** 87/**
87 * nfs_compat_user_ino64 - returns the user-visible inode number 88 * nfs_compat_user_ino64 - returns the user-visible inode number
@@ -117,6 +118,7 @@ void nfs_clear_inode(struct inode *inode)
117 nfs_access_zap_cache(inode); 118 nfs_access_zap_cache(inode);
118 nfs_fscache_release_inode_cookie(inode); 119 nfs_fscache_release_inode_cookie(inode);
119} 120}
121EXPORT_SYMBOL_GPL(nfs_clear_inode);
120 122
121void nfs_evict_inode(struct inode *inode) 123void nfs_evict_inode(struct inode *inode)
122{ 124{
@@ -393,6 +395,7 @@ out_no_inode:
393 dprintk("nfs_fhget: iget failed with error %ld\n", PTR_ERR(inode)); 395 dprintk("nfs_fhget: iget failed with error %ld\n", PTR_ERR(inode));
394 goto out; 396 goto out;
395} 397}
398EXPORT_SYMBOL_GPL(nfs_fhget);
396 399
397#define NFS_VALID_ATTRS (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|ATTR_ATIME|ATTR_ATIME_SET|ATTR_MTIME|ATTR_MTIME_SET|ATTR_FILE|ATTR_OPEN) 400#define NFS_VALID_ATTRS (ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|ATTR_ATIME|ATTR_ATIME_SET|ATTR_MTIME|ATTR_MTIME_SET|ATTR_FILE|ATTR_OPEN)
398 401
@@ -655,6 +658,7 @@ struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f
655 ctx->mdsthreshold = NULL; 658 ctx->mdsthreshold = NULL;
656 return ctx; 659 return ctx;
657} 660}
661EXPORT_SYMBOL_GPL(alloc_nfs_open_context);
658 662
659struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx) 663struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
660{ 664{
@@ -662,6 +666,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
662 atomic_inc(&ctx->lock_context.count); 666 atomic_inc(&ctx->lock_context.count);
663 return ctx; 667 return ctx;
664} 668}
669EXPORT_SYMBOL_GPL(get_nfs_open_context);
665 670
666static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) 671static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)
667{ 672{
@@ -689,6 +694,7 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
689{ 694{
690 __put_nfs_open_context(ctx, 0); 695 __put_nfs_open_context(ctx, 0);
691} 696}
697EXPORT_SYMBOL_GPL(put_nfs_open_context);
692 698
693/* 699/*
694 * Ensure that mmap has a recent RPC credential for use when writing out 700 * Ensure that mmap has a recent RPC credential for use when writing out
@@ -704,6 +710,7 @@ void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
704 list_add(&ctx->list, &nfsi->open_files); 710 list_add(&ctx->list, &nfsi->open_files);
705 spin_unlock(&inode->i_lock); 711 spin_unlock(&inode->i_lock);
706} 712}
713EXPORT_SYMBOL_GPL(nfs_file_set_open_context);
707 714
708/* 715/*
709 * Given an inode, search for an open context with the desired characteristics 716 * Given an inode, search for an open context with the desired characteristics
@@ -1497,11 +1504,12 @@ struct inode *nfs_alloc_inode(struct super_block *sb)
1497 nfsi->acl_access = ERR_PTR(-EAGAIN); 1504 nfsi->acl_access = ERR_PTR(-EAGAIN);
1498 nfsi->acl_default = ERR_PTR(-EAGAIN); 1505 nfsi->acl_default = ERR_PTR(-EAGAIN);
1499#endif 1506#endif
1500#ifdef CONFIG_NFS_V4 1507#if IS_ENABLED(CONFIG_NFS_V4)
1501 nfsi->nfs4_acl = NULL; 1508 nfsi->nfs4_acl = NULL;
1502#endif /* CONFIG_NFS_V4 */ 1509#endif /* CONFIG_NFS_V4 */
1503 return &nfsi->vfs_inode; 1510 return &nfsi->vfs_inode;
1504} 1511}
1512EXPORT_SYMBOL_GPL(nfs_alloc_inode);
1505 1513
1506static void nfs_i_callback(struct rcu_head *head) 1514static void nfs_i_callback(struct rcu_head *head)
1507{ 1515{
@@ -1513,10 +1521,11 @@ void nfs_destroy_inode(struct inode *inode)
1513{ 1521{
1514 call_rcu(&inode->i_rcu, nfs_i_callback); 1522 call_rcu(&inode->i_rcu, nfs_i_callback);
1515} 1523}
1524EXPORT_SYMBOL_GPL(nfs_destroy_inode);
1516 1525
1517static inline void nfs4_init_once(struct nfs_inode *nfsi) 1526static inline void nfs4_init_once(struct nfs_inode *nfsi)
1518{ 1527{
1519#ifdef CONFIG_NFS_V4 1528#if IS_ENABLED(CONFIG_NFS_V4)
1520 INIT_LIST_HEAD(&nfsi->open_states); 1529 INIT_LIST_HEAD(&nfsi->open_states);
1521 nfsi->delegation = NULL; 1530 nfsi->delegation = NULL;
1522 nfsi->delegation_state = 0; 1531 nfsi->delegation_state = 0;
@@ -1562,6 +1571,7 @@ static void nfs_destroy_inodecache(void)
1562} 1571}
1563 1572
1564struct workqueue_struct *nfsiod_workqueue; 1573struct workqueue_struct *nfsiod_workqueue;
1574EXPORT_SYMBOL_GPL(nfsiod_workqueue);
1565 1575
1566/* 1576/*
1567 * start up the nfsiod workqueue 1577 * start up the nfsiod workqueue
@@ -1622,90 +1632,80 @@ static int __init init_nfs_fs(void)
1622 1632
1623 err = nfs_dns_resolver_init(); 1633 err = nfs_dns_resolver_init();
1624 if (err < 0) 1634 if (err < 0)
1625 goto out11; 1635 goto out10;;
1626 1636
1627 err = register_pernet_subsys(&nfs_net_ops); 1637 err = register_pernet_subsys(&nfs_net_ops);
1628 if (err < 0) 1638 if (err < 0)
1629 goto out10; 1639 goto out9;
1630 1640
1631 err = nfs_fscache_register(); 1641 err = nfs_fscache_register();
1632 if (err < 0) 1642 if (err < 0)
1633 goto out9; 1643 goto out8;
1634 1644
1635 err = nfsiod_start(); 1645 err = nfsiod_start();
1636 if (err) 1646 if (err)
1637 goto out8; 1647 goto out7;
1638 1648
1639 err = nfs_fs_proc_init(); 1649 err = nfs_fs_proc_init();
1640 if (err) 1650 if (err)
1641 goto out7; 1651 goto out6;
1642 1652
1643 err = nfs_init_nfspagecache(); 1653 err = nfs_init_nfspagecache();
1644 if (err) 1654 if (err)
1645 goto out6; 1655 goto out5;
1646 1656
1647 err = nfs_init_inodecache(); 1657 err = nfs_init_inodecache();
1648 if (err) 1658 if (err)
1649 goto out5; 1659 goto out4;
1650 1660
1651 err = nfs_init_readpagecache(); 1661 err = nfs_init_readpagecache();
1652 if (err) 1662 if (err)
1653 goto out4; 1663 goto out3;
1654 1664
1655 err = nfs_init_writepagecache(); 1665 err = nfs_init_writepagecache();
1656 if (err) 1666 if (err)
1657 goto out3; 1667 goto out2;
1658 1668
1659 err = nfs_init_directcache(); 1669 err = nfs_init_directcache();
1660 if (err) 1670 if (err)
1661 goto out2; 1671 goto out1;
1662 1672
1663#ifdef CONFIG_PROC_FS 1673#ifdef CONFIG_PROC_FS
1664 rpc_proc_register(&init_net, &nfs_rpcstat); 1674 rpc_proc_register(&init_net, &nfs_rpcstat);
1665#endif 1675#endif
1666
1667 err = nfs_register_versions();
1668 if (err)
1669 goto out1;
1670
1671 if ((err = register_nfs_fs()) != 0) 1676 if ((err = register_nfs_fs()) != 0)
1672 goto out0; 1677 goto out0;
1673 1678
1674 return 0; 1679 return 0;
1675out0: 1680out0:
1676 nfs_unregister_versions();
1677out1:
1678#ifdef CONFIG_PROC_FS 1681#ifdef CONFIG_PROC_FS
1679 rpc_proc_unregister(&init_net, "nfs"); 1682 rpc_proc_unregister(&init_net, "nfs");
1680#endif 1683#endif
1681 nfs_destroy_directcache(); 1684 nfs_destroy_directcache();
1682out2: 1685out1:
1683 nfs_destroy_writepagecache(); 1686 nfs_destroy_writepagecache();
1684out3: 1687out2:
1685 nfs_destroy_readpagecache(); 1688 nfs_destroy_readpagecache();
1686out4: 1689out3:
1687 nfs_destroy_inodecache(); 1690 nfs_destroy_inodecache();
1688out5: 1691out4:
1689 nfs_destroy_nfspagecache(); 1692 nfs_destroy_nfspagecache();
1690out6: 1693out5:
1691 nfs_fs_proc_exit(); 1694 nfs_fs_proc_exit();
1692out7: 1695out6:
1693 nfsiod_stop(); 1696 nfsiod_stop();
1694out8: 1697out7:
1695 nfs_fscache_unregister(); 1698 nfs_fscache_unregister();
1696out9: 1699out8:
1697 unregister_pernet_subsys(&nfs_net_ops); 1700 unregister_pernet_subsys(&nfs_net_ops);
1698out10: 1701out9:
1699 nfs_dns_resolver_destroy(); 1702 nfs_dns_resolver_destroy();
1700out11: 1703out10:
1701 return err; 1704 return err;
1702} 1705}
1703 1706
1704static void __exit exit_nfs_fs(void) 1707static void __exit exit_nfs_fs(void)
1705{ 1708{
1706#ifdef CONFIG_NFS_V4
1707 exit_nfs_v4();
1708#endif
1709 nfs_destroy_directcache(); 1709 nfs_destroy_directcache();
1710 nfs_destroy_writepagecache(); 1710 nfs_destroy_writepagecache();
1711 nfs_destroy_readpagecache(); 1711 nfs_destroy_readpagecache();
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 64f0dc41a9b7..8865538b26b6 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -262,7 +262,7 @@ extern int nfs3_decode_dirent(struct xdr_stream *,
262 struct nfs_entry *, int); 262 struct nfs_entry *, int);
263 263
264/* nfs4xdr.c */ 264/* nfs4xdr.c */
265#ifdef CONFIG_NFS_V4 265#if IS_ENABLED(CONFIG_NFS_V4)
266extern int nfs4_decode_dirent(struct xdr_stream *, 266extern int nfs4_decode_dirent(struct xdr_stream *,
267 struct nfs_entry *, int); 267 struct nfs_entry *, int);
268#endif 268#endif
@@ -272,7 +272,7 @@ extern const u32 nfs41_maxwrite_overhead;
272#endif 272#endif
273 273
274/* nfs4proc.c */ 274/* nfs4proc.c */
275#ifdef CONFIG_NFS_V4 275#if IS_ENABLED(CONFIG_NFS_V4)
276extern struct rpc_procinfo nfs4_procedures[]; 276extern struct rpc_procinfo nfs4_procedures[];
277#endif 277#endif
278 278
@@ -328,7 +328,7 @@ extern int nfs_wait_bit_killable(void *word);
328extern const struct super_operations nfs_sops; 328extern const struct super_operations nfs_sops;
329extern struct file_system_type nfs_fs_type; 329extern struct file_system_type nfs_fs_type;
330extern struct file_system_type nfs_xdev_fs_type; 330extern struct file_system_type nfs_xdev_fs_type;
331#ifdef CONFIG_NFS_V4 331#if IS_ENABLED(CONFIG_NFS_V4)
332extern struct file_system_type nfs4_xdev_fs_type; 332extern struct file_system_type nfs4_xdev_fs_type;
333extern struct file_system_type nfs4_referral_fs_type; 333extern struct file_system_type nfs4_referral_fs_type;
334#endif 334#endif
@@ -364,7 +364,7 @@ struct vfsmount *nfs_do_submount(struct dentry *, struct nfs_fh *,
364/* getroot.c */ 364/* getroot.c */
365extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *, 365extern struct dentry *nfs_get_root(struct super_block *, struct nfs_fh *,
366 const char *); 366 const char *);
367#ifdef CONFIG_NFS_V4 367#if IS_ENABLED(CONFIG_NFS_V4)
368extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *, 368extern struct dentry *nfs4_get_root(struct super_block *, struct nfs_fh *,
369 const char *); 369 const char *);
370 370
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 2a3b170e88e0..655925373b91 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -113,6 +113,7 @@ Elong_unlock:
113Elong: 113Elong:
114 return ERR_PTR(-ENAMETOOLONG); 114 return ERR_PTR(-ENAMETOOLONG);
115} 115}
116EXPORT_SYMBOL_GPL(nfs_path);
116 117
117/* 118/*
118 * nfs_d_automount - Handle crossing a mountpoint on the server 119 * nfs_d_automount - Handle crossing a mountpoint on the server
@@ -241,6 +242,7 @@ out:
241 dprintk("<-- nfs_do_submount() = %p\n", mnt); 242 dprintk("<-- nfs_do_submount() = %p\n", mnt);
242 return mnt; 243 return mnt;
243} 244}
245EXPORT_SYMBOL_GPL(nfs_do_submount);
244 246
245struct vfsmount *nfs_submount(struct nfs_server *server, struct dentry *dentry, 247struct vfsmount *nfs_submount(struct nfs_server *server, struct dentry *dentry,
246 struct nfs_fh *fh, struct nfs_fattr *fattr) 248 struct nfs_fh *fh, struct nfs_fattr *fattr)
diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h
index 8a6394edb8b0..0539de1b8d1f 100644
--- a/fs/nfs/netns.h
+++ b/fs/nfs/netns.h
@@ -20,7 +20,7 @@ struct nfs_net {
20 wait_queue_head_t bl_wq; 20 wait_queue_head_t bl_wq;
21 struct list_head nfs_client_list; 21 struct list_head nfs_client_list;
22 struct list_head nfs_volume_list; 22 struct list_head nfs_volume_list;
23#ifdef CONFIG_NFS_V4 23#if IS_ENABLED(CONFIG_NFS_V4)
24 struct idr cb_ident_idr; /* Protected by nfs_client_lock */ 24 struct idr cb_ident_idr; /* Protected by nfs_client_lock */
25#endif 25#endif
26 spinlock_t nfs_client_lock; 26 spinlock_t nfs_client_lock;
diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h
index 3e1b84baa57f..43679df56cd0 100644
--- a/fs/nfs/nfs.h
+++ b/fs/nfs/nfs.h
@@ -21,23 +21,6 @@ struct nfs_subversion {
21 struct list_head list; /* List of NFS versions */ 21 struct list_head list; /* List of NFS versions */
22}; 22};
23 23
24int nfs_register_versions(void);
25void nfs_unregister_versions(void);
26
27#ifdef CONFIG_NFS_V4
28int init_nfs_v4(void);
29void exit_nfs_v4(void);
30#else /* CONFIG_NFS_V4 */
31static inline int __init init_nfs_v4(void)
32{
33 return 0;
34}
35
36static inline void exit_nfs_v4(void)
37{
38}
39#endif /* CONFIG_NFS_V4 */
40
41struct nfs_subversion *get_nfs_version(unsigned int); 24struct nfs_subversion *get_nfs_version(unsigned int);
42void put_nfs_version(struct nfs_subversion *); 25void put_nfs_version(struct nfs_subversion *);
43void register_nfs_version(struct nfs_subversion *); 26void register_nfs_version(struct nfs_subversion *);
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index bafe5186c9cd..3b950dd81e81 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -9,7 +9,7 @@
9#ifndef __LINUX_FS_NFS_NFS4_FS_H 9#ifndef __LINUX_FS_NFS_NFS4_FS_H
10#define __LINUX_FS_NFS_NFS4_FS_H 10#define __LINUX_FS_NFS_NFS4_FS_H
11 11
12#ifdef CONFIG_NFS_V4 12#if IS_ENABLED(CONFIG_NFS_V4)
13 13
14struct idmap; 14struct idmap;
15 15
@@ -365,11 +365,10 @@ extern const nfs4_stateid zero_stateid;
365struct nfs_mount_info; 365struct nfs_mount_info;
366extern struct nfs_subversion nfs_v4; 366extern struct nfs_subversion nfs_v4;
367struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *); 367struct dentry *nfs4_try_mount(int, const char *, struct nfs_mount_info *, struct nfs_subversion *);
368int init_nfs_v4(void);
369void exit_nfs_v4(void);
370extern bool nfs4_disable_idmapping; 368extern bool nfs4_disable_idmapping;
371extern unsigned short max_session_slots; 369extern unsigned short max_session_slots;
372extern unsigned short send_implementation_id; 370extern unsigned short send_implementation_id;
371
373/* nfs4sysctl.c */ 372/* nfs4sysctl.c */
374#ifdef CONFIG_SYSCTL 373#ifdef CONFIG_SYSCTL
375int nfs4_register_sysctl(void); 374int nfs4_register_sysctl(void);
diff --git a/fs/nfs/nfs4super.c b/fs/nfs/nfs4super.c
index 1c825f3bef51..12a31a9dbcdd 100644
--- a/fs/nfs/nfs4super.c
+++ b/fs/nfs/nfs4super.c
@@ -332,7 +332,7 @@ static struct dentry *nfs4_referral_mount(struct file_system_type *fs_type,
332} 332}
333 333
334 334
335int __init init_nfs_v4(void) 335static int __init init_nfs_v4(void)
336{ 336{
337 int err; 337 int err;
338 338
@@ -358,10 +358,15 @@ out:
358 return err; 358 return err;
359} 359}
360 360
361void exit_nfs_v4(void) 361static void __exit exit_nfs_v4(void)
362{ 362{
363 unregister_nfs_version(&nfs_v4); 363 unregister_nfs_version(&nfs_v4);
364 unregister_filesystem(&nfs4_fs_type); 364 unregister_filesystem(&nfs4_fs_type);
365 nfs4_unregister_sysctl(); 365 nfs4_unregister_sysctl();
366 nfs_idmap_quit(); 366 nfs_idmap_quit();
367} 367}
368
369MODULE_LICENSE("GPL");
370
371module_init(init_nfs_v4);
372module_exit(exit_nfs_v4);
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index aed913c833f4..1e7d8879dae6 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -54,6 +54,7 @@ void nfs_pgheader_init(struct nfs_pageio_descriptor *desc,
54 if (hdr->completion_ops->init_hdr) 54 if (hdr->completion_ops->init_hdr)
55 hdr->completion_ops->init_hdr(hdr); 55 hdr->completion_ops->init_hdr(hdr);
56} 56}
57EXPORT_SYMBOL_GPL(nfs_pgheader_init);
57 58
58void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos) 59void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos)
59{ 60{
@@ -268,6 +269,7 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
268 desc->pg_lseg = NULL; 269 desc->pg_lseg = NULL;
269 desc->pg_dreq = NULL; 270 desc->pg_dreq = NULL;
270} 271}
272EXPORT_SYMBOL_GPL(nfs_pageio_init);
271 273
272/** 274/**
273 * nfs_can_coalesce_requests - test two requests for compatibility 275 * nfs_can_coalesce_requests - test two requests for compatibility
@@ -409,6 +411,7 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
409 } while (ret); 411 } while (ret);
410 return ret; 412 return ret;
411} 413}
414EXPORT_SYMBOL_GPL(nfs_pageio_add_request);
412 415
413/** 416/**
414 * nfs_pageio_complete - Complete I/O on an nfs_pageio_descriptor 417 * nfs_pageio_complete - Complete I/O on an nfs_pageio_descriptor
@@ -424,6 +427,7 @@ void nfs_pageio_complete(struct nfs_pageio_descriptor *desc)
424 break; 427 break;
425 } 428 }
426} 429}
430EXPORT_SYMBOL_GPL(nfs_pageio_complete);
427 431
428/** 432/**
429 * nfs_pageio_cond_complete - Conditional I/O completion 433 * nfs_pageio_cond_complete - Conditional I/O completion
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 7fbd25afe418..76875bfcf19c 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1407,6 +1407,7 @@ static void pnfs_writehdr_free(struct nfs_pgio_header *hdr)
1407 put_lseg(hdr->lseg); 1407 put_lseg(hdr->lseg);
1408 nfs_writehdr_free(hdr); 1408 nfs_writehdr_free(hdr);
1409} 1409}
1410EXPORT_SYMBOL_GPL(pnfs_writehdr_free);
1410 1411
1411int 1412int
1412pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) 1413pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
@@ -1561,6 +1562,7 @@ static void pnfs_readhdr_free(struct nfs_pgio_header *hdr)
1561 put_lseg(hdr->lseg); 1562 put_lseg(hdr->lseg);
1562 nfs_readhdr_free(hdr); 1563 nfs_readhdr_free(hdr);
1563} 1564}
1565EXPORT_SYMBOL_GPL(pnfs_readhdr_free);
1564 1566
1565int 1567int
1566pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) 1568pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index b000e4c0cf83..6935e401ad76 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -48,6 +48,7 @@ struct nfs_read_header *nfs_readhdr_alloc(void)
48 } 48 }
49 return rhdr; 49 return rhdr;
50} 50}
51EXPORT_SYMBOL_GPL(nfs_readhdr_alloc);
51 52
52static struct nfs_read_data *nfs_readdata_alloc(struct nfs_pgio_header *hdr, 53static struct nfs_read_data *nfs_readdata_alloc(struct nfs_pgio_header *hdr,
53 unsigned int pagecount) 54 unsigned int pagecount)
@@ -80,6 +81,7 @@ void nfs_readhdr_free(struct nfs_pgio_header *hdr)
80 81
81 kmem_cache_free(nfs_rdata_cachep, rhdr); 82 kmem_cache_free(nfs_rdata_cachep, rhdr);
82} 83}
84EXPORT_SYMBOL_GPL(nfs_readhdr_free);
83 85
84void nfs_readdata_release(struct nfs_read_data *rdata) 86void nfs_readdata_release(struct nfs_read_data *rdata)
85{ 87{
@@ -96,6 +98,7 @@ void nfs_readdata_release(struct nfs_read_data *rdata)
96 if (atomic_dec_and_test(&hdr->refcnt)) 98 if (atomic_dec_and_test(&hdr->refcnt))
97 hdr->completion_ops->completion(hdr); 99 hdr->completion_ops->completion(hdr);
98} 100}
101EXPORT_SYMBOL_GPL(nfs_readdata_release);
99 102
100static 103static
101int nfs_return_empty_page(struct page *page) 104int nfs_return_empty_page(struct page *page)
@@ -398,6 +401,7 @@ int nfs_generic_pagein(struct nfs_pageio_descriptor *desc,
398 return nfs_pagein_multi(desc, hdr); 401 return nfs_pagein_multi(desc, hdr);
399 return nfs_pagein_one(desc, hdr); 402 return nfs_pagein_one(desc, hdr);
400} 403}
404EXPORT_SYMBOL_GPL(nfs_generic_pagein);
401 405
402static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) 406static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
403{ 407{
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 558a85c9594a..ac6a3c55dce4 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -315,7 +315,7 @@ const struct super_operations nfs_sops = {
315}; 315};
316EXPORT_SYMBOL_GPL(nfs_sops); 316EXPORT_SYMBOL_GPL(nfs_sops);
317 317
318#ifdef CONFIG_NFS_V4 318#if IS_ENABLED(CONFIG_NFS_V4)
319static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *); 319static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *);
320static int nfs4_validate_mount_data(void *options, 320static int nfs4_validate_mount_data(void *options,
321 struct nfs_parsed_mount_data *args, const char *dev_name); 321 struct nfs_parsed_mount_data *args, const char *dev_name);
@@ -366,6 +366,7 @@ void nfs_sb_active(struct super_block *sb)
366 if (atomic_inc_return(&server->active) == 1) 366 if (atomic_inc_return(&server->active) == 1)
367 atomic_inc(&sb->s_active); 367 atomic_inc(&sb->s_active);
368} 368}
369EXPORT_SYMBOL_GPL(nfs_sb_active);
369 370
370void nfs_sb_deactive(struct super_block *sb) 371void nfs_sb_deactive(struct super_block *sb)
371{ 372{
@@ -374,6 +375,7 @@ void nfs_sb_deactive(struct super_block *sb)
374 if (atomic_dec_and_test(&server->active)) 375 if (atomic_dec_and_test(&server->active))
375 deactivate_super(sb); 376 deactivate_super(sb);
376} 377}
378EXPORT_SYMBOL_GPL(nfs_sb_deactive);
377 379
378/* 380/*
379 * Deliver file system statistics to userspace 381 * Deliver file system statistics to userspace
@@ -439,6 +441,7 @@ int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
439 dprintk("%s: statfs error = %d\n", __func__, -error); 441 dprintk("%s: statfs error = %d\n", __func__, -error);
440 return error; 442 return error;
441} 443}
444EXPORT_SYMBOL_GPL(nfs_statfs);
442 445
443/* 446/*
444 * Map the security flavour number to a name 447 * Map the security flavour number to a name
@@ -544,7 +547,7 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
544 nfs_show_mountd_netid(m, nfss, showdefaults); 547 nfs_show_mountd_netid(m, nfss, showdefaults);
545} 548}
546 549
547#ifdef CONFIG_NFS_V4 550#if IS_ENABLED(CONFIG_NFS_V4)
548static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss, 551static void nfs_show_nfsv4_options(struct seq_file *m, struct nfs_server *nfss,
549 int showdefaults) 552 int showdefaults)
550{ 553{
@@ -675,8 +678,9 @@ int nfs_show_options(struct seq_file *m, struct dentry *root)
675 678
676 return 0; 679 return 0;
677} 680}
681EXPORT_SYMBOL_GPL(nfs_show_options);
678 682
679#ifdef CONFIG_NFS_V4 683#if IS_ENABLED(CONFIG_NFS_V4)
680#ifdef CONFIG_NFS_V4_1 684#ifdef CONFIG_NFS_V4_1
681static void show_sessions(struct seq_file *m, struct nfs_server *server) 685static void show_sessions(struct seq_file *m, struct nfs_server *server)
682{ 686{
@@ -709,7 +713,7 @@ static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
709 } 713 }
710} 714}
711#else 715#else
712#ifdef CONFIG_NFS_V4 716#if IS_ENABLED(CONFIG_NFS_V4)
713static void show_pnfs(struct seq_file *m, struct nfs_server *server) 717static void show_pnfs(struct seq_file *m, struct nfs_server *server)
714{ 718{
715} 719}
@@ -734,12 +738,14 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root)
734 free_page((unsigned long)page); 738 free_page((unsigned long)page);
735 return err; 739 return err;
736} 740}
741EXPORT_SYMBOL_GPL(nfs_show_devname);
737 742
738int nfs_show_path(struct seq_file *m, struct dentry *dentry) 743int nfs_show_path(struct seq_file *m, struct dentry *dentry)
739{ 744{
740 seq_puts(m, "/"); 745 seq_puts(m, "/");
741 return 0; 746 return 0;
742} 747}
748EXPORT_SYMBOL_GPL(nfs_show_path);
743 749
744/* 750/*
745 * Present statistical information for this VFS mountpoint 751 * Present statistical information for this VFS mountpoint
@@ -774,7 +780,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root)
774 seq_printf(m, ",bsize=%u", nfss->bsize); 780 seq_printf(m, ",bsize=%u", nfss->bsize);
775 seq_printf(m, ",namlen=%u", nfss->namelen); 781 seq_printf(m, ",namlen=%u", nfss->namelen);
776 782
777#ifdef CONFIG_NFS_V4 783#if IS_ENABLED(CONFIG_NFS_V4)
778 if (nfss->nfs_client->rpc_ops->version == 4) { 784 if (nfss->nfs_client->rpc_ops->version == 4) {
779 seq_printf(m, "\n\tnfsv4:\t"); 785 seq_printf(m, "\n\tnfsv4:\t");
780 seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]); 786 seq_printf(m, "bm0=0x%x", nfss->attr_bitmask[0]);
@@ -832,6 +838,7 @@ int nfs_show_stats(struct seq_file *m, struct dentry *root)
832 838
833 return 0; 839 return 0;
834} 840}
841EXPORT_SYMBOL_GPL(nfs_show_stats);
835 842
836/* 843/*
837 * Begin unmount by attempting to remove all automounted mountpoints we added 844 * Begin unmount by attempting to remove all automounted mountpoints we added
@@ -851,6 +858,7 @@ void nfs_umount_begin(struct super_block *sb)
851 if (!IS_ERR(rpc)) 858 if (!IS_ERR(rpc))
852 rpc_killall_tasks(rpc); 859 rpc_killall_tasks(rpc);
853} 860}
861EXPORT_SYMBOL_GPL(nfs_umount_begin);
854 862
855static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(void) 863static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(void)
856{ 864{
@@ -1915,7 +1923,7 @@ out_invalid_fh:
1915 return -EINVAL; 1923 return -EINVAL;
1916} 1924}
1917 1925
1918#ifdef CONFIG_NFS_V4 1926#if IS_ENABLED(CONFIG_NFS_V4)
1919static int nfs_validate_mount_data(struct file_system_type *fs_type, 1927static int nfs_validate_mount_data(struct file_system_type *fs_type,
1920 void *options, 1928 void *options,
1921 struct nfs_parsed_mount_data *args, 1929 struct nfs_parsed_mount_data *args,
@@ -1953,7 +1961,7 @@ static int nfs_validate_text_mount_data(void *options,
1953 goto out_no_address; 1961 goto out_no_address;
1954 1962
1955 if (args->version == 4) { 1963 if (args->version == 4) {
1956#ifdef CONFIG_NFS_V4 1964#if IS_ENABLED(CONFIG_NFS_V4)
1957 port = NFS_PORT; 1965 port = NFS_PORT;
1958 max_namelen = NFS4_MAXNAMLEN; 1966 max_namelen = NFS4_MAXNAMLEN;
1959 max_pathlen = NFS4_MAXPATHLEN; 1967 max_pathlen = NFS4_MAXPATHLEN;
@@ -1976,7 +1984,7 @@ static int nfs_validate_text_mount_data(void *options,
1976 &args->nfs_server.export_path, 1984 &args->nfs_server.export_path,
1977 max_pathlen); 1985 max_pathlen);
1978 1986
1979#ifndef CONFIG_NFS_V4 1987#if !IS_ENABLED(CONFIG_NFS_V4)
1980out_v4_not_compiled: 1988out_v4_not_compiled:
1981 dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n"); 1989 dfprintk(MOUNT, "NFS: NFSv4 is not compiled into kernel\n");
1982 return -EPROTONOSUPPORT; 1990 return -EPROTONOSUPPORT;
@@ -2075,6 +2083,7 @@ out:
2075 kfree(data); 2083 kfree(data);
2076 return error; 2084 return error;
2077} 2085}
2086EXPORT_SYMBOL_GPL(nfs_remount);
2078 2087
2079/* 2088/*
2080 * Initialise the common bits of the superblock 2089 * Initialise the common bits of the superblock
@@ -2123,6 +2132,7 @@ void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info)
2123 2132
2124 nfs_initialise_sb(sb); 2133 nfs_initialise_sb(sb);
2125} 2134}
2135EXPORT_SYMBOL_GPL(nfs_fill_super);
2126 2136
2127/* 2137/*
2128 * Finish setting up a cloned NFS2/3/4 superblock 2138 * Finish setting up a cloned NFS2/3/4 superblock
@@ -2292,6 +2302,7 @@ int nfs_set_sb_security(struct super_block *s, struct dentry *mntroot,
2292{ 2302{
2293 return security_sb_set_mnt_opts(s, &mount_info->parsed->lsm_opts); 2303 return security_sb_set_mnt_opts(s, &mount_info->parsed->lsm_opts);
2294} 2304}
2305EXPORT_SYMBOL_GPL(nfs_set_sb_security);
2295 2306
2296int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot, 2307int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot,
2297 struct nfs_mount_info *mount_info) 2308 struct nfs_mount_info *mount_info)
@@ -2302,6 +2313,7 @@ int nfs_clone_sb_security(struct super_block *s, struct dentry *mntroot,
2302 return -ESTALE; 2313 return -ESTALE;
2303 return 0; 2314 return 0;
2304} 2315}
2316EXPORT_SYMBOL_GPL(nfs_clone_sb_security);
2305 2317
2306struct dentry *nfs_fs_mount_common(struct nfs_server *server, 2318struct dentry *nfs_fs_mount_common(struct nfs_server *server,
2307 int flags, const char *dev_name, 2319 int flags, const char *dev_name,
@@ -2375,6 +2387,7 @@ error_splat_bdi:
2375 deactivate_locked_super(s); 2387 deactivate_locked_super(s);
2376 goto out; 2388 goto out;
2377} 2389}
2390EXPORT_SYMBOL_GPL(nfs_fs_mount_common);
2378 2391
2379struct dentry *nfs_fs_mount(struct file_system_type *fs_type, 2392struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
2380 int flags, const char *dev_name, void *raw_data) 2393 int flags, const char *dev_name, void *raw_data)
@@ -2415,6 +2428,7 @@ out:
2415 nfs_free_fhandle(mount_info.mntfh); 2428 nfs_free_fhandle(mount_info.mntfh);
2416 return mntroot; 2429 return mntroot;
2417} 2430}
2431EXPORT_SYMBOL_GPL(nfs_fs_mount);
2418 2432
2419/* 2433/*
2420 * Ensure that we unregister the bdi before kill_anon_super 2434 * Ensure that we unregister the bdi before kill_anon_super
@@ -2426,6 +2440,7 @@ void nfs_put_super(struct super_block *s)
2426 2440
2427 bdi_unregister(&server->backing_dev_info); 2441 bdi_unregister(&server->backing_dev_info);
2428} 2442}
2443EXPORT_SYMBOL_GPL(nfs_put_super);
2429 2444
2430/* 2445/*
2431 * Destroy an NFS2/3 superblock 2446 * Destroy an NFS2/3 superblock
@@ -2438,6 +2453,7 @@ void nfs_kill_super(struct super_block *s)
2438 nfs_fscache_release_super_cookie(s); 2453 nfs_fscache_release_super_cookie(s);
2439 nfs_free_server(server); 2454 nfs_free_server(server);
2440} 2455}
2456EXPORT_SYMBOL_GPL(nfs_kill_super);
2441 2457
2442/* 2458/*
2443 * Clone an NFS2/3/4 server record on xdev traversal (FSID-change) 2459 * Clone an NFS2/3/4 server record on xdev traversal (FSID-change)
@@ -2478,7 +2494,7 @@ out_err:
2478 goto out; 2494 goto out;
2479} 2495}
2480 2496
2481#ifdef CONFIG_NFS_V4 2497#if IS_ENABLED(CONFIG_NFS_V4)
2482 2498
2483static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args) 2499static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *args)
2484{ 2500{
@@ -2590,6 +2606,13 @@ bool nfs4_disable_idmapping = true;
2590unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE; 2606unsigned short max_session_slots = NFS4_DEF_SLOT_TABLE_SIZE;
2591unsigned short send_implementation_id = 1; 2607unsigned short send_implementation_id = 1;
2592 2608
2609EXPORT_SYMBOL_GPL(nfs_callback_set_tcpport);
2610EXPORT_SYMBOL_GPL(nfs_callback_tcpport);
2611EXPORT_SYMBOL_GPL(nfs_idmap_cache_timeout);
2612EXPORT_SYMBOL_GPL(nfs4_disable_idmapping);
2613EXPORT_SYMBOL_GPL(max_session_slots);
2614EXPORT_SYMBOL_GPL(send_implementation_id);
2615
2593#define NFS_CALLBACK_MAXPORTNR (65535U) 2616#define NFS_CALLBACK_MAXPORTNR (65535U)
2594 2617
2595static int param_set_portnr(const char *val, const struct kernel_param *kp) 2618static int param_set_portnr(const char *val, const struct kernel_param *kp)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index f268fe4f2785..e4a2ad2059bd 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -84,6 +84,7 @@ struct nfs_write_header *nfs_writehdr_alloc(void)
84 } 84 }
85 return p; 85 return p;
86} 86}
87EXPORT_SYMBOL_GPL(nfs_writehdr_alloc);
87 88
88static struct nfs_write_data *nfs_writedata_alloc(struct nfs_pgio_header *hdr, 89static struct nfs_write_data *nfs_writedata_alloc(struct nfs_pgio_header *hdr,
89 unsigned int pagecount) 90 unsigned int pagecount)
@@ -115,6 +116,7 @@ void nfs_writehdr_free(struct nfs_pgio_header *hdr)
115 struct nfs_write_header *whdr = container_of(hdr, struct nfs_write_header, header); 116 struct nfs_write_header *whdr = container_of(hdr, struct nfs_write_header, header);
116 mempool_free(whdr, nfs_wdata_mempool); 117 mempool_free(whdr, nfs_wdata_mempool);
117} 118}
119EXPORT_SYMBOL_GPL(nfs_writehdr_free);
118 120
119void nfs_writedata_release(struct nfs_write_data *wdata) 121void nfs_writedata_release(struct nfs_write_data *wdata)
120{ 122{
@@ -131,6 +133,7 @@ void nfs_writedata_release(struct nfs_write_data *wdata)
131 if (atomic_dec_and_test(&hdr->refcnt)) 133 if (atomic_dec_and_test(&hdr->refcnt))
132 hdr->completion_ops->completion(hdr); 134 hdr->completion_ops->completion(hdr);
133} 135}
136EXPORT_SYMBOL_GPL(nfs_writedata_release);
134 137
135static void nfs_context_set_write_error(struct nfs_open_context *ctx, int error) 138static void nfs_context_set_write_error(struct nfs_open_context *ctx, int error)
136{ 139{
@@ -446,7 +449,7 @@ nfs_mark_request_dirty(struct nfs_page *req)
446 __set_page_dirty_nobuffers(req->wb_page); 449 __set_page_dirty_nobuffers(req->wb_page);
447} 450}
448 451
449#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 452#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
450/** 453/**
451 * nfs_request_add_commit_list - add request to a commit list 454 * nfs_request_add_commit_list - add request to a commit list
452 * @req: pointer to a struct nfs_page 455 * @req: pointer to a struct nfs_page
@@ -636,7 +639,7 @@ out:
636 hdr->release(hdr); 639 hdr->release(hdr);
637} 640}
638 641
639#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 642#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
640static unsigned long 643static unsigned long
641nfs_reqs_to_commit(struct nfs_commit_info *cinfo) 644nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
642{ 645{
@@ -1173,6 +1176,7 @@ int nfs_generic_flush(struct nfs_pageio_descriptor *desc,
1173 return nfs_flush_multi(desc, hdr); 1176 return nfs_flush_multi(desc, hdr);
1174 return nfs_flush_one(desc, hdr); 1177 return nfs_flush_one(desc, hdr);
1175} 1178}
1179EXPORT_SYMBOL_GPL(nfs_generic_flush);
1176 1180
1177static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) 1181static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
1178{ 1182{
@@ -1298,7 +1302,7 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1298 return; 1302 return;
1299 nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, resp->count); 1303 nfs_add_stats(inode, NFSIOS_SERVERWRITTENBYTES, resp->count);
1300 1304
1301#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1305#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
1302 if (resp->verf->committed < argp->stable && task->tk_status >= 0) { 1306 if (resp->verf->committed < argp->stable && task->tk_status >= 0) {
1303 /* We tried a write call, but the server did not 1307 /* We tried a write call, but the server did not
1304 * commit data to stable storage even though we 1308 * commit data to stable storage even though we
@@ -1358,7 +1362,7 @@ void nfs_writeback_done(struct rpc_task *task, struct nfs_write_data *data)
1358} 1362}
1359 1363
1360 1364
1361#if IS_ENABLED(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 1365#if IS_ENABLED(CONFIG_NFS_V3) || IS_ENABLED(CONFIG_NFS_V4)
1362static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait) 1366static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait)
1363{ 1367{
1364 int ret; 1368 int ret;
@@ -1674,6 +1678,7 @@ int nfs_write_inode(struct inode *inode, struct writeback_control *wbc)
1674{ 1678{
1675 return nfs_commit_unstable_pages(inode, wbc); 1679 return nfs_commit_unstable_pages(inode, wbc);
1676} 1680}
1681EXPORT_SYMBOL_GPL(nfs_write_inode);
1677 1682
1678/* 1683/*
1679 * flush the inode to disk. 1684 * flush the inode to disk.