linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build failure after merge of the final tree (nfs tree related)
@ 2010-08-04  4:54 Stephen Rothwell
  2010-08-04 12:58 ` Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2010-08-04  4:54 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-next, linux-kernel

Hi Trond,

After merging the final tree, today's linux-next build (sparc
defconfig) failed like this:

`rpc_destroy_authunix' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o

Caused by commit 4c09a3aef02ef9bfab8322fadde269290563ede2 ("NFS: Ensure
the AUTH_UNIX credcache is allocated dynamically").

It also caused these warnings:

WARNING: vmlinux.o(.init.text+0x1e3b4): Section mismatch in reference from the f
unction rpcauth_init_module() to the function .exit.text:rpc_destroy_authunix()
The function __init rpcauth_init_module() references
a function __exit rpc_destroy_authunix().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
rpc_destroy_authunix() so it may be used outside an exit section.

I applied the following patch for today:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 4 Aug 2010 14:48:54 +1000
Subject: [PATCH] nfs: remove __exit from rpc_destroy_authunix

since it is referenced from an __init function.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/linux/sunrpc/auth.h |    2 +-
 net/sunrpc/auth_unix.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index d9d1402..652f2da 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -124,7 +124,7 @@ int __init		rpc_init_generic_auth(void);
 int __init		rpcauth_init_module(void);
 void __exit		rpcauth_remove_module(void);
 void __exit		rpc_destroy_generic_auth(void);
-void __exit		rpc_destroy_authunix(void);
+void			rpc_destroy_authunix(void);
 
 struct rpc_cred *	rpc_lookup_cred(void);
 struct rpc_cred *	rpc_lookup_machine_cred(void);
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 6385af7..4cb70dc 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -207,7 +207,7 @@ int __init rpc_init_authunix(void)
 	return rpcauth_init_credcache(&unix_auth);
 }
 
-void __exit rpc_destroy_authunix(void)
+void rpc_destroy_authunix(void)
 {
 	rpcauth_destroy_credcache(&unix_auth);
 }
-- 
1.7.1

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

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

* Re: linux-next: build failure after merge of the final tree (nfs tree related)
  2010-08-04  4:54 Stephen Rothwell
