From: Stephen Rothwell on
Hi all,

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

net/dns_resolver/dns_key.c: In function 'dns_resolver_instantiate':
net/dns_resolver/dns_key.c:70: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:70: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:99: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:128: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:136: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:143: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:144: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:149: error: implicit declaration of function 'key_payload_reserve'
net/dns_resolver/dns_key.c:162: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c: In function 'dns_resolver_match':
net/dns_resolver/dns_key.c:178: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c: In function 'dns_resolver_describe':
net/dns_resolver/dns_key.c:211: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:213: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c:217: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_key.c: At top level:
net/dns_resolver/dns_key.c:220: error: variable 'key_type_dns_resolver' has initializer but incomplete type
net/dns_resolver/dns_key.c:221: error: unknown field 'name' specified in initializer
net/dns_resolver/dns_key.c:221: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:221: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c:222: error: unknown field 'instantiate' specified in initializer
net/dns_resolver/dns_key.c:222: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:222: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c:223: error: unknown field 'match' specified in initializer
net/dns_resolver/dns_key.c:223: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:223: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c:224: error: unknown field 'revoke' specified in initializer
net/dns_resolver/dns_key.c:224: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:224: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c:225: error: unknown field 'destroy' specified in initializer
net/dns_resolver/dns_key.c:225: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:225: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c:226: error: unknown field 'describe' specified in initializer
net/dns_resolver/dns_key.c:226: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:226: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c:227: error: unknown field 'read' specified in initializer
net/dns_resolver/dns_key.c:227: warning: excess elements in struct initializer
net/dns_resolver/dns_key.c:227: warning: (near initialization for 'key_type_dns_resolver')
net/dns_resolver/dns_key.c: In function 'init_dns_resolver':
net/dns_resolver/dns_key.c:237: error: invalid use of undefined type 'struct key_type'
net/dns_resolver/dns_key.c:249: error: implicit declaration of function 'key_alloc'
net/dns_resolver/dns_key.c:249: error: 'key_type_keyring' undeclared (first use in this function)
net/dns_resolver/dns_key.c:249: error: (Each undeclared identifier is reported only once
net/dns_resolver/dns_key.c:249: error: for each function it appears in.)
net/dns_resolver/dns_key.c:250: error: 'KEY_POS_ALL' undeclared (first use in this function)
net/dns_resolver/dns_key.c:250: error: 'KEY_POS_SETATTR' undeclared (first use in this function)
net/dns_resolver/dns_key.c:251: error: 'KEY_USR_VIEW' undeclared (first use in this function)
net/dns_resolver/dns_key.c:251: error: 'KEY_USR_READ' undeclared (first use in this function)
net/dns_resolver/dns_key.c:252: error: 'KEY_ALLOC_NOT_IN_QUOTA' undeclared (first use in this function)
net/dns_resolver/dns_key.c:258: error: implicit declaration of function 'key_instantiate_and_link'
net/dns_resolver/dns_key.c:262: error: implicit declaration of function 'register_key_type'
net/dns_resolver/dns_key.c:268: error: 'struct cred' has no member named 'thread_keyring'
net/dns_resolver/dns_key.c:269: error: 'struct cred' has no member named 'jit_keyring'
net/dns_resolver/dns_key.c: In function 'exit_dns_resolver':
net/dns_resolver/dns_key.c:285: error: implicit declaration of function 'unregister_key_type'
net/dns_resolver/dns_key.c:288: error: invalid use of undefined type 'struct key_type'
net/dns_resolver/dns_query.c: In function 'dns_query':
net/dns_resolver/dns_query.c:124: error: implicit declaration of function 'request_key'
net/dns_resolver/dns_query.c:124: warning: assignment makes pointer from integer without a cast
net/dns_resolver/dns_query.c:132: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_query.c:133: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_query.c:133: error: 'KEY_USR_VIEW' undeclared (first use in this function)
net/dns_resolver/dns_query.c:133: error: (Each undeclared identifier is reported only once
net/dns_resolver/dns_query.c:133: error: for each function it appears in.)
net/dns_resolver/dns_query.c:140: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_query.c:144: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_query.c:155: error: dereferencing pointer to incomplete type
net/dns_resolver/dns_query.c:159: error: dereferencing pointer to incomplete type

