linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Use MDS session for dual role MDS/DS
@ 2010-05-12 17:39 andros
  2010-05-12 17:39 ` [PATCH 1/3] SQUASHME pnfs_submit: use MDS session for dual MDS/DS andros
  0 siblings, 1 reply; 6+ messages in thread
From: andros @ 2010-05-12 17:39 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs


Plus some clean ups.

Use the MDS session for the data server traffic only
if EXCHGID4_FLAG_USE_PNFS_DS is set as an MDS clientid pNFS role

0001-SQUASHME-pnfs_submit-use-MDS-session-for-dual-MDS-DS.patch
0002-SQUASHME-pnfs_submit-update-DS-nfs4_set_client.patch
0003-SQUASHME-pnfs_submit-cleanup-DS-exchange-flag-proces.patch


Testing:
CONFIG_NFS_V4_1 set:
pNFS, NFSv41, NFSv4 mount passes Connectathon tests.
    
CONFIG_NFS_V4_1 not set:
NFSv4 mount passes Connectathon tests.

-->Andy


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

* [PATCH 1/3] SQUASHME pnfs_submit: use MDS session for dual MDS/DS
  2010-05-12 17:39 [PATCH 0/3] Use MDS session for dual role MDS/DS andros
@ 2010-05-12 17:39 ` andros
  2010-05-12 17:39   ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client andros
  0 siblings, 1 reply; 6+ messages in thread
From: andros @ 2010-05-12 17:39 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Andy Adamson

From: Andy Adamson <andros@netapp.com>

We currently only have one session per clientid. If the deviceid maps the MDS
server as a data server, use the MDS session for the data server traffic only
if EXCHGID4_FLAG_USE_PNFS_DS is set as an MDS clientid pNFS role.

Squash into "pnfs: filelayout: device ops"

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/client.c            |    3 ++-
 fs/nfs/internal.h          |    2 ++
 fs/nfs/nfs4filelayoutdev.c |   20 +++++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 0337330..1979831 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -348,7 +348,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
  * Test if two socket addresses represent the same actual socket,
  * by comparing (only) relevant fields, including the port number.
  */