@ 2010-08-04 12:58 ` Trond Myklebust
  0 siblings, 0 replies; 10+ messages in thread
From: Trond Myklebust @ 2010-08-04 12:58 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, linux-kernel

On Wed, 2010-08-04 at 14:54 +1000, Stephen Rothwell wrote:
> Hi Trond,
> 
> After merging the final tree, today's linux-next build (sparc
> defconfig) failed like this:
> 
> `rpc_destroy_authunix' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o
> 
> Caused by commit 4c09a3aef02ef9bfab8322fadde269290563ede2 ("NFS: Ensure
> the AUTH_UNIX credcache is allocated dynamically").
> 
> It also caused these warnings:
> 
> WARNING: vmlinux.o(.init.text+0x1e3b4): Section mismatch in reference from the f
> unction rpcauth_init_module() to the function .exit.text:rpc_destroy_authunix()
> The function __init rpcauth_init_module() references
> a function __exit rpc_destroy_authunix().
> This is often seen when error handling in the init function
> uses functionality in the exit path.
> The fix is often to remove the __exit annotation of
> rpc_destroy_authunix() so it may be used outside an exit section.
> 
> I applied the following patch for today:

Hi Stephen,

Thanks! I've fixed this up in the NFS linux-next tree.

Cheers
  Trond

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

* linux-next: build failure after merge of the final tree (nfs tree related)
@ 2010-09-30  3:58 Stephen Rothwell
  2010-09-30 13:08 ` Bryan Schumaker
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2010-09-30  3:58 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-next, linux-kernel, Bryan Schumaker

[-- Attachment #1: Type: text/plain, Size: 712 bytes --]

Hi Trond,

After merging the final tree, today's linux-next build (powerpc
allyesconfig) failed like this:

fs/nfs/idmap.c: In function 'nfs_idmap_init':
fs/nfs/idmap.c:79: error: implicit declaration of function 'IS_ERR'
fs/nfs/idmap.c:80: error: implicit declaration of function 'PTR_ERR'
fs/nfs/idmap.c: In function 'nfs_idmap_request_key':
fs/nfs/idmap.c:170: error: implicit declaration of function 'IS_ERR_OR_NULL'

Caused by commit 892c16b2faae80ce1a3b3bd280a93533cd4f04a6 ("NFS: new
idmapper").  I guess an include of linux/err.h is missing.

I have reverted that commit for today.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

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

* Re: linux-next: build failure after merge of the final tree (nfs tree related)
  2010-09-30  3:58 Stephen Rothwell
@ 2010-09-30 13:08 ` Bryan Schumaker
  0 siblings, 0 replies; 10+ messages in thread
From: Bryan Schumaker @ 2010-09-30 13:08 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Trond Myklebust, linux-next, linux-kernel

On 09/29/2010 11:58 PM, Stephen Rothwell wrote:
> Hi Trond,
> 
> After merging the final tree, today's linux-next build (powerpc
> allyesconfig) failed like this:
> 
> fs/nfs/idmap.c: In function 'nfs_idmap_init':
> fs/nfs/idmap.c:79: error: implicit declaration of function 'IS_ERR'
> fs/nfs/idmap.c:80: error: implicit declaration of function 'PTR_ERR'
> fs/nfs/idmap.c: In function 'nfs_idmap_request_key':
> fs/nfs/idmap.c:170: error: implicit declaration of function 'IS_ERR_OR_NULL'
> 
> Caused by commit 892c16b2faae80ce1a3b3bd280a93533cd4f04a6 ("NFS: new
> idmapper").  I guess an include of linux/err.h is missing.
> 
> I have reverted that commit for today.


Hi

Here is an updated patch that includes linux/err.h

Bryan


NFS new idmapper

This patch creates a new idmapper system that uses the request-key function to
place a call into userspace to map user and group ids to names.  The old
idmapper was single threaded, which prevented more than one request from running
at a single time.  This means that a user would have to wait for an upcall to
finish before accessing a cached result.

The upcall result is stored on a keyring of type id_resolver.  See the file
Documentation/filesystems/nfs/idmapper.txt for instructions.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
---
diff --git a/Documentation/filesystems/nfs/00-INDEX b/Documentation/filesystems/nfs/00-INDEX
index 2f68cd6..3225a56 100644
--- a/Documentation/filesystems/nfs/00-INDEX
+++ b/Documentation/filesystems/nfs/00-INDEX
@@ -14,3 +14,5 @@ nfsroot.txt
 	- short guide on setting up a diskless box with NFS root filesystem.
 rpc-cache.txt
 	- introduction to the caching mechanisms in the sunrpc layer.
+idmapper.txt
+	- information for configuring request-keys to be used by idmapper
diff --git a/Documentation/filesystems/nfs/idmapper.txt b/Documentation/filesystems/nfs/idmapper.txt
new file mode 100644
index 0000000..d9f1d1f
--- /dev/null
+++ b/Documentation/filesystems/nfs/idmapper.txt
@@ -0,0 +1,67 @@
+
+=========
+ID Mapper
+=========
+Id mapper is used by NFS to translate user and group ids into names, and to
+translate user and group names into ids.  Part of this translation involves
+performing an upcall to userspace to request the information.  Id mapper will
+user request-key to perform this upcall and cache the result.  The program
+/usr/sbin/nfs.upcall should be called by request-key, and will perform the
+translation and initialize a key with the resulting information.
+
+ NFS_USE_NEW_IDMAPPER must be selected when configuring the kernel to use this
+ feature.
+
+===========
+Configuring
+===========
+The file /etc/request-key.conf will need to be modified so /sbin/request-key can
+direct the upcall.  The following line should be added:
+
+#OP	TYPE	DESCRIPTION	CALLOUT INFO	PROGRAM ARG1 ARG2 ARG3 ...
+#======	=======	===============	===============	===============================
+create	id_resolver	*	*		/usr/sbin/nfs.upcall %k %d 600
+
+This will direct all id_resolver requests to the program /usr/sbin/nfs.upcall.
+The last parameter, 600, defines how many seconds into the future the key will
+expire.  This parameter is optional for /usr/sbin/nfs.upcall.  When the timeout
+is not specified, nfs.upcall will default to 600 seconds.
+
+id mapper uses for key descriptions:
+	  uid:  Find the UID for the given user
+	  gid:  Find the GID for the given group
+	 user:  Find the user  name for the given UID
+	group:  Find the group name for the given GID
+
+You can handle any of these individually, rather than using the generic upcall
+program.  If you would like to use your own program for a uid lookup then you
+would edit your request-key.conf so it look similar to this:
+
+#OP	TYPE	DESCRIPTION	CALLOUT INFO	PROGRAM ARG1 ARG2 ARG3 ...
+#======	=======	===============	===============	===============================
+create	id_resolver	uid:*	*		/some/other/program  %k %d 600
+create	id_resolver	*	*		/usr/sbin/nfs.upcall %k %d 600
+
+Notice that the new line was added above the line for the generic program.
+request-key will find the first matching line and corresponding program.  In
+this case, /some/other/program will handle all uid lookups and
+/usr/sbin/nfs.upcall will handle gid, user, and group lookups.
+
+See <file:Documentation/keys-request-keys.txt> for more information about the
+request-key function.
+
+
+==========
+nfs.upcall
+==========
+nfs.upcall is designed to be called by request-key, and should not be run "by
+hand".  This program takes two arguments, a serialized key and a key
+description.  The serialized key is first converted into a key_serial_t, and
+then passed as an argument to keyctl_instantiate (both are part of keyutils.h).
+
+The actual lookups are performed by functions found in nfsidmap.h.  nfs.upcall
+determines the correct function to call by looking at the first part of the
+description string.  For example, a uid lookup description will appear as
+"uid:user@domain".
+
+nfs.upcall will return 0 if the key was instantiated, and non-zero otherwise.
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index f7e13db..d7695b2 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -117,3 +117,14 @@ config NFS_USE_KERNEL_DNS
 	select DNS_RESOLVER
 	select KEYS
 	default y
+
+config NFS_USE_NEW_IDMAPPER
+	bool "Use the new idmapper upcall routine"
+	depends on NFS_V4 && KEYS
+	help
+	  Say Y here if you want NFS to use the new idmapper upcall functions.
+	  You will need /sbin/request-key (usually provided by the keyutils
+	  package).  For details, read
+	  <file:Documentation/filesystems/nfs/idmapper.txt>.
+
+	  If you are unsure, say N.
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 21a84d4..2aed2d0 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -34,6 +34,209 @@
  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
+
+#include <linux/slab.h>
+#include <linux/cred.h>
+#include <linux/nfs_idmap.h>
+#include <linux/keyctl.h>
+#include <linux/key-type.h>
+#include <linux/rcupdate.h>
+#include <linux/kernel.h>
+#include <linux/err.h>
+
+#include <keys/user-type.h>
+
+#define NFS_UINT_MAXLEN 11
+
+const struct cred *id_resolver_cache;
+
+struct key_type key_type_id_resolver = {
+	.name		= "id_resolver",
+	.instantiate	= user_instantiate,
+	.match		= user_match,
+	.revoke		= user_revoke,
+	.destroy	= user_destroy,
+	.describe	= user_describe,
+	.read		= user_read,
+};
+
+int nfs_idmap_init(void)
+{
+	struct cred *cred;
+	struct key *keyring;
+	int ret;
+
+	printk(KERN_NOTICE "Registering the %s key type\n", key_type_id_resolver.name);
+
+	cred = prepare_kernel_cred(NULL);
+	if (!cred)
+		return -ENOMEM;
+
+	keyring = key_alloc(&key_type_keyring, ".id_resolver", 0, 0, cred,
+			     (KEY_POS_ALL & ~KEY_POS_SETATTR) |
+			     KEY_USR_VIEW | KEY_USR_READ,
+			     KEY_ALLOC_NOT_IN_QUOTA);
+	if (IS_ERR(keyring)) {
+		ret = PTR_ERR(keyring);
+		goto failed_put_cred;
+	}
+
+	ret = key_instantiate_and_link(keyring, NULL, 0, NULL, NULL);
+	if (ret < 0)
+		goto failed_put_key;
+
+	ret = register_key_type(&key_type_id_resolver);
+	if (ret < 0)
+		goto failed_put_key;
+
+	cred->thread_keyring = keyring;
+	cred->jit_keyring = KEY_REQKEY_DEFL_THREAD_KEYRING;
+	id_resolver_cache = cred;
+	return 0;
+
+failed_put_key:
+	key_put(keyring);
+failed_put_cred:
+	put_cred(cred);
+	return ret;
+}
+
+void nfs_idmap_quit(void)
+{
+	key_revoke(id_resolver_cache->thread_keyring);
+	unregister_key_type(&key_type_id_resolver);
+	put_cred(id_resolver_cache);
+}
+
+/*
+ * Assemble the description to pass to request_key()
+ * This function will allocate a new string and update dest to point
+ * at it.  The caller is responsible for freeing dest.
+ *
+ * On error 0 is returned.  Otherwise, the length of dest is returned.
+ */
+static ssize_t nfs_idmap_get_desc(const char *name, size_t namelen,
+				const char *type, size_t typelen, char **desc)
+{
+	char *cp;
+	size_t desclen = typelen + namelen + 2;
+
+	*desc = kmalloc(desclen, GFP_KERNEL);
+	if (!desc)
+		return -ENOMEM;
+
+	cp = *desc;
+	memcpy(cp, type, typelen);
+	cp += typelen;
+	*cp++ = ':';
+
+	memcpy(cp, name, namelen);
+	cp += namelen;
+	*cp = '\0';
+	return desclen;
+}
+
+static ssize_t nfs_idmap_request_key(const char *name, size_t namelen,
+				 char *type, void *data, size_t data_size)
+{
+	const struct cred *saved_cred;
+	struct key *rkey;
+	char *desc;
+	struct user_key_payload *payload;
+	ssize_t ret;
+
+	memset(data, 0, data_size);
+	ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc);
+	if (ret <= 0)
+		goto out;
+
+	saved_cred = override_creds(id_resolver_cache);
+	rkey = request_key(&key_type_id_resolver, desc, "");
+	revert_creds(saved_cred);
+	kfree(desc);
+	if (IS_ERR(rkey)) {
+		ret = PTR_ERR(rkey);
+		goto out;
+	}
+
+	rcu_read_lock();
+	rkey->perm |= KEY_USR_VIEW;
+
+	ret = key_validate(rkey);
+	if (ret < 0)
+		goto out_up;
+
+	payload = rcu_dereference(rkey->payload.data);
+	if (IS_ERR_OR_NULL(payload)) {
+		ret = PTR_ERR(payload);
+		goto out_up;
+	}
+
+	ret = payload->datalen;
+	if (ret > 0 && ret <= data_size)
+		memcpy(data, payload->data, ret);
+	else
+		ret = -EINVAL;
+
+out_up:
+	rcu_read_unlock();
+	key_put(rkey);
+out:
+	return ret;
+}
+
+
+/* ID -> Name */
+static int nfs_idmap_lookup_name(__u32 id, char *name, char *type, size_t buflen)
+{
+	char id_str[NFS_UINT_MAXLEN];
+	snprintf(id_str, buflen, "%u", id);
+	if (nfs_idmap_request_key(id_str, strlen(id_str), type, (void *)name, buflen) < 0)
+		return -EINVAL;
+	return 0;
+}
+
+/* Name -> ID */
+static int nfs_idmap_lookup_id(const char *name, size_t namelen,
+				__u32 *id, char *type)
+{
+	char id_str[NFS_UINT_MAXLEN];
+	long id_long;
+	ssize_t data_size;
+	int ret = 0;
+
+	data_size = nfs_idmap_request_key(name, namelen, type, id_str, NFS_UINT_MAXLEN);
+	if (data_size <= 0) {
+		ret = -EINVAL;
+	} else {
+		ret = strict_strtol(id_str, 10, &id_long);
+		*id = (__u32)id_long;
+	}
+	return ret;
+}
+
+int nfs_map_name_to_uid(struct nfs_client *clp, const char *name, size_t namelen, __u32 *uid)
+{
+	return nfs_idmap_lookup_id(name, namelen, uid, "uid");
+}
+
+int nfs_map_group_to_gid(struct nfs_client *clp, const char *name, size_t namelen, __u32 *gid)
+{
+	return nfs_idmap_lookup_id(name, namelen, gid, "gid");
+}
+
+int nfs_map_uid_to_name(struct nfs_client *clp, __u32 uid, char *buf, size_t buflen)
+{
+	return nfs_idmap_lookup_name(uid, buf, "user", buflen);
+}
+int nfs_map_gid_to_group(struct nfs_client *clp, __u32 gid, char *buf, size_t buflen)
+{
+	return nfs_idmap_lookup_name(gid, buf, "group", buflen);
+}
+
+#else  /* CONFIG_NFS_USE_IDMAPPER not defined */
+
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/init.h>
@@ -503,16 +706,17 @@ int nfs_map_group_to_gid(struct nfs_client *clp, const char *name, size_t namele
 	return nfs_idmap_id(idmap, &idmap->idmap_group_hash, name, namelen, uid);
 }
 
