Skip to contentSkip to conversation

NFS: various small fixes and updates for conteinerization

PATCH In review Stanislav Kinsbursky 3 participants 9 messages Jan 26, 2012 – Feb 7, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover NFS: various small fixes and updates for conteinerization

Build fix and "init_net" replacements.

The following series consists of:

---

Stanislav Kinsbursky (5):
NFS: pass proper net rpc_pton() in nfs_dns_resolve_name()
NFS: build fixed in case of NFS_USE_NEW_IDMAPPER is undefined
NFS: search for client session id in proper network namespace
NFS: pass current net to rpc_pton() while parsing mount options
NFS: pass transport net to rpc_pton() while parse server name

 fs/nfs/callback.h      |    1 +
 fs/nfs/callback_proc.c |    2 +-
 fs/nfs/callback_xdr.c  |    1 +
 fs/nfs/client.c        |    4 ++--
 fs/nfs/dns_resolve.c   |    2 +-
 fs/nfs/idmap.c         |    1 +
 fs/nfs/internal.h      |    3 ++-
 fs/nfs/nfs4namespace.c |    6 +++---
 fs/nfs/super.c         |    4 ++--
 9 files changed, 14 insertions(+), 10 deletions(-)
#1 lore raw

PATCH 1/5 NFS: pass proper net rpc_pton() in nfs_dns_resolve_name()

---
 fs/nfs/dns_resolve.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/dns_resolve.c +1 -1
