linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled
@ 2012-03-29 11:41 Jeff Layton
       [not found] ` <1333021311-8774-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2012-03-29 11:41 UTC (permalink / raw)
  To: bfields; +Cc: Trond.Myklebust, linux-nfs, linux-next, paul.gortmaker

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>
---
 fs/nfsd/netns.h       |   10 +++++++++-
 fs/nfsd/nfs4recover.c |   12 ++++++++++++
 fs/nfsd/nfsctl.c      |    6 +++---
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
index 66eac33..e87ba91 100644
--- a/fs/nfsd/netns.h
+++ b/fs/nfsd/netns.h
@@ -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__ */
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index eaaf948..4767429 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)
 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);
+}
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index dee6c1b..2c53be6 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
 	int retval;
 	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\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 <okir@monad.swb.de>");
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled
       [not found] ` <1333021311-8774-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2012-03-29 11:47   ` J. Bruce Fields
  2012-03-29 11:49     ` Jeff Layton
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2012-03-29 11:47 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA,
	linux-next-u79uwXL29TY76Z2rM5mHXA,
	paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ

On Thu, Mar 29, 2012 at 07:41:51AM -0400, Jeff Layton wrote:
> 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.

> 
> Reported-by: Paul Gortmaker <paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/nfsd/netns.h       |   10 +++++++++-
>  fs/nfsd/nfs4recover.c |   12 ++++++++++++
>  fs/nfsd/nfsctl.c      |    6 +++---
>  3 files changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
> index 66eac33..e87ba91 100644
> --- a/fs/nfsd/netns.h
> +++ b/fs/nfsd/netns.h
> @@ -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__ */
> diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> index eaaf948..4767429 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)
>  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);
> +}
> diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> index dee6c1b..2c53be6 100644
> --- a/fs/nfsd/nfsctl.c
> +++ b/fs/nfsd/nfsctl.c
> @@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
>  	int retval;
>  	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir-pn4DOG8n3UYbFoVRYvo4fw@public.gmane.org).\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 <okir-pn4DOG8n3UYbFoVRYvo4fw@public.gmane.org>");
> -- 
> 1.7.7.6
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled
  2012-03-29 11:47   ` J. Bruce Fields
@ 2012-03-29 11:49     ` Jeff Layton
  2012-03-29 11:52       ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2012-03-29 11:49 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Trond.Myklebust, linux-nfs, linux-next, paul.gortmaker

On Thu, 29 Mar 2012 07:47:55 -0400
"J. Bruce Fields" <bfields@fieldses.org> wrote:

> On Thu, Mar 29, 2012 at 07:41:51AM -0400, Jeff Layton wrote:
> > 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.
> 

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.

> > 
> > Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/nfsd/netns.h       |   10 +++++++++-
> >  fs/nfsd/nfs4recover.c |   12 ++++++++++++
> >  fs/nfsd/nfsctl.c      |    6 +++---
> >  3 files changed, 24 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
> > index 66eac33..e87ba91 100644
> > --- a/fs/nfsd/netns.h
> > +++ b/fs/nfsd/netns.h
> > @@ -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__ */
> > diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> > index eaaf948..4767429 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)
> >  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);
> > +}
> > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> > index dee6c1b..2c53be6 100644
> > --- a/fs/nfsd/nfsctl.c
> > +++ b/fs/nfsd/nfsctl.c
> > @@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
> >  	int retval;
> >  	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\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 <okir@monad.swb.de>");
> > -- 
> > 1.7.7.6
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled
  2012-03-29 11:49     ` Jeff Layton
@ 2012-03-29 11:52       ` J. Bruce Fields
  0 siblings, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2012-03-29 11:52 UTC (permalink / raw)
  To: Jeff Layton; +Cc: Trond.Myklebust, linux-nfs, linux-next, paul.gortmaker

On Thu, Mar 29, 2012 at 07:49:44AM -0400, Jeff Layton wrote:
> On Thu, 29 Mar 2012 07:47:55 -0400
> "J. Bruce Fields" <bfields@fieldses.org> wrote:
> 
> > On Thu, Mar 29, 2012 at 07:41:51AM -0400, Jeff Layton wrote:
> > > 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.
> > 
> 
> 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.

> 
> > > 
> > > Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> > > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > > ---
> > >  fs/nfsd/netns.h       |   10 +++++++++-
> > >  fs/nfsd/nfs4recover.c |   12 ++++++++++++
> > >  fs/nfsd/nfsctl.c      |    6 +++---
> > >  3 files changed, 24 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h
> > > index 66eac33..e87ba91 100644
> > > --- a/fs/nfsd/netns.h
> > > +++ b/fs/nfsd/netns.h
> > > @@ -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__ */
> > > diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> > > index eaaf948..4767429 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)
> > >  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);
> > > +}
> > > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> > > index dee6c1b..2c53be6 100644
> > > --- a/fs/nfsd/nfsctl.c
> > > +++ b/fs/nfsd/nfsctl.c
> > > @@ -1137,7 +1137,7 @@ static int __init init_nfsd(void)
> > >  	int retval;
> > >  	printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\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 <okir@monad.swb.de>");
> > > -- 
> > > 1.7.7.6
> > > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> -- 
> Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-29 11:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 11:41 [PATCH] nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled Jeff Layton
     [not found] ` <1333021311-8774-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2012-03-29 11:47   ` J. Bruce Fields
2012-03-29 11:49     ` Jeff Layton
2012-03-29 11:52       ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).