2013-07-07 23:58:24

by NeilBrown

[permalink] [raw]
Subject: [PATCH - RFC] new "nosharetransport" option for NFS mounts.



This patch adds a "nosharetransport" option to allow two different
mounts from the same server to use different transports.
If the mounts use NFSv4, or are of the same filesystem, then
"nosharecache" must be used as well.

There are at least two circumstances where it might be desirable
to use separate transports:

1/ If the NFS server can get into a state where it will ignore
requests for one filesystem while servicing request for another,
then using separate connections for the separate filesystems can
stop problems with one affecting access to the other.

This is particularly relevant for NetApp filers where one filesystem
has been "suspended". Requests to that filesystem will be dropped
(rather than the more correct NFS3ERR_JUKEBOX). This currently
interferes with other filesystems.

2/ If a very fast network is used with a many-processor client, a
single TCP connection can present a bottle neck which reduces total
throughput. Using multiple TCP connections (one per mount) removes
the bottleneck.
An alternate workaround is to configure multiple virtual IP
addresses on the server and mount each filesystem from a different
IP. This is effective (throughput goes up) but an unnecessary
administrative burden.

Signed-off-by: NeilBrown <[email protected]>

---
Is this a good idea? Bad idea? Have I missed something important?

NeilBrown


diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c513b0c..64e3f39 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -403,8 +403,13 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
const struct sockaddr *sap = data->addr;
struct nfs_net *nn = net_generic(data->net, nfs_net_id);