-int nfs_map_uid_to_name(struct nfs_client *clp, __u32 uid, char *buf)
+int nfs_map_uid_to_name(struct nfs_client *clp, __u32 uid, char *buf, size_t buflen)
 {
 	struct idmap *idmap = clp->cl_idmap;
 
 	return nfs_idmap_name(idmap, &idmap->idmap_user_hash, uid, buf);
 }
-int nfs_map_gid_to_group(struct nfs_client *clp, __u32 uid, char *buf)
+int nfs_map_gid_to_group(struct nfs_client *clp, __u32 uid, char *buf, size_t buflen)
 {
 	struct idmap *idmap = clp->cl_idmap;
 
 	return nfs_idmap_name(idmap, &idmap->idmap_group_hash, uid, buf);
 }
 
+#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7d2d6c7..1bf86de 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1521,6 +1521,10 @@ static int __init init_nfs_fs(void)
 {
 	int err;
 
+	err = nfs_idmap_init();
+	if (err < 0)
+		goto out9;
+
 	err = nfs_dns_resolver_init();
 	if (err < 0)
 		goto out8;
@@ -1585,6 +1589,8 @@ out6:
 out7:
 	nfs_dns_resolver_destroy();
 out8:
+	nfs_idmap_quit();
+out9:
 	return err;
 }
 
