aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-03-29 07:52:49 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-03-29 08:01:07 -0400
commit797a9d797f8483bb67f265c761b76dcd5a077a23 (patch)
treebc114410d0b6f7cc596d1ef8e2905fab00bf321b /fs/nfsd
parent4ca1f872cda31fe1cfe5e90e027f7bef4980364c (diff)
nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled
Otherwise, we get a warning or error similar to this when building with CONFIG_NFSD_V4 disabled: ERROR: "nfsd4_cld_block" [fs/nfsd/nfsd.ko] undefined! Fix this by wrapping the calls to rpc_pipefs_notifier_register and ..._unregister in another function and providing no-op replacements when CONFIG_NFSD_V4 is disabled. Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/netns.h1
-rw-r--r--fs/nfsd/nfs4recover.c12
-rw-r--r--fs/nfsd/nfsctl.c6
-rw-r--r--fs/nfsd/nfsd.h7
4 files changed, 21 insertions, 5 deletions
diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 66eac332bf8d..12e0cff435b4 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -31,5 +31,4 @@ struct nfsd_net {
31}; 31};
32 32
33extern int nfsd_net_id; 33extern int nfsd_net_id;
34extern struct notifier_block nfsd4_cld_block;
35#endif /* __NFSD_NETNS_H__ */ 34#endif /* __NFSD_NETNS_H__ */
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index eaaf9482c7f5..4767429264a2 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -1032,3 +1032,15 @@ rpc_pipefs_event(struct notifier_block *nb, unsigned long event, void *ptr)
1032struct notifier_block nfsd4_cld_block = { 1032struct notifier_block nfsd4_cld_block = {
1033 .notifier_call = rpc_pipefs_event, 1033 .notifier_call = rpc_pipefs_event,
1034}; 1034};
1035
1036int
1037register_cld_notifier(void)
1038{
1039 return rpc_pipefs_notifier_register(&nfsd4_cld_block);
1040}
1041
1042void
1043unregister_cld_notifier(void)
1044{
1045 rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
1046}
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index dee6c1bb9ba8..2c53be6d3579 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
1137 int retval; 1137 int retval;
1138 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); 1138 printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n");
1139 1139
1140 retval = rpc_pipefs_notifier_register(&nfsd4_cld_block); 1140 retval = register_cld_notifier();
1141 if (retval) 1141 if (retval)
1142 return retval; 1142 return retval;
1143 retval = register_pernet_subsys(&nfsd_net_ops); 1143 retval = register_pernet_subsys(&nfsd_net_ops);
@@ -1186,7 +1186,7 @@ out_free_slabs:
1186out_unregister_pernet: 1186out_unregister_pernet:
1187 unregister_pernet_subsys(&nfsd_net_ops); 1187 unregister_pernet_subsys(&nfsd_net_ops);
1188out_unregister_notifier: 1188out_unregister_notifier:
1189 rpc_pipefs_notifier_unregister(&nfsd4_cld_block); 1189 unregister_cld_notifier();
1190 return retval; 1190 return retval;
1191} 1191}
1192 1192
@@ -1203,7 +1203,7 @@ static void __exit exit_nfsd(void)
1203 nfsd_fault_inject_cleanup(); 1203 nfsd_fault_inject_cleanup();
1204 unregister_filesystem(&nfsd_fs_type); 1204 unregister_filesystem(&nfsd_fs_type);
1205 unregister_pernet_subsys(&nfsd_net_ops); 1205 unregister_pernet_subsys(&nfsd_net_ops);
1206 rpc_pipefs_notifier_unregister(&nfsd4_cld_block); 1206 unregister_cld_notifier();
1207} 1207}
1208 1208
1209MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); 1209MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index 1d1e8589b4ce..1671429ffa66 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -364,12 +364,17 @@ static inline u32 nfsd_suppattrs2(u32 minorversion)
364 NFSD_WRITEABLE_ATTRS_WORD2 364 NFSD_WRITEABLE_ATTRS_WORD2
365 365
366extern int nfsd4_is_junction(struct dentry *dentry); 366extern int nfsd4_is_junction(struct dentry *dentry);
367#else 367extern int register_cld_notifier(void);
368extern void unregister_cld_notifier(void);
369#else /* CONFIG_NFSD_V4 */
368static inline int nfsd4_is_junction(struct dentry *dentry) 370static inline int nfsd4_is_junction(struct dentry *dentry)
369{ 371{
370 return 0; 372 return 0;
371} 373}
372 374
375#define register_cld_notifier() 0
376#define unregister_cld_notifier() do { } while(0)
377
373#endif /* CONFIG_NFSD_V4 */ 378#endif /* CONFIG_NFSD_V4 */
374 379
375#endif /* LINUX_NFSD_NFSD_H */ 380#endif /* LINUX_NFSD_NFSD_H */