diff mbox

[RFC,Version,1,6/6] NFS schedule bind_conn_to_session for new NFSv4.1 transport

Message ID 1454706518-4641-7-git-send-email-andros@netapp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andy Adamson Feb. 5, 2016, 9:08 p.m. UTC
From: Andy Adamson <andros@netapp.com>

Complete session trunking with the BIND_CONN_TO_SESSION call.
NFS cleanup after session trunking transport added

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4client.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Trond Myklebust Feb. 6, 2016, 1:04 a.m. UTC | #1
On Fri, Feb 5, 2016 at 4:08 PM,  <andros@netapp.com> wrote:
> From: Andy Adamson <andros@netapp.com>
>
> Complete session trunking with the BIND_CONN_TO_SESSION call.
> NFS cleanup after session trunking transport added
>
> Signed-off-by: Andy Adamson <andros@netapp.com>
> ---
>  fs/nfs/nfs4client.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
> index 6736805..b0423f7 100644
> --- a/fs/nfs/nfs4client.c
> +++ b/fs/nfs/nfs4client.c
> @@ -423,8 +423,17 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
>                                 .servername = clp->cl_hostname,
>                         };
>                         /* Add this address as an alias */
> -                       rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
> -                                       rpc_clnt_test_and_add_xprt, NULL);
> +                       error = rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
> +                                            rpc_clnt_test_and_add_xprt, NULL);
> +                       if (!error) {
> +                               nfs4_schedule_session_recovery(old->cl_session,
> +                                       -NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
> +
> +                               /** Cancel the 2nd mount */
> +                               pr_info("NFS:  Session trunk. CANCEL MOUNT\n");
> +                               error = -EINVAL;

You can't do this. What if we're not mounting the same path?

> +                               goto error;
> +                       }
>                 }
>                 clp->cl_preserve_clid = true;
>         }
> --
> 1.8.3.1
>
> --
> 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
Adamson, Andy Feb. 8, 2016, 5:48 p.m. UTC | #2
DQo+IE9uIEZlYiA1LCAyMDE2LCBhdCA4OjA0IFBNLCBUcm9uZCBNeWtsZWJ1c3QgPHRyb25kLm15
a2xlYnVzdEBwcmltYXJ5ZGF0YS5jb20+IHdyb3RlOg0KPiANCj4gT24gRnJpLCBGZWIgNSwgMjAx
NiBhdCA0OjA4IFBNLCAgPGFuZHJvc0BuZXRhcHAuY29tPiB3cm90ZToNCj4+IEZyb206IEFuZHkg
QWRhbXNvbiA8YW5kcm9zQG5ldGFwcC5jb20+DQo+PiANCj4+IENvbXBsZXRlIHNlc3Npb24gdHJ1
bmtpbmcgd2l0aCB0aGUgQklORF9DT05OX1RPX1NFU1NJT04gY2FsbC4NCj4+IE5GUyBjbGVhbnVw
IGFmdGVyIHNlc3Npb24gdHJ1bmtpbmcgdHJhbnNwb3J0IGFkZGVkDQo+PiANCj4+IFNpZ25lZC1v
ZmYtYnk6IEFuZHkgQWRhbXNvbiA8YW5kcm9zQG5ldGFwcC5jb20+DQo+PiAtLS0NCj4+IGZzL25m
cy9uZnM0Y2xpZW50LmMgfCAxMyArKysrKysrKysrKy0tDQo+PiAxIGZpbGUgY2hhbmdlZCwgMTEg
aW5zZXJ0aW9ucygrKSwgMiBkZWxldGlvbnMoLSkNCj4+IA0KPj4gZGlmZiAtLWdpdCBhL2ZzL25m
cy9uZnM0Y2xpZW50LmMgYi9mcy9uZnMvbmZzNGNsaWVudC5jDQo+PiBpbmRleCA2NzM2ODA1Li5i
MDQyM2Y3IDEwMDY0NA0KPj4gLS0tIGEvZnMvbmZzL25mczRjbGllbnQuYw0KPj4gKysrIGIvZnMv
bmZzL25mczRjbGllbnQuYw0KPj4gQEAgLTQyMyw4ICs0MjMsMTcgQEAgc3RydWN0IG5mc19jbGll
bnQgKm5mczRfaW5pdF9jbGllbnQoc3RydWN0IG5mc19jbGllbnQgKmNscCwNCj4+ICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAuc2VydmVybmFtZSA9IGNscC0+Y2xfaG9zdG5hbWUsDQo+
PiAgICAgICAgICAgICAgICAgICAgICAgIH07DQo+PiAgICAgICAgICAgICAgICAgICAgICAgIC8q
IEFkZCB0aGlzIGFkZHJlc3MgYXMgYW4gYWxpYXMgKi8NCj4+IC0gICAgICAgICAgICAgICAgICAg
ICAgIHJwY19jbG50X2FkZF94cHJ0KG9sZC0+Y2xfcnBjY2xpZW50LCAmeHBydF9hcmdzLA0KPj4g
LSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJwY19jbG50X3Rlc3RfYW5k
X2FkZF94cHJ0LCBOVUxMKTsNCj4+ICsgICAgICAgICAgICAgICAgICAgICAgIGVycm9yID0gcnBj
X2NsbnRfYWRkX3hwcnQob2xkLT5jbF9ycGNjbGllbnQsICZ4cHJ0X2FyZ3MsDQo+PiArICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBycGNfY2xudF90ZXN0X2FuZF9h
ZGRfeHBydCwgTlVMTCk7DQo+PiArICAgICAgICAgICAgICAgICAgICAgICBpZiAoIWVycm9yKSB7
DQo+PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5mczRfc2NoZWR1bGVfc2Vzc2lv
bl9yZWNvdmVyeShvbGQtPmNsX3Nlc3Npb24sDQo+PiArICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgLU5GUzRFUlJfQ09OTl9OT1RfQk9VTkRfVE9fU0VTU0lPTik7DQo+PiAr
DQo+PiArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8qKiBDYW5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c2FnZSB0byBtYWpv
cmRvbW9Admdlci5rZXJuZWwub3JnDQo+PiBNb3JlIG1ham9yZG9tbyBpbmZvIGF0ICBodHRwOi8v
dmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0bWwNCg0K
--
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
Trond Myklebust Feb. 8, 2016, 6:07 p.m. UTC | #3
On Mon, Feb 8, 2016 at 12:48 PM, Adamson, Andy
<William.Adamson@netapp.com> wrote:
>
>
> > On Feb 5, 2016, at 8:04 PM, Trond Myklebust <trond.myklebust@primarydata.com> wrote:
> >
> > On Fri, Feb 5, 2016 at 4:08 PM,  <andros@netapp.com> wrote:
> >> From: Andy Adamson <andros@netapp.com>
> >>
> >> Complete session trunking with the BIND_CONN_TO_SESSION call.
> >> NFS cleanup after session trunking transport added
> >>
> >> Signed-off-by: Andy Adamson <andros@netapp.com>
> >> ---
> >> fs/nfs/nfs4client.c | 13 +++++++++++--
> >> 1 file changed, 11 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
> >> index 6736805..b0423f7 100644
> >> --- a/fs/nfs/nfs4client.c
> >> +++ b/fs/nfs/nfs4client.c
> >> @@ -423,8 +423,17 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
> >>                                .servername = clp->cl_hostname,
> >>                        };
> >>                        /* Add this address as an alias */
> >> -                       rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
> >> -                                       rpc_clnt_test_and_add_xprt, NULL);
> >> +                       error = rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
> >> +                                            rpc_clnt_test_and_add_xprt, NULL);
> >> +                       if (!error) {
> >> +                               nfs4_schedule_session_recovery(old->cl_session,
> >> +                                       -NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
> >> +
> >> +                               /** Cancel the 2nd mount */
> >> +                               pr_info("NFS:  Session trunk. CANCEL MOUNT\n");
> >> +                               error = -EINVAL;
> >
> > You can't do this. What if we're not mounting the same path?
>
>
> This is the question I asked in the cover letter: Is using mount a good way to setup NFSv4.1 session trunking?
> How do you see session trunking being requested? Is mounting the export path on the server, but a different local mount point good enough?

The "standard" way of doing it is to supply multiple hostnames, in other words:

mount -t nfs foo,bar,baz:/export /mnt

We can then either supply the network addresses for foo, bar and baz
in the form of multiple 'addr=<address>' options (and possibly
prefixed by 'proto=<netid>' if necessary), or we could have the DNS
resolver do the translation for us.

Cheers
  Trond

>
> Thanks
>
> —>Andy
>
> >
> >> +                               goto error;
> >> +                       }
> >>                }
> >>                clp->cl_preserve_clid = true;
> >>        }
> >> --
> >> 1.8.3.1
> >>
> >> --
> >> 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
diff mbox

Patch

diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index 6736805..b0423f7 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -423,8 +423,17 @@  struct nfs_client *nfs4_init_client(struct nfs_client *clp,
 				.servername = clp->cl_hostname,
 			};
 			/* Add this address as an alias */
-			rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
-					rpc_clnt_test_and_add_xprt, NULL);
+			error = rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
+					     rpc_clnt_test_and_add_xprt, NULL);
+			if (!error) {
+				nfs4_schedule_session_recovery(old->cl_session,
+					-NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
+
+				/** Cancel the 2nd mount */
+				pr_info("NFS:  Session trunk. CANCEL MOUNT\n");
+				error = -EINVAL;
+				goto error;
+			}
 		}
 		clp->cl_preserve_clid = true;
 	}