+ if (test_bit(NFS_CS_NO_SHARE, &data->init_flags))
+ return NULL;
+
list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr;
+ if (test_bit(NFS_CS_NO_SHARE,&clp->cl_flags))
+ continue;
/* Don't match clients that failed to initialise properly */
if (clp->cl_cons_state < 0)
continue;
@@ -753,6 +758,8 @@ static int nfs_init_server(struct nfs_server *server,
data->timeo, data->retrans);
if (data->flags & NFS_MOUNT_NORESVPORT)
set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);
+ if (data->flags & NFS_MOUNT_NOSHARE_XPRT)
+ set_bit(NFS_CS_NO_SHARE, &cl_init.init_flags);
if (server->options & NFS_OPTION_MIGRATION)
set_bit(NFS_CS_MIGRATION, &cl_init.init_flags);

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2d7525f..d9141d8 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -88,6 +88,7 @@ enum {
Opt_acl, Opt_noacl,
Opt_rdirplus, Opt_nordirplus,
Opt_sharecache, Opt_nosharecache,
+ Opt_sharetransport, Opt_nosharetransport,
Opt_resvport, Opt_noresvport,
Opt_fscache, Opt_nofscache,
Opt_migration, Opt_nomigration,
@@ -146,6 +147,8 @@ static const match_table_t nfs_mount_option_tokens = {
{ Opt_nordirplus, "nordirplus" },
{ Opt_sharecache, "sharecache" },
{ Opt_nosharecache, "nosharecache" },
+ { Opt_sharetransport, "sharetransport"},
+ { Opt_nosharetransport, "nosharetransport"},
{ Opt_resvport, "resvport" },
{ Opt_noresvport, "noresvport" },
{ Opt_fscache, "fsc" },
@@ -634,6 +637,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
{ NFS_MOUNT_NOACL, ",noacl", "" },
{ NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
{ NFS_MOUNT_UNSHARED, ",nosharecache", "" },
+ { NFS_MOUNT_NOSHARE_XPRT, ",nosharetransport", ""},
{ NFS_MOUNT_NORESVPORT, ",noresvport", "" },
{ 0, NULL, NULL }
};
@@ -1239,6 +1243,12 @@ static int nfs_parse_mount_options(char *raw,
case Opt_nosharecache:
mnt->flags |= NFS_MOUNT_UNSHARED;
break;
+ case Opt_sharetransport:
+ mnt->flags &= ~NFS_MOUNT_NOSHARE_XPRT;
+ break;
+ case Opt_nosharetransport:
+ mnt->flags |= NFS_MOUNT_NOSHARE_XPRT;
+ break;
case Opt_resvport:
mnt->flags &= ~NFS_MOUNT_NORESVPORT;
break;
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3b7fa2a..9e9d7d3 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -41,6 +41,7 @@ struct nfs_client {
#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
#define NFS_CS_MIGRATION 2 /* - transparent state migr */
#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */
+#define NFS_CS_NO_SHARE 4 /* - don't share across mounts */
struct sockaddr_storage cl_addr; /* server identifier */
size_t cl_addrlen;
char * cl_hostname; /* hostname of server */
diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h
index 576bddd..81c49ff 100644
--- a/include/uapi/linux/nfs_mount.h
+++ b/include/uapi/linux/nfs_mount.h
@@ -73,5 +73,6 @@ struct nfs_mount_data {

#define NFS_MOUNT_LOCAL_FLOCK 0x100000
#define NFS_MOUNT_LOCAL_FCNTL 0x200000
+#define NFS_MOUNT_NOSHARE_XPRT 0x400000

#endif


Attachments:
signature.asc (828.00 B)

2013-07-09 14:46:33

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH - RFC] new "nosharetransport" option for NFS mounts.

T24gVHVlLCAyMDEzLTA3LTA5IGF0IDEzOjIyICsxMDAwLCBOZWlsQnJvd24gd3JvdGU6DQo+IE9u
IE1vbiwgOCBKdWwgMjAxMyAxODo1MTo0MCArMDAwMCAiTXlrbGVidXN0LCBUcm9uZCINCj4gPFRy
b25kLk15a2xlYnVzdEBuZXRhcHAuY29tPiB3cm90ZToNCj4gDQo+ID4gT24gTW9uLCAyMDEzLTA3
LTA4IGF0IDA5OjU4ICsxMDAwLCBOZWlsQnJvd24gd3JvdGU6DQo+ID4gPiANCj4gPiA+IFRoaXMg
cGF0Y2ggYWRkcyBhICJub3NoYXJldHJhbnNwb3J0IiBvcHRpb24gdG8gYWxsb3cgdHdvIGRpZmZl
cmVudA0KPiA+ID4gbW91bnRzIGZyb20gdGhlIHNhbWUgc2VydmVyIHRvIHVzZSBkaWZmZXJlbnQg
dHJhbnNwb3J0cy4NCj4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dEBuZXRhcHAuY29tDQp3d3cubmV0
YXBwLmNvbQ0K

2013-07-09 15:04:36

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH - RFC] new "nosharetransport" option for NFS mounts.

On Tue, Jul 09, 2013 at 01:22:53PM +1000, NeilBrown wrote:
> On Mon, 8 Jul 2013 18:51:40 +0000 "Myklebust, Trond"
> <[email protected]> wrote:
>
> > On Mon, 2013-07-08 at 09:58 +1000, NeilBrown wrote:
> > >
> > > This patch adds a "nosharetransport" option to allow two different
> > > mounts from the same server to use different transports.
> > > If the mounts use NFSv4, or are of the same filesystem, then
> > > "nosharecache" must be used as well.
> >
> > Won't this interfere with the recently added NFSv4 trunking detection?
>
> Will it? I googled around a bit but couldn't find anything that tells me
> what trunking really was in this context. Then I found commit 05f4c350ee02
> which makes it quite clear (thanks Chuck!).
>
> Probably the code I wrote could interfere.
>
> >
> > Also, how will it work with NFSv4.1 sessions? The server will usually
> > require a BIND_CONN_TO_SESSION when new TCP connections attempt to
> > attach to an existing session.

Since the current client only requests SP4_NONE state protection, the
BIND_CONN_TO_SESSION is implicit:

If, when the client ID was created, the client opted for
SP4_NONE state protection, the client is not required to use
BIND_CONN_TO_SESSION to associate the connection with the
session, unless the client wishes to associate the connection
with the backchannel. When SP4_NONE protection is used, simply
sending a COMPOUND request with a SEQUENCE operation is
sufficient to associate the connection with the session
specified in SEQUENCE.

But Neil would need to make sure he's using all the state associated
with the existing client.

> Why would it attempt to attach to an existing session? I would hope there
> the two different mounts with separate TCP connections would look completely
> separate - different transport, different cache, different session.
> ??

Sounds to me sharing these things shouldn't be a problem in your case,
but I don't know.

--b.

2013-07-08 18:52:29

by Myklebust, Trond

[permalink] [raw]
Subject: Re: [PATCH - RFC] new "nosharetransport" option for NFS mounts.

T24gTW9uLCAyMDEzLTA3LTA4IGF0IDA5OjU4ICsxMDAwLCBOZWlsQnJvd24gd3JvdGU6DQo+IA0K
PiBUaGlzIHBhdGNoIGFkZHMgYSAibm9zaGFyZXRyY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kZWZpbmUgTkZTX0NTX05PX1NIQVJFCQk0CQkvKiAtIGRvbid0IHNoYXJl
IGFjcm9zcyBtb3VudHMgKi8NCj4gIAlzdHJ1Y3Qgc29ja2FkZHJfc3RvcmFnZQljbF9hZGRyOwkv
KiBzZXJ2ZXIgaWRlbnRpZmllciAqLw0KPiAgCXNpemVfdAkJCWNsX2FkZHJsZW47DQo+ICAJY2hh
ciAqCQkJY2xfaG9zdG5hbWU7CS8qIGhvc3RuYW1lIG9mIHNlcnZlciAqLw0KPiBkaWZmIC0tZ2l0
IGEvaW5jbHVkZS91YXBpL2xpbnV4L25mc19tb3VudC5oIGIvaW5jbHVkZS91YXBpL2xpbnV4L25m
c19tb3VudC5oDQo+IGluZGV4IDU3NmJkZGQuLjgxYzQ5ZmYgMTAwNjQ0DQo+IC0tLSBhL2luY2x1
ZGUvdWFwaS9saW51eC9uZnNfbW91bnQuaA0KPiArKysgYi9pbmNsdWRlL3VhcGkvbGludXgvbmZz
X21vdW50LmgNCj4gQEAgLTczLDUgKzczLDYgQEAgc3RydWN0IG5mc19tb3VudF9kYXRhIHsNCj4g
IA0KPiAgI2RlZmluZSBORlNfTU9VTlRfTE9DQUxfRkxPQ0sJMHgxMDAwMDANCj4gICNkZWZpbmUg
TkZTX01PVU5UX0xPQ0FMX0ZDTlRMCTB4MjAwMDAwDQo+ICsjZGVmaW5lIE5GU19NT1VOVF9OT1NI
QVJFX1hQUlQJMHg0MDAwMDANCj4gIA0KPiAgI2VuZGlmDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0
DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RA
bmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg==

2013-07-09 14:21:29

by Chuck Lever III

[permalink] [raw]
Subject: Re: [PATCH - RFC] new "nosharetransport" option for NFS mounts.


On Jul 8, 2013, at 11:22 PM, NeilBrown <[email protected]> wrote:

> On Mon, 8 Jul 2013 18:51:40 +0000 "Myklebust, Trond"
> <[email protected]> wrote:
>
>> On Mon, 2013-07-08 at 09:58 +1000, NeilBrown wrote:
>>>
>>> This patch adds a "nosharetransport" option to allow two different
>>> mounts from the same server to use different transports.
>>> If the mounts use NFSv4, or are of the same filesystem, then
>>> "nosharecache" must be used as well.
>>
>> Won't this interfere with the recently added NFSv4 trunking detection?
>
> Will it? I googled around a bit but couldn't find anything that tells me
> what trunking really was in this context. Then I found commit 05f4c350ee02
> which makes it quite clear (thanks Chuck!).
>
> Probably the code I wrote could interfere.
>
>>
>> Also, how will it work with NFSv4.1 sessions? The server will usually
>> require a BIND_CONN_TO_SESSION when new TCP connections attempt to
>> attach to an existing session.
>
> Why would it attempt to attach to an existing session? I would hope there
> the two different mounts with separate TCP connections would look completely
> separate - different transport, different cache, different session.
> ??
>
>>
>>> There are at least two circumstances where it might be desirable
>>> to use separate transports:
>>>
>>> 1/ If the NFS server can get into a state where it will ignore
>>> requests for one filesystem while servicing request for another,
>>> then using separate connections for the separate filesystems can
>>> stop problems with one affecting access to the other.
>>>
>>> This is particularly relevant for NetApp filers where one filesystem
>>> has been "suspended". Requests to that filesystem will be dropped
>>> (rather than the more correct NFS3ERR_JUKEBOX). This currently
>>> interferes with other filesystems.
>>
>> This is a known issue that really needs to be fixed on the server, not
>> on the client. As far as I know, work is already underway to fix this.
>
> I wasn't aware of this, nor were our support people. I've passed it on so
> maybe they can bug Netapp....
>
>>
>>> 2/ If a very fast network is used with a many-processor client, a
>>> single TCP connection can present a bottle neck which reduces total
>>> throughput. Using multiple TCP connections (one per mount) removes
>>> the bottleneck.
>>> An alternate workaround is to configure multiple virtual IP
>>> addresses on the server and mount each filesystem from a different
>>> IP. This is effective (throughput goes up) but an unnecessary
>>> administrative burden.
>>
>> As I understand it, using multiple simultaneous TCP connections between
>> the same endpoints also adds a risk that the congestion windows will
>> interfere. Do you have numbers to back up the claim of a performance
>> improvement?
>
> A customer upgraded from SLES10 (2.6.16 based) to SLES11 (3.0 based) and saw
> a slowdown on some large DB jobs of between 1.5 and 2 times (i.e. total time
> 150% to 200% of what is was before).
> After some analysis they created multiple virtual IPs on the server and
> mounted the several filesystem each from different IPs and got the
> performance back (they see this as a work-around rather than a genuine
> solution).
> Numbers are like "500MB/s on a single connection, 850MB/sec peaking to
> 1000MB/sec on multiple connections".
>
> If I can get something more concrete I'll let you know.
>
> As this worked well in 2.6.16 (which doesn't try to share connections) this
> is seen as a regression.
>
> On links that are easy to saturate, congestion windows are important and
> having a single connection is probably a good idea - so the current default
> is certainly correct.
> On a 10G ethernet or infiniband connection (where the issue has been
> measured) congestion just doesn't seem to be an issue.

We've toyed with the idea of using multiple TCP connections per mount for years. The choice was made to stick with one connection (and one session on NFSv4.1) for each server.

The main limitation has been having a single RPC slot table for the transport, allowing only 16 concurrent RPC requests per server at a time. Andy and Trond did some good work making the slot table widen itself dynamically as the TCP window opens.

A secondary concern is head-of-queue blocking. The server end can certainly stall a client by not taking the top request off the socket queue, and thereby delay any requests that are behind that one in the queue. I think the preferred solution there is to build out support for RPC over SCTP, and use SCTP's multi-stream feature. Alternately we might choose to try out M-TCP. Server implementations can also be made sensitive to this issue to help prevent delays.

A tertiary issue is contention for the transport on multi-socket systems. For a long while I've suspected it may occur, but I've never measured it in practice.

Re: the problem at hand: You've definitely measured a performance regression. However, I don't think those numbers explain _why_ it is occurring.

The first thing to check is whether SuSE11 has the dynamic RPC slot table logic I mentioned above. I think it starts with upstream commit d9ba131d, but someone should correct me if I'm wrong.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





2013-07-09 10:01:20

by NeilBrown

[permalink] [raw]
Subject: Re: [PATCH - RFC] new "nosharetransport" option for NFS mounts.

On Tue, 9 Jul 2013 13:22:53 +1000 NeilBrown <[email protected]> wrote:


> A customer upgraded from SLES10 (2.6.16 based) to SLES11 (3.0 based) and saw
> a slowdown on some large DB jobs of between 1.5 and 2 times (i.e. total time
> 150% to 200% of what is was before).
> After some analysis they created multiple virtual IPs on the server and
> mounted the several filesystem each from different IPs and got the
> performance back (they see this as a work-around rather than a genuine
> solution).
> Numbers are like "500MB/s on a single connection, 850MB/sec peaking to
> 1000MB/sec on multiple connections".
>
> If I can get something more concrete I'll let you know.

Slightly more concrete:

4 mounts from the one server, 10 threads of fio on each mount.
All over a 10G Ethernet.

1 IP address without "nosharetransport": ~700MB/s
4 IP addresses without "nosharetransport": ~1100MB/s
1 IP address with "nosharetransport": ~1100MB/s

This is all NFSv3. NFSv4 is much slower with nosharecache (32MB/s!), but I
might have botched the backport to 3.0 (or didn't address the v4 specific
issues you raised). I haven't looked into that yet.


NeilBrown


Attachments:
signature.asc (828.00 B)

2013-07-09 03:23:06

by NeilBrown

[permalink] [raw]
Subject: Re: [PATCH - RFC] new "nosharetransport" option for NFS mounts.

On Mon, 8 Jul 2013 18:51:40 +0000 "Myklebust, Trond"
<[email protected]> wrote:

> On Mon, 2013-07-08 at 09:58 +1000, NeilBrown wrote:
> >
> > This patch adds a "nosharetransport" option to allow two different
> > mounts from the same server to use different transports.
> > If the mounts use NFSv4, or are of the same filesystem, then
> > "nosharecache" must be used as well.
>
> Won't this interfere with the recently added NFSv4 trunking detection?

Will it? I googled around a bit but couldn't find anything that tells me
what trunking really was in this context. Then I found commit 05f4c350ee02
which makes it quite clear (thanks Chuck!).

Probably the code I wrote could interfere.

>
> Also, how will it work with NFSv4.1 sessions? The server will usually
> require a BIND_CONN_TO_SESSION when new TCP connections attempt to
> attach to an existing session.

Why would it attempt to attach to an existing session? I would hope there
the two different mounts with separate TCP connections would look completely
separate - different transport, different cache, different session.
??

>
> > There are at least two circumstances where it might be desirable
> > to use separate transports:
> >
> > 1/ If the NFS server can get into a state where it will ignore
> > requests for one filesystem while servicing request for another,
> > then using separate connections for the separate filesystems can
> > stop problems with one affecting access to the other.
> >
> > This is particularly relevant for NetApp filers where one filesystem
> > has been "suspended". Requests to that filesystem will be dropped
> > (rather than the more correct NFS3ERR_JUKEBOX). This currently
> > interferes with other filesystems.
>
> This is a known issue that really needs to be fixed on the server, not
> on the client. As far as I know, work is already underway to fix this.

I wasn't aware of this, nor were our support people. I've passed it on so
maybe they can bug Netapp....

>
> > 2/ If a very fast network is used with a many-processor client, a
> > single TCP connection can present a bottle neck which reduces total
> > throughput. Using multiple TCP connections (one per mount) removes
> > the bottleneck.
> > An alternate workaround is to configure multiple virtual IP
> > addresses on the server and mount each filesystem from a different
> > IP. This is effective (throughput goes up) but an unnecessary
> > administrative burden.
>
> As I understand it, using multiple simultaneous TCP connections between
> the same endpoints also adds a risk that the congestion windows will
> interfere. Do you have numbers to back up the claim of a performance
> improvement?

A customer upgraded from SLES10 (2.6.16 based) to SLES11 (3.0 based) and saw
a slowdown on some large DB jobs of between 1.5 and 2 times (i.e. total time
150% to 200% of what is was before).
After some analysis they created multiple virtual IPs on the server and
mounted the several filesystem each from different IPs and got the
performance back (they see this as a work-around rather than a genuine
solution).
Numbers are like "500MB/s on a single connection, 850MB/sec peaking to
1000MB/sec on multiple connections".

If I can get something more concrete I'll let you know.

As this worked well in 2.6.16 (which doesn't try to share connections) this
is seen as a regression.

On links that are easy to saturate, congestion windows are important and
having a single connection is probably a good idea - so the current default
is certainly correct.
On a 10G ethernet or infiniband connection (where the issue has been
measured) congestion just doesn't seem to be an issue.

Thanks,
NeilBrown


Attachments:
signature.asc (828.00 B)