Skip to contentSkip to conversation

nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled

PATCH Superseded Jeff Layton 3 participants 4 messages Mar 29, 2012 1 message not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/nfsd/netns.h       |   10 +++++++++-
 fs/nfsd/nfs4recover.c |   12 ++++++++++++
 fs/nfsd/nfsctl.c      |    6 +++---
 3 files changed, 24 insertions(+), 4 deletions(-)
fs/nfsd/netns.h +9 -1
index 66eac33..e87ba91 100644
@@ -31,5 +31,13 @@ struct nfsd_net {
 };
 
 extern int nfsd_net_id;
-extern struct notifier_block nfsd4_cld_block;
+
+#if IS_ENABLED(CONFIG_NFSD_V4)
+extern int register_cld_notifier(void);
+extern void unregister_cld_notifier(void);
+#else /* IS_ENABLED(CONFIG_NFSD_V4) */
+#define register_cld_notifier() 0
+#define unregister_cld_notifier() do { } while(0)
+#endif /* IS_ENABLED(CONFIG_NFSD_V4) */
+
 #endif /* __NFSD_NETNS_H__ */
fs/nfsd/nfs4recover.c +12 -0
index eaaf948..4767429 100644
@@ -1032,3 +1032,15 @@ rpc_pipefs_event(struct notifier_block *nb, unsigned long event, void *ptr)
 struct notifier_block nfsd4_cld_block = {
 	.notifier_call = rpc_pipefs_event,
 };
+
+int
+register_cld_notifier(void)
+{
+	return rpc_pipefs_notifier_register(&nfsd4_cld_block);
+}
+
+void
+unregister_cld_notifier(void)
+{
+	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+}
fs/nfsd/nfsctl.c +3 -3
index dee6c1b..2c53be6 100644
@@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 [email protected]).\n");
 
-	retval = rpc_pipefs_notifier_register(&nfsd4_cld_block);
+	retval = register_cld_notifier();
 	if (retval)
 		return retval;
 	retval = register_pernet_subsys(&nfsd_net_ops);
@@ -1186,7 +1186,7 @@ out_free_slabs:
 out_unregister_pernet:
 	unregister_pernet_subsys(&nfsd_net_ops);
 out_unregister_notifier:
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 	return retval;
 }
 
@@ -1203,7 +1203,7 @@ static void __exit exit_nfsd(void)
 	nfsd_fault_inject_cleanup();
 	unregister_filesystem(&nfsd_fs_type);
 	unregister_pernet_subsys(&nfsd_net_ops);
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 }
 
 MODULE_AUTHOR("Olaf Kirch <[email protected]>");
Signature · 1 line
1.7.7.6

A message that is not in the archive (sent off-list or not yet received): 1333021311-8774-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 8 lines · Jeff Layton

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.

Thanks to you and Paul, applying.--b.

Quoted 82 lines
---
 fs/nfsd/netns.h       |   10 +++++++++-
 fs/nfsd/nfs4recover.c |   12 ++++++++++++
 fs/nfsd/nfsctl.c      |    6 +++---
 3 files changed, 24 insertions(+), 4 deletions(-)
fs/nfsd/netns.h +9 -1
index 66eac33..e87ba91 100644
@@ -31,5 +31,13 @@ struct nfsd_net {
 };
 
 extern int nfsd_net_id;
-extern struct notifier_block nfsd4_cld_block;
+
+#if IS_ENABLED(CONFIG_NFSD_V4)
+extern int register_cld_notifier(void);
+extern void unregister_cld_notifier(void);
+#else /* IS_ENABLED(CONFIG_NFSD_V4) */
+#define register_cld_notifier() 0
+#define unregister_cld_notifier() do { } while(0)
+#endif /* IS_ENABLED(CONFIG_NFSD_V4) */
+
 #endif /* __NFSD_NETNS_H__ */