index be9a530..fcd8f1d 100644
@@ -20,7 +20,7 @@ ssize_t nfs_dns_resolve_name(struct net *net, char *name, size_t namelen,
 
 	ip_len = dns_query(NULL, name, namelen, NULL, &ip_addr, NULL);
 	if (ip_len > 0)
-		ret = rpc_pton(&init_net, ip_addr, ip_len, sa, salen);
+		ret = rpc_pton(net, ip_addr, ip_len, sa, salen);
 	else
 		ret = -ESRCH;
 	kfree(ip_addr);
#2 lore raw

PATCH 2/5 NFS: build fixed in case of NFS_USE_NEW_IDMAPPER is undefined

In reply to Stanislav Kinsbursky
---
 fs/nfs/idmap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/idmap.c +1 -0
index aed3d2e..04f58d4 100644
@@ -378,6 +378,7 @@ int nfs_map_gid_to_group(const struct nfs_server *server, __u32 gid, char *buf,
 
 #include "nfs4_fs.h"
 #include "internal.h"
+#include "netns.h"
 
 #define IDMAP_HASH_SZ          128
 
#3 lore raw

PATCH 3/5 NFS: search for client session id in proper network namespace

In reply to Stanislav Kinsbursky

Network namespace is taken from request transport and passed as a part of cb_process_state structure.

---
 fs/nfs/callback.h      |    1 +
 fs/nfs/callback_proc.c |    2 +-
 fs/nfs/callback_xdr.c  |    1 +
 fs/nfs/client.c        |    4 ++--
 fs/nfs/internal.h      |    3 ++-
 5 files changed, 7 insertions(+), 4 deletions(-)
fs/nfs/callback.h +1 -0
index c89d3b9..197e0d3 100644
@@ -39,6 +39,7 @@ struct cb_process_state {
 	__be32			drc_status;
 	struct nfs_client	*clp;
 	int			slotid;
+	struct net		*net;
 };
 
 struct cb_compound_hdr_arg {
fs/nfs/callback_proc.c +1 -1
index 0e6e63f..f71978d 100644
@@ -461,7 +461,7 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
 	int i;
 	__be32 status = htonl(NFS4ERR_BADSESSION);
 
-	clp = nfs4_find_client_sessionid(args->csa_addr, &args->csa_sessionid);
+	clp = nfs4_find_client_sessionid(cps->net, args->csa_addr, &args->csa_sessionid);
 	if (clp == NULL)
 		goto out;
 
fs/nfs/callback_xdr.c +1 -0
index f2be3e1e..8c2a969 100644
@@ -861,6 +861,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 		.drc_status = 0,
 		.clp = NULL,
 		.slotid = -1,
+		.net = rqstp->rq_xprt->xpt_net,
 	};
 	unsigned int nops = 0;
 
fs/nfs/client.c +2 -2
index 9e11d29..2328dcb 100644
@@ -1232,11 +1232,11 @@ nfs4_find_client_ident(struct net *net, int cb_ident)
  * Returns NULL if no such client
  */
 struct nfs_client *
-nfs4_find_client_sessionid(const struct sockaddr *addr,
+nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
 			   struct nfs4_sessionid *sid)
 {
 	struct nfs_client *clp;
-	struct nfs_net *nn = net_generic(&init_net, nfs_net_id);
+	struct nfs_net *nn = net_generic(net, nfs_net_id);
 
 	spin_lock(&nn->nfs_client_lock);
 	list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
fs/nfs/internal.h +2 -1
index b38b733..0c3648a 100644
@@ -152,7 +152,8 @@ extern void nfs_cleanup_cb_ident_idr(struct net *);
 extern void nfs_put_client(struct nfs_client *);
 extern struct nfs_client *nfs4_find_client_ident(struct net *, int);
 extern struct nfs_client *
-nfs4_find_client_sessionid(const struct sockaddr *, struct nfs4_sessionid *);
+nfs4_find_client_sessionid(struct net *, const struct sockaddr *,
+				struct nfs4_sessionid *);
 extern struct nfs_server *nfs_create_server(
 					const struct nfs_parsed_mount_data *,
 					struct nfs_fh *);
#4 lore raw

Re: [PATCH 3/5] NFS: search for client session id in proper network namespace

Quoted 55 lines · Stanislav Kinsbursky

Network namespace is taken from request transport and passed as a part of cb_process_state structure.

---
 fs/nfs/callback.h      |    1 +
 fs/nfs/callback_proc.c |    2 +-
 fs/nfs/callback_xdr.c  |    1 +
 fs/nfs/client.c        |    4 ++--
 fs/nfs/internal.h      |    3 ++-
 5 files changed, 7 insertions(+), 4 deletions(-)
fs/nfs/callback.h +1 -0
index c89d3b9..197e0d3 100644
@@ -39,6 +39,7 @@ struct cb_process_state {
 	__be32			drc_status;
 	struct nfs_client	*clp;
 	int			slotid;
+	struct net		*net;
 };
 
 struct cb_compound_hdr_arg {
fs/nfs/callback_proc.c +1 -1
index 0e6e63f..f71978d 100644
@@ -461,7 +461,7 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
 	int i;
 	__be32 status = htonl(NFS4ERR_BADSESSION);
 
-	clp = nfs4_find_client_sessionid(args->csa_addr, &args->csa_sessionid);
+	clp = nfs4_find_client_sessionid(cps->net, args->csa_addr, &args->csa_sessionid);
 	if (clp == NULL)
 		goto out;
 
fs/nfs/callback_xdr.c +1 -0
index f2be3e1e..8c2a969 100644
@@ -861,6 +861,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 		.drc_status = 0,
 		.clp = NULL,
 		.slotid = -1,
+		.net = rqstp->rq_xprt->xpt_net,
 	};
 	unsigned int nops = 0;
 
fs/nfs/client.c +0 -0
index 9e11d29..2328dcb 100644

fs/nfs/client.c nfs4_find_client_ident(struct net *net, int cb_ident) · line 1239

Quoted 10 lines
fs/nfs/client.c +2 -2
@@ -1232,11 +1232,11 @@ nfs4_find_client_ident(struct net *net, int cb_ident)
  * Returns NULL if no such client
  */
 struct nfs_client *
-nfs4_find_client_sessionid(const struct sockaddr *addr,
+nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
 			   struct nfs4_sessionid *sid)
 {
 	struct nfs_client *clp;
-	struct nfs_net *nn = net_generic(&init_net, nfs_net_id);
+	struct nfs_net *nn = net_generic(net, nfs_net_id);

Hi,

You changed this function for the v4.1 case, but not for v4.0 (this is what I was trying to bisect earlier). Without CONFIG_NFS_V4_1 set, I get this:

make[1]: Nothing to be done for `all'.

  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC [M]  fs/nfs/client.o

fs/nfs/client.c:1265:1: error: conflicting types for 'nfs4_find_client_sessionid' fs/nfs/internal.h:155:1: note: previous declaration of 'nfs4_find_client_sessionid' was here make[2]: *** [fs/nfs/client.o] Error 1
make[1]: *** [fs/nfs] Error 2
make: *** [fs] Error 2

- Bryan

Quoted 22 lines
fs/nfs/client.c +0 -0
 	spin_lock(&nn->nfs_client_lock);
 	list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
fs/nfs/internal.h +2 -2
index b38b733..0c3648a 100644
@@ -152,7 +152,8 @@ extern void nfs_cleanup_cb_ident_idr(struct net *);
 extern void nfs_put_client(struct nfs_client *);
 extern struct nfs_client *nfs4_find_client_ident(struct net *, int);
 extern struct nfs_client *
-nfs4_find_client_sessionid(const struct sockaddr *, struct nfs4_sessionid *);
+nfs4_find_client_sessionid(struct net *, const struct sockaddr *,
+				struct nfs4_sessionid *);
 extern struct nfs_server *nfs_create_server(
 					const struct nfs_parsed_mount_data *,
 					struct nfs_fh *);
 
--

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

#5 lore raw

Re: [PATCH 3/5] NFS: search for client session id in proper network namespace

07.02.2012 19:43, Bryan Schumaker пишет:

Quoted 6 lines

Hi,

You changed this function for the v4.1 case, but not for v4.0 (this is what I was trying to bisect earlier). Without CONFIG_NFS_V4_1 set, I get this:

Sorry. Thank for the catch.
I'll send patch soon.

Quoted 7 lines

make[1]: Nothing to be done for `all'.

   CHK     include/linux/version.h
   CHK     include/generated/utsrelease.h
   CALL    scripts/checksyscalls.sh
   CHK     include/generated/compile.h
   CHK     kernel/config_data.h
   CC [M]  fs/nfs/client.o
Quoted 8 lines

fs/nfs/client.c:1265:1: error: conflicting types for 'nfs4_find_client_sessionid' fs/nfs/internal.h:155:1: note: previous declaration of 'nfs4_find_client_sessionid' was here make[2]: *** [fs/nfs/client.o] Error 1
make[1]: *** [fs/nfs] Error 2
make: *** [fs] Error 2

- Bryan

d

Signature · 2 lines
Best regards,
Stanislav Kinsbursky
#6 lore raw

Re: [PATCH 3/5] NFS: search for client session id in proper network namespace

In reply to Bryan Schumaker
Quoted 80 lines · Bryan Schumaker
Quoted 55 lines · Stanislav Kinsbursky

Network namespace is taken from request transport and passed as a part of cb_process_state structure.

---
 fs/nfs/callback.h      |    1 +
 fs/nfs/callback_proc.c |    2 +-
 fs/nfs/callback_xdr.c  |    1 +
 fs/nfs/client.c        |    4 ++--
 fs/nfs/internal.h      |    3 ++-
 5 files changed, 7 insertions(+), 4 deletions(-)
fs/nfs/callback.h +1 -0
index c89d3b9..197e0d3 100644
@@ -39,6 +39,7 @@ struct cb_process_state {
 	__be32			drc_status;
 	struct nfs_client	*clp;
 	int			slotid;
+	struct net		*net;
 };
 
 struct cb_compound_hdr_arg {
fs/nfs/callback_proc.c +1 -1
index 0e6e63f..f71978d 100644
@@ -461,7 +461,7 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
 	int i;
 	__be32 status = htonl(NFS4ERR_BADSESSION);
 
-	clp = nfs4_find_client_sessionid(args->csa_addr, &args->csa_sessionid);
+	clp = nfs4_find_client_sessionid(cps->net, args->csa_addr, &args->csa_sessionid);
 	if (clp == NULL)
 		goto out;
 
fs/nfs/callback_xdr.c +1 -0
index f2be3e1e..8c2a969 100644
@@ -861,6 +861,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 		.drc_status = 0,
 		.clp = NULL,
 		.slotid = -1,
+		.net = rqstp->rq_xprt->xpt_net,
 	};
 	unsigned int nops = 0;
 
fs/nfs/client.c +0 -0
index 9e11d29..2328dcb 100644

fs/nfs/client.c nfs4_find_client_ident(struct net *net, int cb_ident) · line 1239

Quoted 10 lines
fs/nfs/client.c +2 -2
@@ -1232,11 +1232,11 @@ nfs4_find_client_ident(struct net *net, int cb_ident)
  * Returns NULL if no such client
  */
 struct nfs_client *
-nfs4_find_client_sessionid(const struct sockaddr *addr,
+nfs4_find_client_sessionid(struct net *net, const struct sockaddr *addr,
 			   struct nfs4_sessionid *sid)
 {
 	struct nfs_client *clp;
-	struct nfs_net *nn = net_generic(&init_net, nfs_net_id);
+	struct nfs_net *nn = net_generic(net, nfs_net_id);

Hi,

You changed this function for the v4.1 case, but not for v4.0 (this is what I was trying to bisect earlier). Without CONFIG_NFS_V4_1 set, I get this:

make[1]: Nothing to be done for `all'.

  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CC [M]  fs/nfs/client.o
Quoted 5 lines

fs/nfs/client.c:1265:1: error: conflicting types for 'nfs4_find_client_sessionid' fs/nfs/internal.h:155:1: note: previous declaration of 'nfs4_find_client_sessionid' was here make[2]: *** [fs/nfs/client.o] Error 1
make[1]: *** [fs/nfs] Error 2
make: *** [fs] Error 2

Thanks for tracking this down Bryan!

Signature · 6 lines
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
#7 lore raw

PATCH 4/5 NFS: pass current net to rpc_pton() while parsing mount options

In reply to Stanislav Kinsbursky
---
 fs/nfs/super.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/nfs/super.c +2 -2
index b79f2a1..5ed6071 100644
@@ -1408,7 +1408,7 @@ static int nfs_parse_mount_options(char *raw,
 			if (string == NULL)
 				goto out_nomem;
 			mnt->nfs_server.addrlen =
-				rpc_pton(&init_net, string, strlen(string),
+				rpc_pton(mnt->net, string, strlen(string),
 					(struct sockaddr *)
 					&mnt->nfs_server.address,
 					sizeof(mnt->nfs_server.address));
@@ -1430,7 +1430,7 @@ static int nfs_parse_mount_options(char *raw,
 			if (string == NULL)
 				goto out_nomem;
 			mnt->mount_server.addrlen =
-				rpc_pton(&init_net, string, strlen(string),
+				rpc_pton(mnt->net, string, strlen(string),
 					(struct sockaddr *)
 					&mnt->mount_server.address,
 					sizeof(mnt->mount_server.address));

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

#8 lore raw

PATCH 5/5 NFS: pass transport net to rpc_pton() while parse server name

In reply to Stanislav Kinsbursky
---
 fs/nfs/nfs4namespace.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/nfs/nfs4namespace.c +3 -3
index 48a9acd..667ea74 100644
@@ -97,11 +97,11 @@ static size_t nfs_parse_server_name(char *string, size_t len,
 		struct sockaddr *sa, size_t salen, struct nfs_server *server)
 {
 	ssize_t ret;
+	struct net *net = server->client->cl_xprt->xprt_net;
 
-	ret = rpc_pton(&init_net, string, len, sa, salen);
+	ret = rpc_pton(net, string, len, sa, salen);
 	if (ret == 0) {
-		ret = nfs_dns_resolve_name(server->client->cl_xprt->xprt_net,
-					   string, len, sa, salen);
+		ret = nfs_dns_resolve_name(net, string, len, sa, salen);
 		if (ret < 0)
 			ret = 0;
 	}