@@ -1597,6 +1603,7 @@ static void __exit exit_nfs_fs(void)
 	nfs_destroy_nfspagecache();
 	nfs_fscache_unregister();
 	nfs_dns_resolver_destroy();
+	nfs_idmap_quit();
 #ifdef CONFIG_PROC_FS
 	rpc_proc_unregister("nfs");
 #endif
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 08ef912..e1724c9 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -816,7 +816,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const
 	if (iap->ia_valid & ATTR_MODE)
 		len += 4;
 	if (iap->ia_valid & ATTR_UID) {
-		owner_namelen = nfs_map_uid_to_name(server->nfs_client, iap->ia_uid, owner_name);
+		owner_namelen = nfs_map_uid_to_name(server->nfs_client, iap->ia_uid, owner_name, IDMAP_NAMESZ);
 		if (owner_namelen < 0) {
 			dprintk("nfs: couldn't resolve uid %d to string\n",
 					iap->ia_uid);
@@ -828,7 +828,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const
 		len += 4 + (XDR_QUADLEN(owner_namelen) << 2);
 	}
 	if (iap->ia_valid & ATTR_GID) {
-		owner_grouplen = nfs_map_gid_to_group(server->nfs_client, iap->ia_gid, owner_group);
+		owner_grouplen = nfs_map_gid_to_group(server->nfs_client, iap->ia_gid, owner_group, IDMAP_NAMESZ);
 		if (owner_grouplen < 0) {
 			dprintk("nfs: couldn't resolve gid %d to string\n",
 					iap->ia_gid);
diff --git a/fs/nfs/sysctl.c b/fs/nfs/sysctl.c
index ad4d2e7..978aaeb 100644
--- a/fs/nfs/sysctl.c
+++ b/fs/nfs/sysctl.c
@@ -32,6 +32,7 @@ static ctl_table nfs_cb_sysctls[] = {
 		.extra1 = (int *)&nfs_set_port_min,
 		.extra2 = (int *)&nfs_set_port_max,
 	},
+#ifndef CONFIG_NFS_USE_NEW_IDMAPPER
 	{
 		.procname = "idmap_cache_timeout",
 		.data = &nfs_idmap_cache_timeout,
@@ -39,6 +40,7 @@ static ctl_table nfs_cb_sysctls[] = {
 		.mode = 0644,
 		.proc_handler = proc_dointvec_jiffies,
 	},
+#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
 #endif
 	{
 		.procname	= "nfs_mountpoint_timeout",
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index 91a1c24..e8352dc 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -66,13 +66,40 @@ struct idmap_msg {
 /* Forward declaration to make this header independent of others */
 struct nfs_client;
 
+#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
+
+int nfs_idmap_init(void);
+void nfs_idmap_quit(void);
+
+static inline int nfs_idmap_new(struct nfs_client *clp)
+{
+	return 0;
+}
+
+static inline void nfs_idmap_delete(struct nfs_client *clp)
+{
+}
+
+#else /* CONFIG_NFS_USE_NEW_IDMAPPER not set */
+
+static inline int nfs_idmap_init(void)
+{
+	return 0;
+}
+
+static inline void nfs_idmap_quit(void)
+{
+}
+
 int nfs_idmap_new(struct nfs_client *);
 void nfs_idmap_delete(struct nfs_client *);
 
+#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
+
 int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *);
 int nfs_map_group_to_gid(struct nfs_client *, const char *, size_t, __u32 *);
-int nfs_map_uid_to_name(struct nfs_client *, __u32, char *);
-int nfs_map_gid_to_group(struct nfs_client *, __u32, char *);
+int nfs_map_uid_to_name(struct nfs_client *, __u32, char *, size_t);
+int nfs_map_gid_to_group(struct nfs_client *, __u32, char *, size_t);
 
 extern unsigned int nfs_idmap_cache_timeout;
 #endif /* __KERNEL__ */

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

* linux-next: build failure after merge of the final tree (nfs tree related)
@ 2012-01-23  2:59 Stephen Rothwell
  2012-01-23 18:10 ` Trond Myklebust
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2012-01-23  2:59 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-next, linux-kernel, Stanislav Kinsbursky

[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]

Hi all,

After merging the final tree, today's linux-next build (powerpc
ppc44x_defconfig) failed like this:

net/sunrpc/svcsock.c: In function 'svc_setup_socket':
net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'

This build has CONFIG_NET_NS unset.

Caused by commit eff9c3383687 ("SUNRPC: pass network namespace to service
registering routines").

I applied this (suboptimal) patch for today:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 23 Jan 2012 13:55:01 +1100
Subject: [PATCH] SUNRPC: fixup for namespace changes

Fixes this build error when CONFIG_NET_NS is not set:

net/sunrpc/svcsock.c: In function 'svc_setup_socket':
net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 net/sunrpc/svcsock.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index e8af0c9..4d02d1a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -41,6 +41,7 @@
 #include <net/ipv6.h>
 #include <net/tcp.h>
 #include <net/tcp_states.h>
+#include <net/net_namespace.h>
 #include <asm/uaccess.h>
 #include <asm/ioctls.h>
 
@@ -1409,7 +1410,13 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
 
 	/* Register socket with portmapper */
 	if (*errp >= 0 && pmap_register)
-		*errp = svc_register(serv, sock->sk->sk_net, inet->sk_family,
+		*errp = svc_register(serv,
+#ifdef CONFIG_NET_NS
+				     sock->sk->sk_net,
+#else
+				     &init_net,
+#endif
+				     inet->sk_family,
 				     inet->sk_protocol,
 				     ntohs(inet_sk(inet)->inet_sport));
 
-- 
1.7.9.rc0.23.g7e521

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: linux-next: build failure after merge of the final tree (nfs tree related)
  2012-01-23  2:59 Stephen Rothwell
@ 2012-01-23 18:10 ` Trond Myklebust
  2012-01-24  8:38   ` Stanislav Kinsbursky
  0 siblings, 1 reply; 10+ messages in thread
From: Trond Myklebust @ 2012-01-23 18:10 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, linux-kernel, Stanislav Kinsbursky

On Mon, 2012-01-23 at 13:59 +1100, Stephen Rothwell wrote: 
> Hi all,
> 
> After merging the final tree, today's linux-next build (powerpc
> ppc44x_defconfig) failed like this:
> 
> net/sunrpc/svcsock.c: In function 'svc_setup_socket':
> net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'
> 
> This build has CONFIG_NET_NS unset.
> 
> Caused by commit eff9c3383687 ("SUNRPC: pass network namespace to service
> registering routines").
> 
> I applied this (suboptimal) patch for today:
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Mon, 23 Jan 2012 13:55:01 +1100
> Subject: [PATCH] SUNRPC: fixup for namespace changes
> 
> Fixes this build error when CONFIG_NET_NS is not set:
> 
> net/sunrpc/svcsock.c: In function 'svc_setup_socket':
> net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  net/sunrpc/svcsock.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> index e8af0c9..4d02d1a 100644
> --- a/net/sunrpc/svcsock.c
> +++ b/net/sunrpc/svcsock.c
> @@ -41,6 +41,7 @@
>  #include <net/ipv6.h>
>  #include <net/tcp.h>
>  #include <net/tcp_states.h>
> +#include <net/net_namespace.h>
>  #include <asm/uaccess.h>
>  #include <asm/ioctls.h>
>  
> @@ -1409,7 +1410,13 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
>  
>  	/* Register socket with portmapper */
>  	if (*errp >= 0 && pmap_register)
> -		*errp = svc_register(serv, sock->sk->sk_net, inet->sk_family,
> +		*errp = svc_register(serv,
> +#ifdef CONFIG_NET_NS
> +				     sock->sk->sk_net,
> +#else
> +				     &init_net,
> +#endif
> +				     inet->sk_family,
>  				     inet->sk_protocol,
>  				     ntohs(inet_sk(inet)->inet_sport));
>  
> -- 
> 1.7.9.rc0.23.g7e521

Stanislav,

Shouldn't we just be using a 'sock_net(sock->sk)'?

Cheers
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

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

* Re: linux-next: build failure after merge of the final tree (nfs tree related)
  2012-01-23 18:10 ` Trond Myklebust
@ 2012-01-24  8:38   ` Stanislav Kinsbursky
  0 siblings, 0 replies; 10+ messages in thread
From: Stanislav Kinsbursky @ 2012-01-24  8:38 UTC (permalink / raw)
  To: Trond Myklebust
  Cc: Stephen Rothwell, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org

23.01.2012 22:10, Trond Myklebust пишет:
> On Mon, 2012-01-23 at 13:59 +1100, Stephen Rothwell wrote:
>> Hi all,
>>
>> After merging the final tree, today's linux-next build (powerpc
>> ppc44x_defconfig) failed like this:
>>
>> net/sunrpc/svcsock.c: In function 'svc_setup_socket':
>> net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'
>>
>> This build has CONFIG_NET_NS unset.
>>
>> Caused by commit eff9c3383687 ("SUNRPC: pass network namespace to service
>> registering routines").
>>
>> I applied this (suboptimal) patch for today:
>>
>> From: Stephen Rothwell<sfr@canb.auug.org.au>
>> Date: Mon, 23 Jan 2012 13:55:01 +1100
>> Subject: [PATCH] SUNRPC: fixup for namespace changes
>>
>> Fixes this build error when CONFIG_NET_NS is not set:
>>
>> net/sunrpc/svcsock.c: In function 'svc_setup_socket':
>> net/sunrpc/svcsock.c:1412:40: error: 'struct sock_common' has no member named 'skc_net'
>>
>> Signed-off-by: Stephen Rothwell<sfr@canb.auug.org.au>
>> ---
>>   net/sunrpc/svcsock.c |    9 ++++++++-
>>   1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
>> index e8af0c9..4d02d1a 100644
>> --- a/net/sunrpc/svcsock.c
>> +++ b/net/sunrpc/svcsock.c
>> @@ -41,6 +41,7 @@
>>   #include<net/ipv6.h>
>>   #include<net/tcp.h>
>>   #include<net/tcp_states.h>
>> +#include<net/net_namespace.h>
>>   #include<asm/uaccess.h>
>>   #include<asm/ioctls.h>
>>
>> @@ -1409,7 +1410,13 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
>>
>>   	/* Register socket with portmapper */
>>   	if (*errp>= 0&&  pmap_register)
>> -		*errp = svc_register(serv, sock->sk->sk_net, inet->sk_family,
>> +		*errp = svc_register(serv,
>> +#ifdef CONFIG_NET_NS
>> +				     sock->sk->sk_net,
>> +#else
>> +				&init_net,
>> +#endif
>> +				     inet->sk_family,
>>   				     inet->sk_protocol,
>>   				     ntohs(inet_sk(inet)->inet_sport));
>>
>> --
>> 1.7.9.rc0.23.g7e521
>
> Stanislav,
>
> Shouldn't we just be using a 'sock_net(sock->sk)'?
>

Yes, you right, Trond.
Should I fix it with a new patch?

-- 
Best regards,
Stanislav Kinsbursky

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

* linux-next: build failure after merge of the final tree (nfs tree related)
@ 2012-03-20  8:29 Stephen Rothwell
  2012-03-20 13:25 ` Myklebust, Trond
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2012-03-20  8:29 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-next, linux-kernel, Weston Andros Adamson

[-- Attachment #1: Type: text/plain, Size: 1398 bytes --]

Hi Trond,

[This was previously reported as a warning ... but sparc uses -Werr in
more places]

After merging the final tree, today's linux-next build (sparc64 defconfig)
failed like this:

In file included from arch/sparc/kernel/sys_sparc32.c:24:0:
include/linux/nfs_fs.h: In function 'nfs_display_fhandle_hash':
include/linux/nfs_fs.h:416:1: error: no return statement in function returning non-void [-Werror=return-type]

Caused by commit d8e0539ebdff ("NFS: add filehandle crc for debug display").

I added the following patch for today:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 20 Mar 2012 19:26:42 +1100
Subject: [PATCH] nfs: non void functions must return a value

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 include/linux/nfs_fs.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8f27c2e..69ec9cb 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -413,6 +413,7 @@ extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption);
 #else
 static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
 {
+	return 0;
 }
 static inline void nfs_display_fhandle(const struct nfs_fh *fh,
 				       const char *caption)
-- 
1.7.9.1

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: linux-next: build failure after merge of the final tree (nfs tree related)
  2012-03-20  8:29 Stephen Rothwell
@ 2012-03-20 13:25 ` Myklebust, Trond
  0 siblings, 0 replies; 10+ messages in thread
From: Myklebust, Trond @ 2012-03-20 13:25 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Adamson, Dros

On Tue, 2012-03-20 at 19:29 +1100, Stephen Rothwell wrote:
> Hi Trond,
> 
> [This was previously reported as a warning ... but sparc uses -Werr in
> more places]
> 
> After merging the final tree, today's linux-next build (sparc64 defconfig)
> failed like this:
> 
> In file included from arch/sparc/kernel/sys_sparc32.c:24:0:
> include/linux/nfs_fs.h: In function 'nfs_display_fhandle_hash':
> include/linux/nfs_fs.h:416:1: error: no return statement in function returning non-void [-Werror=return-type]
> 
> Caused by commit d8e0539ebdff ("NFS: add filehandle crc for debug display").
> 
> I added the following patch for today:
> 
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Tue, 20 Mar 2012 19:26:42 +1100
> Subject: [PATCH] nfs: non void functions must return a value
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>  include/linux/nfs_fs.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
> index 8f27c2e..69ec9cb 100644
> --- a/include/linux/nfs_fs.h
> +++ b/include/linux/nfs_fs.h
> @@ -413,6 +413,7 @@ extern void _nfs_display_fhandle(const struct nfs_fh *fh, const char *caption);
>  #else
>  static inline u32 nfs_display_fhandle_hash(const struct nfs_fh *fh)
>  {
> +	return 0;
>  }
>  static inline void nfs_display_fhandle(const struct nfs_fh *fh,
>  				       const char *caption)

Thanks Stephen! I've applied the above patch to my tree.

Cheers
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


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

* linux-next: build failure after merge of the final tree (nfs tree related)
@ 2013-11-18  2:20 Stephen Rothwell
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2013-11-18  2:20 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-next, linux-kernel, Anna Schumaker

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

Hi all,

After merging the final tree, today's linux-next build (powerpc
ppc44x_defconfig) failed like this:

fs/nfs/dir.c: In function 'nfs_readdir_xdr_to_array':
fs/nfs/dir.c:593:2: error: implicit declaration of function 'nfs4_label_alloc' [-Werror=implicit-function-declaration]
fs/nfs/dir.c:593:14: warning: assignment makes pointer from integer without a cast [enabled by default]
fs/nfs/dir.c:629:2: error: implicit declaration of function 'nfs4_label_free' [-Werror=implicit-function-declaration]
fs/nfs/dir.c: In function 'nfs_lookup_revalidate':
fs/nfs/dir.c:1088:8: warning: assignment makes pointer from integer without a cast [enabled by default]
fs/nfs/dir.c: In function 'nfs_lookup':
fs/nfs/dir.c:1296:8: warning: assignment makes pointer from integer without a cast [enabled by default]
fs/nfs/inode.c: In function '__nfs_revalidate_inode':
fs/nfs/inode.c:890:2: error: implicit declaration of function 'nfs4_label_alloc' [-Werror=implicit-function-declaration]
fs/nfs/inode.c:890:8: warning: assignment makes pointer from integer without a cast [enabled by default]
fs/nfs/inode.c:927:2: error: implicit declaration of function 'nfs4_label_free' [-Werror=implicit-function-declaration]
fs/nfs/super.c: In function 'nfs_parse_mount_options':
fs/nfs/super.c:1406:17: error: 'NFS4_MAX_MINOR_VERSION' undeclared (first use in this function)
fs/nfs/super.c:1406:17: note: each undeclared identifier is reported only once for each function it appears in

Presumably caused by commit 4b45df7999f9 ("NFS: Enabling v4.2 should not
recompile nfsd and lockd").

I have reverted that commit for today.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2013-11-18  2:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-18  2:20 linux-next: build failure after merge of the final tree (nfs tree related) Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2012-03-20  8:29 Stephen Rothwell
2012-03-20 13:25 ` Myklebust, Trond
2012-01-23  2:59 Stephen Rothwell
2012-01-23 18:10 ` Trond Myklebust
2012-01-24  8:38   ` Stanislav Kinsbursky
2010-09-30  3:58 Stephen Rothwell
2010-09-30 13:08 ` Bryan Schumaker
2010-08-04  4:54 Stephen Rothwell
2010-08-04 12:58 ` Trond Myklebust

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).