fs/nfsd/nfs4recover.c +12 -0
index eaaf948..4767429 100644
@@ -1032,3 +1032,15 @@ rpc_pipefs_event(struct notifier_block *nb, unsigned long event, void *ptr)
 struct notifier_block nfsd4_cld_block = {
 	.notifier_call = rpc_pipefs_event,
 };
+
+int
+register_cld_notifier(void)
+{
+	return rpc_pipefs_notifier_register(&nfsd4_cld_block);
+}
+
+void
+unregister_cld_notifier(void)
+{
+	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+}
fs/nfsd/nfsctl.c +3 -3
index dee6c1b..2c53be6 100644
@@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 [email protected]).\n");
 
-	retval = rpc_pipefs_notifier_register(&nfsd4_cld_block);
+	retval = register_cld_notifier();
 	if (retval)
 		return retval;
 	retval = register_pernet_subsys(&nfsd_net_ops);
@@ -1186,7 +1186,7 @@ out_free_slabs:
 out_unregister_pernet:
 	unregister_pernet_subsys(&nfsd_net_ops);
 out_unregister_notifier:
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 	return retval;
 }
 
@@ -1203,7 +1203,7 @@ static void __exit exit_nfsd(void)
 	nfsd_fault_inject_cleanup();
 	unregister_filesystem(&nfsd_fs_type);
 	unregister_pernet_subsys(&nfsd_net_ops);
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 }
 
 MODULE_AUTHOR("Olaf Kirch <[email protected]>");
Signature · 1 line
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 4 lines · On Thu, 29 Mar 2012 07:47:55 -0400 "J. Bruce Fields" <[email protected]>…
Quoted 3 lines · Jeff Layton

Otherwise, we get a warning or error similar to this when building with CONFIG_NFSD_V4 disabled:

Quoted 8 lines
Quoted 5 lines

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.

Thanks to you and Paul, applying.--b.

Actually...now that I look at it, I think netns.h is probably not the right place for these definitions. They should probably go into nfsd.h. I'll send a respin in a bit once I test it.

Quoted 86 lines
Quoted 82 lines
---
 fs/nfsd/netns.h       |   10 +++++++++-
 fs/nfsd/nfs4recover.c |   12 ++++++++++++
 fs/nfsd/nfsctl.c      |    6 +++---
 3 files changed, 24 insertions(+), 4 deletions(-)
fs/nfsd/netns.h +9 -1
index 66eac33..e87ba91 100644
@@ -31,5 +31,13 @@ struct nfsd_net {
 };
 
 extern int nfsd_net_id;
-extern struct notifier_block nfsd4_cld_block;
+
+#if IS_ENABLED(CONFIG_NFSD_V4)
+extern int register_cld_notifier(void);
+extern void unregister_cld_notifier(void);
+#else /* IS_ENABLED(CONFIG_NFSD_V4) */
+#define register_cld_notifier() 0
+#define unregister_cld_notifier() do { } while(0)
+#endif /* IS_ENABLED(CONFIG_NFSD_V4) */
+
 #endif /* __NFSD_NETNS_H__ */
fs/nfsd/nfs4recover.c +12 -0
index eaaf948..4767429 100644
@@ -1032,3 +1032,15 @@ rpc_pipefs_event(struct notifier_block *nb, unsigned long event, void *ptr)
 struct notifier_block nfsd4_cld_block = {
 	.notifier_call = rpc_pipefs_event,
 };
+
+int
+register_cld_notifier(void)
+{
+	return rpc_pipefs_notifier_register(&nfsd4_cld_block);
+}
+
+void
+unregister_cld_notifier(void)
+{
+	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+}
fs/nfsd/nfsctl.c +3 -3
index dee6c1b..2c53be6 100644
@@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 [email protected]).\n");
 
-	retval = rpc_pipefs_notifier_register(&nfsd4_cld_block);
+	retval = register_cld_notifier();
 	if (retval)
 		return retval;
 	retval = register_pernet_subsys(&nfsd_net_ops);
