Commit 797a9d797f8483bb67f265c761b76dcd5a077a23

Authored by Jeff Layton
Committed by J. Bruce Fields
1 parent 4ca1f872cd

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>

Showing 4 changed files with 21 additions and 5 deletions Side-by-side Diff

... ... @@ -31,6 +31,5 @@
31 31 };
32 32  
33 33 extern int nfsd_net_id;
34   -extern struct notifier_block nfsd4_cld_block;
35 34 #endif /* __NFSD_NETNS_H__ */
fs/nfsd/nfs4recover.c
... ... @@ -1032,4 +1032,16 @@
1032 1032 struct notifier_block nfsd4_cld_block = {
1033 1033 .notifier_call = rpc_pipefs_event,
1034 1034 };
  1035 +
  1036 +int
  1037 +register_cld_notifier(void)
  1038 +{
  1039 + return rpc_pipefs_notifier_register(&nfsd4_cld_block);
  1040 +}
  1041 +
  1042 +void
  1043 +unregister_cld_notifier(void)
  1044 +{
  1045 + rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
  1046 +}
... ... @@ -1137,7 +1137,7 @@
1137 1137 int retval;
1138 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 1141 if (retval)
1142 1142 return retval;
1143 1143 retval = register_pernet_subsys(&nfsd_net_ops);
... ... @@ -1186,7 +1186,7 @@
1186 1186 out_unregister_pernet:
1187 1187 unregister_pernet_subsys(&nfsd_net_ops);
1188 1188 out_unregister_notifier:
1189   - rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
  1189 + unregister_cld_notifier();
1190 1190 return retval;
1191 1191 }
1192 1192  
... ... @@ -1203,7 +1203,7 @@
1203 1203 nfsd_fault_inject_cleanup();
1204 1204 unregister_filesystem(&nfsd_fs_type);
1205 1205 unregister_pernet_subsys(&nfsd_net_ops);
1206   - rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
  1206 + unregister_cld_notifier();
1207 1207 }
1208 1208  
1209 1209 MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
... ... @@ -364,11 +364,16 @@
364 364 NFSD_WRITEABLE_ATTRS_WORD2
365 365  
366 366 extern int nfsd4_is_junction(struct dentry *dentry);
367   -#else
  367 +extern int register_cld_notifier(void);
  368 +extern void unregister_cld_notifier(void);
  369 +#else /* CONFIG_NFSD_V4 */
368 370 static inline int nfsd4_is_junction(struct dentry *dentry)
369 371 {
370 372 return 0;
371 373 }
  374 +
  375 +#define register_cld_notifier() 0
  376 +#define unregister_cld_notifier() do { } while(0)
372 377  
373 378 #endif /* CONFIG_NFSD_V4 */
374 379