From 7ea34ac15e45b790f2faa7d5f69c560a43f2de70 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 21 Mar 2012 09:52:05 -0400 Subject: nfsd: add a per-net-namespace struct for nfsd Eventually, we'll need this when nfsd gets containerized fully. For now, create a struct on a per-net-namespace basis that will just hold a pointer to the cld_net structure. That struct will hold all of the per-net data that we need for the cld tracker. Eventually we can add other pernet objects to struct nfsd_net. Signed-off-by: Jeff Layton Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 fs/nfsd/netns.h (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h new file mode 100644 index 00000000000..12e0cff435b --- /dev/null +++ b/fs/nfsd/netns.h @@ -0,0 +1,34 @@ +/* + * per net namespace data structures for nfsd + * + * Copyright (C) 2012, Jeff Layton + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef __NFSD_NETNS_H__ +#define __NFSD_NETNS_H__ + +#include +#include + +struct cld_net; + +struct nfsd_net { + struct cld_net *cld_net; +}; + +extern int nfsd_net_id; +#endif /* __NFSD_NETNS_H__ */ -- cgit v1.2.1 From 813fd320c16691eac508fe350b4ee7362c6c4a56 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 21 Mar 2012 09:52:08 -0400 Subject: nfsd: add notifier to handle mount/unmount of rpc_pipefs sb In the event that rpc_pipefs isn't mounted when nfsd starts, we must register a notifier to handle creating the dentry once it is mounted, and to remove the dentry on unmount. Signed-off-by: Jeff Layton Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 12e0cff435b..66eac332bf8 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -31,4 +31,5 @@ struct nfsd_net { }; extern int nfsd_net_id; +extern struct notifier_block nfsd4_cld_block; #endif /* __NFSD_NETNS_H__ */ -- cgit v1.2.1 From 797a9d797f8483bb67f265c761b76dcd5a077a23 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Thu, 29 Mar 2012 07:52:49 -0400 Subject: 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 Signed-off-by: Jeff Layton Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 1 - 1 file changed, 1 deletion(-) (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 66eac332bf8..12e0cff435b 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -31,5 +31,4 @@ struct nfsd_net { }; extern int nfsd_net_id; -extern struct notifier_block nfsd4_cld_block; #endif /* __NFSD_NETNS_H__ */ -- cgit v1.2.1 From b3853e0ea1f2ef58f7e7c03e47819e2ae3766dea Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Wed, 11 Apr 2012 15:13:21 +0400 Subject: nfsd: make export cache allocated per network namespace context This patch also changes prototypes of nfsd_export_flush() and exp_rootfh(): network namespace parameter added. Signed-off-by: Stanislav Kinsbursky Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 12e0cff435b..c1c6242942a 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -28,6 +28,8 @@ struct cld_net; struct nfsd_net { struct cld_net *cld_net; + + struct cache_detail *svc_export_cache; }; extern int nfsd_net_id; -- cgit v1.2.1 From e5f06f720eff24e32f1cc08ec03bcc8c4b2d2934 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Wed, 11 Apr 2012 15:13:28 +0400 Subject: nfsd: make expkey cache allocated per network namespace context This patch also changes svcauth_unix_purge() function: added network namespace as a parameter and thus loop over all networks was replaced by only one call for ip map cache purge. Signed-off-by: Stanislav Kinsbursky Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index c1c6242942a..9794c6c7d13 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -29,6 +29,7 @@ struct cld_net; struct nfsd_net { struct cld_net *cld_net; + struct cache_detail *svc_expkey_cache; struct cache_detail *svc_export_cache; }; -- cgit v1.2.1 From c2e76ef5e0716bc82364e6049e8023ffd5bbe395 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Wed, 11 Apr 2012 17:32:51 +0400 Subject: nfsd: make id-to-name cache allocated per network namespace context Signed-off-by: Stanislav Kinsbursky Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 9794c6c7d13..948a718e24a 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -31,6 +31,9 @@ struct nfsd_net { struct cache_detail *svc_expkey_cache; struct cache_detail *svc_export_cache; + + struct cache_detail *idtoname_cache; + }; extern int nfsd_net_id; -- cgit v1.2.1 From 9e75a4dee08e8fe21f349e11c43955c34523bced Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Wed, 11 Apr 2012 17:32:58 +0400 Subject: nfsd: make name-to-id cache allocated per network namespace context Signed-off-by: Stanislav Kinsbursky Signed-off-by: J. Bruce Fields --- fs/nfsd/netns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/nfsd/netns.h') diff --git a/fs/nfsd/netns.h b/fs/nfsd/netns.h index 948a718e24a..39365636b24 100644 --- a/fs/nfsd/netns.h +++ b/fs/nfsd/netns.h @@ -33,7 +33,7 @@ struct nfsd_net { struct cache_detail *svc_export_cache; struct cache_detail *idtoname_cache; - + struct cache_detail *nametoid_cache; }; extern int nfsd_net_id; -- cgit v1.2.1