@@ -1186,7 +1186,7 @@ out_free_slabs:
 out_unregister_pernet:
 	unregister_pernet_subsys(&nfsd_net_ops);
 out_unregister_notifier:
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 	return retval;
 }
 
@@ -1203,7 +1203,7 @@ static void __exit exit_nfsd(void)
 	nfsd_fault_inject_cleanup();
 	unregister_filesystem(&nfsd_fs_type);
 	unregister_pernet_subsys(&nfsd_net_ops);
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 }
 
 MODULE_AUTHOR("Olaf Kirch <[email protected]>");
Signature · 1 line
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Jeff Layton <[email protected]>
#4 lore raw
Quoted 13 lines · Jeff Layton
Quoted 10 lines · On Thu, 29 Mar 2012 07:47:55 -0400 "J. Bruce Fields" <[email protected]>…
Quoted 8 lines · Jeff Layton

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.

Quoted 6 lines
Quoted 2 lines

Thanks to you and Paul, applying.--b.

Actually...now that I look at it, I think netns.h is probably not the right place for these definitions. They should probably go into nfsd.h. I'll send a respin in a bit once I test it.

OK, I haven't pushed this out yet, so a replacement patch is fine.

--b.

Quoted 91 lines
Quoted 87 lines
Quoted 83 lines
---
 fs/nfsd/netns.h       |   10 +++++++++-
 fs/nfsd/nfs4recover.c |   12 ++++++++++++
 fs/nfsd/nfsctl.c      |    6 +++---
 3 files changed, 24 insertions(+), 4 deletions(-)
fs/nfsd/netns.h +9 -1
index 66eac33..e87ba91 100644
@@ -31,5 +31,13 @@ struct nfsd_net {
 };
 
 extern int nfsd_net_id;
-extern struct notifier_block nfsd4_cld_block;
+
+#if IS_ENABLED(CONFIG_NFSD_V4)
+extern int register_cld_notifier(void);
+extern void unregister_cld_notifier(void);
+#else /* IS_ENABLED(CONFIG_NFSD_V4) */
+#define register_cld_notifier() 0
+#define unregister_cld_notifier() do { } while(0)
+#endif /* IS_ENABLED(CONFIG_NFSD_V4) */
+
 #endif /* __NFSD_NETNS_H__ */
fs/nfsd/nfs4recover.c +12 -0
index eaaf948..4767429 100644
@@ -1032,3 +1032,15 @@ rpc_pipefs_event(struct notifier_block *nb, unsigned long event, void *ptr)
 struct notifier_block nfsd4_cld_block = {
 	.notifier_call = rpc_pipefs_event,
 };
+
+int
+register_cld_notifier(void)
+{
+	return rpc_pipefs_notifier_register(&nfsd4_cld_block);
+}
+
+void
+unregister_cld_notifier(void)
+{
+	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+}
fs/nfsd/nfsctl.c +3 -3
index dee6c1b..2c53be6 100644
@@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 [email protected]).\n");
 
-	retval = rpc_pipefs_notifier_register(&nfsd4_cld_block);
+	retval = register_cld_notifier();
 	if (retval)
 		return retval;
 	retval = register_pernet_subsys(&nfsd_net_ops);
@@ -1186,7 +1186,7 @@ out_free_slabs:
 out_unregister_pernet:
 	unregister_pernet_subsys(&nfsd_net_ops);
 out_unregister_notifier:
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 	return retval;
 }
 
@@ -1203,7 +1203,7 @@ static void __exit exit_nfsd(void)
 	nfsd_fault_inject_cleanup();
 	unregister_filesystem(&nfsd_fs_type);
 	unregister_pernet_subsys(&nfsd_net_ops);
-	rpc_pipefs_notifier_unregister(&nfsd4_cld_block);
+	unregister_cld_notifier();
 }
 
 MODULE_AUTHOR("Olaf Kirch <[email protected]>");
Signature · 1 line
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Jeff Layton <[email protected]>