-static int nfs_sockaddr_cmp(const struct sockaddr *sa1,
+int nfs_sockaddr_cmp(const struct sockaddr *sa1,
 			    const struct sockaddr *sa2)
 {
 	if (sa1->sa_family != sa2->sa_family)
@@ -362,6 +362,7 @@ static int nfs_sockaddr_cmp(const struct sockaddr *sa1,
 	}
 	return 0;
 }
+EXPORT_SYMBOL(nfs_sockaddr_cmp);
 
 /*
  * Find a client by IP address and protocol version
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 83f2953..92f3231 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -139,6 +139,8 @@ extern struct nfs_server *nfs_clone_server(struct nfs_server *,
 					   struct nfs_fattr *);
 extern void nfs_mark_client_ready(struct nfs_client *clp, int state);
 extern int nfs4_check_client_ready(struct nfs_client *clp);
+extern int nfs_sockaddr_cmp(const struct sockaddr *sa1,
+		const struct sockaddr *sa2);
 extern int nfs4_set_client(struct nfs_server *server,
 		const char *hostname,
 		const struct sockaddr *addr,
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 462f6de..891c31d 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -126,7 +126,8 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 	};
 	struct sockaddr_in	sin;
 	struct rpc_clnt 	*mds_clnt = mds_srv->client;
-	struct nfs_client 	*clp;
+	struct nfs_client	*clp = mds_srv->nfs_client;
+	struct sockaddr		*mds_addr;
 	char			ip_addr[16];
 	int			addrlen;
 	int err = 0;
@@ -138,6 +139,23 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 	sin.sin_addr.s_addr = ds->ds_ip_addr;
 	sin.sin_port = ds->ds_port;
 
+	/*
+	 * If this DS is also the MDS, use the MDS session only if the
+	 * MDS exchangeid flags show the EXCHGID4_FLAG_USE_PNFS_DS pNFS role.
+	 */
+	mds_addr = (struct sockaddr *)&clp->cl_addr;
+	if (nfs_sockaddr_cmp((struct sockaddr *)&sin, mds_addr)) {
+		if (!(clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_DS)) {
+			printk(KERN_INFO "ip:port %s is not a pNFS Data "
+				"Server\n", ds->r_addr);
+			err = -ENODEV;
+		} else {
+			atomic_inc(&clp->cl_count);
+			ds->ds_clp = clp;
+			dprintk("%s Using MDS Session for DS\n", __func__);
+		}
+		goto out;
+	}
 	/* Set timeout to the mds rpc clnt value.
 	 * XXX - find the correct authflavor....
 	 *
-- 
1.6.6


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

* [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client
  2010-05-12 17:39 ` [PATCH 1/3] SQUASHME pnfs_submit: use MDS session for dual MDS/DS andros
@ 2010-05-12 17:39   ` andros
  2010-05-12 17:39     ` [PATCH 3/3] SQUASHME pnfs_submit: cleanup DS exchange flag processing andros
  2010-05-13 19:13     ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client Batsakis, Alexandros
  0 siblings, 2 replies; 6+ messages in thread
From: andros @ 2010-05-12 17:39 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Andy Adamson

From: Andy Adamson <andros@netapp.com>

Dont bother using the hostname, use the client ipaddr field from the MDS
nfs_client for construction of the co_ownrid field the DS EXCHANGE_ID.

Clean up the comments.

Squash into "pnfs: filelayout: device ops"

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4filelayoutdev.c |   28 +++++-----------------------
 1 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 891c31d..b41f437 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -128,8 +128,6 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 	struct rpc_clnt 	*mds_clnt = mds_srv->client;
 	struct nfs_client	*clp = mds_srv->nfs_client;
 	struct sockaddr		*mds_addr;
-	char			ip_addr[16];
-	int			addrlen;
 	int err = 0;
 
 	dprintk("--> %s ip:port %s au_flavor %d\n", __func__,
@@ -156,32 +154,16 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 		}
 		goto out;
 	}
-	/* Set timeout to the mds rpc clnt value.
-	 * XXX - find the correct authflavor....
-	 *
-	 * Fake a client ipaddr (used for sessionid) with hostname
-	 * Use hostname since it might be more unique than ipaddr (which
-	 * could be set to the loopback 127.0.0/1.1
-	 *
-	 * XXX: Should sessions continue to use the cl_ipaddr field?
-	 */
-	addrlen = strnlen(utsname()->nodename, sizeof(utsname()->nodename));
-	if (addrlen > sizeof(ip_addr))
-		addrlen = sizeof(ip_addr);
-	memcpy(ip_addr, utsname()->nodename, addrlen);
-
-	/* XXX need a non-nfs_client struct interface to set up
-	 * data server sessions
-	 *
-	 * tmp: nfs4_set_client sets the nfs_server->nfs_client.
-	 *
-	 * We specify a retrans and timeout interval equual to MDS. ??
+	/*
+	 * Set a retrans, timeout interval, and authflavor equual to the MDS
+	 * values. Use the MDS nfs_client cl_ipaddr field so as to use the
+	 * same co_ownerid as the MDS.
 	 */
 	err = nfs4_set_client(&tmp,
 			      mds_srv->nfs_client->cl_hostname,
 			      (struct sockaddr *)&sin,
 			      sizeof(struct sockaddr),
-			      ip_addr,
+			      mds_srv->nfs_client->cl_ipaddr,
 			      mds_clnt->cl_auth->au_flavor,
 			      IPPROTO_TCP,
 			      mds_clnt->cl_xprt->timeout,
-- 
1.6.6


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

* [PATCH 3/3] SQUASHME pnfs_submit: cleanup DS exchange flag processing
  2010-05-12 17:39   ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client andros
@ 2010-05-12 17:39     ` andros
  2010-05-13 19:13     ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client Batsakis, Alexandros
  1 sibling, 0 replies; 6+ messages in thread
From: andros @ 2010-05-12 17:39 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Andy Adamson

From: Andy Adamson <andros@netapp.com>

Squash into "pnfs: filelayout: device ops"

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4filelayoutdev.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index b41f437..b04c9d9 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -173,18 +173,16 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 
 	clp = tmp.nfs_client;
 
-	/* Set exchange id and create session flags and setup session */
+	/* Ask for only the EXCHGID4_FLAG_USE_PNFS_DS pNFS role */
 	dprintk("%s EXCHANGE_ID for clp %p\n", __func__, clp);
 	clp->cl_exchange_flags = EXCHGID4_FLAG_USE_PNFS_DS;
+
 	err = nfs4_recover_expired_lease(clp);
 	if (!err)
 		err = nfs4_check_client_ready(clp);
 	if (err)
 		goto out_put;
 
-	/* mask out the server's MDS capability flag */
-	clp->cl_exchange_flags &= ~EXCHGID4_FLAG_USE_PNFS_MDS;
-
 	if (!(clp->cl_exchange_flags & EXCHGID4_FLAG_USE_PNFS_DS)) {
 		printk(KERN_INFO "ip:port %s is not a pNFS Data Server\n",
 			ds->r_addr);
@@ -193,6 +191,12 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 	}
 
 	/*
+	 * Mask the (possibly) returned EXCHGID4_FLAG_USE_PNFS_MDS pNFS role
+	 * The is_ds_only_session depends on this.
+	 */
+	clp->cl_exchange_flags &= ~EXCHGID4_FLAG_USE_PNFS_MDS;
+
+	/*
 	 * Set DS lease equal to the MDS lease, renewal is scheduled in
 	 * create_session
 	 */
-- 
1.6.6


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

* RE: [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client
  2010-05-12 17:39   ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client andros
  2010-05-12 17:39     ` [PATCH 3/3] SQUASHME pnfs_submit: cleanup DS exchange flag processing andros
@ 2010-05-13 19:13     ` Batsakis, Alexandros
       [not found]       ` <B9364369CA66BF45806C2CD86EAB8BA60607E6A4-hX7t0kiaRRqx3DEm5hsDiAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Batsakis, Alexandros @ 2010-05-13 19:13 UTC (permalink / raw)
  To: Adamson, Andy, bhalevy; +Cc: linux-nfs



> -----Original Message-----
> From: Adamson, Andy
> Sent: Wednesday, May 12, 2010 10:40 AM
> To: bhalevy@panasas.com
> Cc: linux-nfs@vger.kernel.org; Adamson, Andy
> Subject: [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client
> 
> From: Andy Adamson <andros@netapp.com>
> 
> Dont bother using the hostname, use the client ipaddr field from the
> MDS
> nfs_client for construction of the co_ownrid field the DS EXCHANGE_ID.
> 
> Clean up the comments.
> 
> Squash into "pnfs: filelayout: device ops"
> 
> Signed-off-by: Andy Adamson <andros@netapp.com>
> ---
>  fs/nfs/nfs4filelayoutdev.c |   28 +++++-----------------------
>  1 files changed, 5 insertions(+), 23 deletions(-)
> 
> diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
> index 891c31d..b41f437 100644
> --- a/fs/nfs/nfs4filelayoutdev.c
> +++ b/fs/nfs/nfs4filelayoutdev.c
> @@ -128,8 +128,6 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv,
> struct nfs4_pnfs_ds *ds)
>  	struct rpc_clnt 	*mds_clnt = mds_srv->client;
>  	struct nfs_client	*clp = mds_srv->nfs_client;
>  	struct sockaddr		*mds_addr;
> -	char			ip_addr[16];
> -	int			addrlen;
>  	int err = 0;
> 
>  	dprintk("--> %s ip:port %s au_flavor %d\n", __func__,
> @@ -156,32 +154,16 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv,
> struct nfs4_pnfs_ds *ds)
>  		}
>  		goto out;
>  	}
> -	/* Set timeout to the mds rpc clnt value.
> -	 * XXX - find the correct authflavor....
> -	 *
> -	 * Fake a client ipaddr (used for sessionid) with hostname
> -	 * Use hostname since it might be more unique than ipaddr (which
> -	 * could be set to the loopback 127.0.0/1.1
> -	 *
> -	 * XXX: Should sessions continue to use the cl_ipaddr field?
> -	 */
> -	addrlen = strnlen(utsname()->nodename, sizeof(utsname()-
> >nodename));
> -	if (addrlen > sizeof(ip_addr))
> -		addrlen = sizeof(ip_addr);
> -	memcpy(ip_addr, utsname()->nodename, addrlen);
> -
> -	/* XXX need a non-nfs_client struct interface to set up
> -	 * data server sessions
> -	 *
> -	 * tmp: nfs4_set_client sets the nfs_server->nfs_client.
> -	 *
> -	 * We specify a retrans and timeout interval equual to MDS. ??
> +	/*
> +	 * Set a retrans, timeout interval, and authflavor equual to the
> MDS
> +	 * values. Use the MDS nfs_client cl_ipaddr field so as to use
> the
> +	 * same co_ownerid as the MDS.
>  	 */
>  	err = nfs4_set_client(&tmp,
>  			      mds_srv->nfs_client->cl_hostname,
>  			      (struct sockaddr *)&sin,
>  			      sizeof(struct sockaddr),
> -			      ip_addr,
> +			      mds_srv->nfs_client->cl_ipaddr,
>  			      mds_clnt->cl_auth->au_flavor,
>  			      IPPROTO_TCP,
>  			      mds_clnt->cl_xprt->timeout,
> --
> 1.6.6

Hi Andy,

Is there a way to avoid creating a new nfs_client altogether and just
re-use the existing one along with its session ?

-a

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

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

* RE: [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client
       [not found]       ` <B9364369CA66BF45806C2CD86EAB8BA60607E6A4-hX7t0kiaRRqx3DEm5hsDiAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
@ 2010-05-13 19:29         ` Batsakis, Alexandros
  0 siblings, 0 replies; 6+ messages in thread
From: Batsakis, Alexandros @ 2010-05-13 19:29 UTC (permalink / raw)
  To: Batsakis, Alexandros, Adamson, Andy, bhalevy; +Cc: linux-nfs



> -----Original Message-----
> From: Batsakis, Alexandros
> Sent: Thursday, May 13, 2010 12:14 PM
> To: Adamson, Andy; bhalevy@panasas.com
> Cc: linux-nfs@vger.kernel.org
> Subject: RE: [PATCH 2/3] SQUASHME pnfs_submit: update DS
> nfs4_set_client
> 
> 
> 
> > -----Original Message-----
> > From: Adamson, Andy
> > Sent: Wednesday, May 12, 2010 10:40 AM
> > To: bhalevy@panasas.com
> > Cc: linux-nfs@vger.kernel.org; Adamson, Andy
> > Subject: [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client
> >
> > From: Andy Adamson <andros@netapp.com>
> >
> > Dont bother using the hostname, use the client ipaddr field from the
> > MDS
> > nfs_client for construction of the co_ownrid field the DS
> EXCHANGE_ID.
> >
> > Clean up the comments.
> >
> > Squash into "pnfs: filelayout: device ops"
> >
> > Signed-off-by: Andy Adamson <andros@netapp.com>
> > ---
> >  fs/nfs/nfs4filelayoutdev.c |   28 +++++-----------------------
> >  1 files changed, 5 insertions(+), 23 deletions(-)
> >
> > diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
> > index 891c31d..b41f437 100644
> > --- a/fs/nfs/nfs4filelayoutdev.c
> > +++ b/fs/nfs/nfs4filelayoutdev.c
> > @@ -128,8 +128,6 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv,
> > struct nfs4_pnfs_ds *ds)
> >  	struct rpc_clnt 	*mds_clnt = mds_srv->client;
> >  	struct nfs_client	*clp = mds_srv->nfs_client;
> >  	struct sockaddr		*mds_addr;
> > -	char			ip_addr[16];
> > -	int			addrlen;
> >  	int err = 0;
> >
> >  	dprintk("--> %s ip:port %s au_flavor %d\n", __func__,
> > @@ -156,32 +154,16 @@ nfs4_pnfs_ds_create(struct nfs_server
*mds_srv,
> > struct nfs4_pnfs_ds *ds)
> >  		}
> >  		goto out;
> >  	}
> > -	/* Set timeout to the mds rpc clnt value.
> > -	 * XXX - find the correct authflavor....
> > -	 *
> > -	 * Fake a client ipaddr (used for sessionid) with hostname
> > -	 * Use hostname since it might be more unique than ipaddr (which
> > -	 * could be set to the loopback 127.0.0/1.1
> > -	 *
> > -	 * XXX: Should sessions continue to use the cl_ipaddr field?
> > -	 */
> > -	addrlen = strnlen(utsname()->nodename, sizeof(utsname()-
> > >nodename));
> > -	if (addrlen > sizeof(ip_addr))
> > -		addrlen = sizeof(ip_addr);
> > -	memcpy(ip_addr, utsname()->nodename, addrlen);
> > -
> > -	/* XXX need a non-nfs_client struct interface to set up
> > -	 * data server sessions
> > -	 *
> > -	 * tmp: nfs4_set_client sets the nfs_server->nfs_client.
> > -	 *
> > -	 * We specify a retrans and timeout interval equual to MDS. ??
> > +	/*
> > +	 * Set a retrans, timeout interval, and authflavor equual to the
> > MDS
> > +	 * values. Use the MDS nfs_client cl_ipaddr field so as to use
> > the
> > +	 * same co_ownerid as the MDS.
> >  	 */
> >  	err = nfs4_set_client(&tmp,
> >  			      mds_srv->nfs_client->cl_hostname,
> >  			      (struct sockaddr *)&sin,
> >  			      sizeof(struct sockaddr),
> > -			      ip_addr,
> > +			      mds_srv->nfs_client->cl_ipaddr,
> >  			      mds_clnt->cl_auth->au_flavor,
> >  			      IPPROTO_TCP,
> >  			      mds_clnt->cl_xprt->timeout,
> > --
> > 1.6.6
> 
> Hi Andy,
> 
> Is there a way to avoid creating a new nfs_client altogether and just
> re-use the existing one along with its session ?
> 
> -a
> 

Nevermind. I should have read patch 1/3 as well :)

-a

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

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

end of thread, other threads:[~2010-05-13 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 17:39 [PATCH 0/3] Use MDS session for dual role MDS/DS andros
2010-05-12 17:39 ` [PATCH 1/3] SQUASHME pnfs_submit: use MDS session for dual MDS/DS andros
2010-05-12 17:39   ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client andros
2010-05-12 17:39     ` [PATCH 3/3] SQUASHME pnfs_submit: cleanup DS exchange flag processing andros
2010-05-13 19:13     ` [PATCH 2/3] SQUASHME pnfs_submit: update DS nfs4_set_client Batsakis, Alexandros
     [not found]       ` <B9364369CA66BF45806C2CD86EAB8BA60607E6A4-hX7t0kiaRRqx3DEm5hsDiAK/GNPrWCqfQQ4Iyu8u01E@public.gmane.org>
2010-05-13 19:29         ` Batsakis, Alexandros

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