Presumably this code has not been built on powerpc before. Casued by
commit 1a4240f4764ac78adbf4b0ebb49b3bd8c72ffa11 ("DNS: Separate out CIFS
DNS Resolver code") (and the build was probably enabled by commit
c2e8139c9f797baa46515af6d350c51823736cbb ("NFS: Use kernel DNS resolver
[ver #2]").

I can only imagine that linux/key.h is included indirectly on x86.

I have used the version of cifs tree from next-20100811 for today.
--
Cheers,
Stephen Rothwell sfr(a)canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
From: Steve French on
On Wed, Aug 11, 2010 at 10:17 PM, Stephen Rothwell <sfr(a)canb.auug.org.au> wrote:
> After merging the cifs tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
>
> net/dns_resolver/dns_key.c: In function 'dns_resolver_instantiate':
> net/dns_resolver/dns_key.c:70: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:70: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:99: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:128: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:136: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:143: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:144: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:149: error: implicit declaration of function 'key_payload_reserve'
> net/dns_resolver/dns_key.c:162: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c: In function 'dns_resolver_match':
> net/dns_resolver/dns_key.c:178: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c: In function 'dns_resolver_describe':
> net/dns_resolver/dns_key.c:211: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:213: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c:217: error: dereferencing pointer to incomplete type
> net/dns_resolver/dns_key.c: At top level:
> net/dns_resolver/dns_key.c:220: error: variable 'key_type_dns_resolver' has initializer but incomplete type
> net/dns_resolver/dns_key.c:221: error: unknown field 'name' specified in initializer
> net/dns_resolver/dns_key.c:221: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:221: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c:222: error: unknown field 'instantiate' specified in initializer
> net/dns_resolver/dns_key.c:222: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:222: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c:223: error: unknown field 'match' specified in initializer
> net/dns_resolver/dns_key.c:223: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:223: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c:224: error: unknown field 'revoke' specified in initializer
> net/dns_resolver/dns_key.c:224: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:224: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c:225: error: unknown field 'destroy' specified in initializer
> net/dns_resolver/dns_key.c:225: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:225: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c:226: error: unknown field 'describe' specified in initializer
> net/dns_resolver/dns_key.c:226: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:226: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c:227: error: unknown field 'read' specified in initializer
> net/dns_resolver/dns_key.c:227: warning: excess elements in struct initializer
> net/dns_resolver/dns_key.c:227: warning: (near initialization for 'key_type_dns_resolver')
> net/dns_resolver/dns_key.c: In function 'init_dns_resolver':
> net/dns_resolver/dns_key.c:237: error: invalid use of undefined type 'struct key_type'
> net/dns_resolver/dns_key.c:249: error: implicit declaration of function 'key_alloc'
> net/dns_resolver/dns_key.c:249: error: 'key_type_keyring' undeclared (first use in this function)
> net/dns_resolver/dns_key.c:249: error: (Each undeclared identifier is reported only once
> net/dns_resolver/dns_key.c:249: error: for each function it appears in.)
> net/dns_resolver/dns_key.c:250: error: 'KEY_POS_ALL' undeclared (first use in this function)
> net/dns_resolver/dns_key.c:250: error: 'KEY_POS_SETATTR' undeclared (first use in this function)
> net/dns_resolver/dns_key.c:251: error: 'KEY_USR_VIEW' undeclared (first use in this function)
> net/dns_resolver/dns_key.c:251: error: 'KEY_USR_READ' undeclared (first use in this function)
> net/dns_resolver/dns_key.c:252: error: 'KEY_ALLOC_NOT_IN_QUOTA' undeclared (first use in this function)
> net/dns_resolver/dns_key.c:258: error: implicit declaration of function 'key_instantiate_and_link'
> net/dns_resolver/dns_key.c:262: error: implicit declaration of function 'register_key_type'
> net/dns_resolver/dns_key.c:268: error: 'struct cred' has no member named 'thread_keyring'
> net/dns_resolver/dns_key.c:269: error: 'struct cred' has no member named 'jit_keyring'
> net/dns_resolver/dns_key.c: In function 'exit_dns_resolver':
> net/dns_resolver/dns_key.c:285: error: implicit declaration of function 'unregister_key_type'
> net/dns_resolver/dns_key.c:288: error: invalid use of undefined type 'struct key_type'

> Presumably this code has not been built on powerpc before. �Casued by
> commit 1a4240f4764ac78adbf4b0ebb49b3bd8c72ffa11 ("DNS: Separate out CIFS
> DNS Resolver code") (and the build was probably enabled by commit
> c2e8139c9f797baa46515af6d350c51823736cbb ("NFS: Use kernel DNS resolver
> [ver #2]").
>
> I can only imagine that linux/key.h is included indirectly on x86.
Are you sure that this is a valid config file? CONFIG_KEYS should be
set if CONFIG_DNS_RESOLVER is set?

key.h looks like it is included in all arch in this path

net/dns_resolver/dns_key.c includes
include/keys/dns_resolver-type.h which includes
include/linux/key-type.h which includes
include/linux/key.h

the line 258 "key_instantiate_and_link" error could occur if
"CONFIG_KEYS" is not set in .config
net/dns_resolver/Kconfig config DNS_RESOLVER "depends on NET && KEYS"
so ... CONFIG_KEYS should be set ....







--
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Stephen Rothwell on
Hi Steve,

On Wed, 11 Aug 2010 23:04:36 -0500 Steve French <smfrench(a)gmail.com> wrote:
>
> Are you sure that this is a valid config file? CONFIG_KEYS should be
> set if CONFIG_DNS_RESOLVER is set?

It is a ppc64_defconfig. It has:

# CONFIG_KEYS is not set
CONFIG_DNS_RESOLVER=y

CONFIG_NFS_USE_KERNEL_DNS just selects CONFIG_DNS_RESOLVER but there is
no dependency on CONFIG_KEYS (select does not care about the
dependencies of the selected config option).

> key.h looks like it is included in all arch in this path
>
> net/dns_resolver/dns_key.c includes
> include/keys/dns_resolver-type.h which includes
> include/linux/key-type.h which includes
> include/linux/key.h
>
> the line 258 "key_instantiate_and_link" error could occur if
> "CONFIG_KEYS" is not set in .config

Which t isn't.

> net/dns_resolver/Kconfig config DNS_RESOLVER "depends on NET && KEYS"
> so ... CONFIG_KEYS should be set ....

See above. You need CONFIG_NFS_USE_KERNEL_DNS to also depend on
CONFIG_KEYS ...

--
Cheers,
Stephen Rothwell sfr(a)canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
From: Bryan Schumaker on
Hi

I updated my NFS DNS patch. The new version will set CONFIG_KEYS when CONFIG_NFS_USE_KERNEL_DNS is set.

Thanks for letting me know about this!

Bryan Schumaker



Use the kernel DNS resolver to translate hostnames to IP addresses. Create a
new config option to choose between the legacy DNS resolver and the new
resolver.

Signed-off-by: Bryan Schumaker <bjschuma(a)netapp.com>
Acked-by: Trond Myklebust <Trond.Myklebust(a)netapp.com>
---
Fix for KEYS dependency

fs/nfs/Kconfig | 16 ++++++++++++++++
fs/nfs/dns_resolve.c | 24 ++++++++++++++++++++++++
fs/nfs/dns_resolve.h | 12 ++++++++++++
3 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index cc1bb33..c5bbdca 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -100,3 +100,19 @@ config NFS_FSCACHE
help
Say Y here if you want NFS data to be cached locally on disc through
the general filesystem cache manager
+
+config NFS_USE_LEGACY_DNS
+ bool "Use the legacy NFS DNS resolver"
+ depends on NFS_V4
+ help
+ The kernel now provides a method for translating a host name into an
+ IP address. Select Y here if you would rather use your own DNS
+ resolver script.
+
+ If unsure, say N
+
+config NFS_USE_KERNEL_DNS
+ bool
+ depends on NFS_V4 && !NFS_USE_LEGACY_DNS
+ select DNS_RESOLVER
+ select KEYS
+ default y
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c
index 76fd235..dba50a5 100644
--- a/fs/nfs/dns_resolve.c
+++ b/fs/nfs/dns_resolve.c
@@ -6,6 +6,29 @@
* Resolves DNS hostnames into valid ip addresses
*/

+#ifdef CONFIG_NFS_USE_KERNEL_DNS
+
+#include <linux/sunrpc/clnt.h>
+#include <linux/dns_resolver.h>
+
+ssize_t nfs_dns_resolve_name(char *name, size_t namelen,
+ struct sockaddr *sa, size_t salen)
+{
+ ssize_t ret;
+ char *ip_addr = NULL;
+ int ip_len;
+
+ ip_len = dns_query(NULL, name, namelen, NULL, &ip_addr, NULL);
+ if (ip_len > 0)
+ ret = rpc_pton(ip_addr, ip_len, sa, salen);
+ else
+ ret = -ESRCH;
+ kfree(ip_addr);
+ return ret;
+}
+
+#else
+
#include <linux/hash.h>
#include <linux/string.h>
#include <linux/kmod.h>
@@ -346,3 +369,4 @@ void nfs_dns_resolver_destroy(void)
nfs_cache_unregister(&nfs_dns_resolve);
}

+#endif
diff --git a/fs/nfs/dns_resolve.h b/fs/nfs/dns_resolve.h
index a3f0938..199bb55 100644
--- a/fs/nfs/dns_resolve.h
+++ b/fs/nfs/dns_resolve.h
@@ -6,8 +6,20 @@

#define NFS_DNS_HOSTNAME_MAXLEN (128)

+
+#ifdef CONFIG_NFS_USE_KERNEL_DNS
+static inline int nfs_dns_resolver_init(void)
+{
+ return 0;
+}
+
+static inline void nfs_dns_resolver_destroy(void)
+{}
+#else
extern int nfs_dns_resolver_init(void);
extern void nfs_dns_resolver_destroy(void);
+#endif
+
extern ssize_t nfs_dns_resolve_name(char *name, size_t namelen,
struct sockaddr *sa, size_t salen);




On 08/12/2010 03:46 AM, Stephen Rothwell wrote:
> Hi Steve,
>
> On Wed, 11 Aug 2010 23:04:36 -0500 Steve French <smfrench(a)gmail.com> wrote:
>>
>> Are you sure that this is a valid config file? CONFIG_KEYS should be
>> set if CONFIG_DNS_RESOLVER is set?
>
> It is a ppc64_defconfig. It has:
>
> # CONFIG_KEYS is not set
> CONFIG_DNS_RESOLVER=y
>
> CONFIG_NFS_USE_KERNEL_DNS just selects CONFIG_DNS_RESOLVER but there is
> no dependency on CONFIG_KEYS (select does not care about the
> dependencies of the selected config option).
>
>> key.h looks like it is included in all arch in this path
>>
>> net/dns_resolver/dns_key.c includes
>> include/keys/dns_resolver-type.h which includes
>> include/linux/key-type.h which includes
>> include/linux/key.h
>>
>> the line 258 "key_instantiate_and_link" error could occur if
>> "CONFIG_KEYS" is not set in .config
>
> Which t isn't.
>
>> net/dns_resolver/Kconfig config DNS_RESOLVER "depends on NET && KEYS"
>> so ... CONFIG_KEYS should be set ....
>
> See above. You need CONFIG_NFS_USE_KERNEL_DNS to also depend on
> CONFIG_KEYS ...
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on
Steve French <smfrench(a)gmail.com> wrote:

> net/dns_resolver/Kconfig config DNS_RESOLVER "depends on NET && KEYS"
> so ... CONFIG_KEYS should be set ....

Perhaps it needs to select CONFIG_KEYS instead?

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/