Skip to contentSkip to conversation

NFS: pnfs ipv6 and multipath parsing

PATCH New Weston Andros Adamson 2 participants 7 messages May 18, 2011

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

These two patches add support for IPv6 dataserver connectivity and parsing all multipath addresses.

IPv6: basically same patch as before:
- no longer calls kzalloc() while holding spinlock
- i verified that everything works as expected when CONFIG_IPV6 is not defined

Multipath: this just parses multipath config. It lays the groundwork for
true multipath support.
- skips over DS addresses that are not supported (ie RDMA, or IPv6 if turned off)

-dros

#1 lore raw

PATCH 1/2 NFS: pnfs IPv6 support

Handle ipv6 remote addresses from GETDEVICEINFO

- supports netid "tcp" for ipv4 and "tcp6" for ipv6 as rfc 5665 specifies
- added ds_remotestr to avoid having to handle different AFs in every dprintk
- tested against pynfs 4.1 server, submitting ipv6 support patch to pynfs
- tested with IPv6 disabled, it compiles cleanly and relies on rpc_pton to refuse to accept IPv6 addresses

---
 fs/nfs/nfs4filelayout.c    |    7 +-
 fs/nfs/nfs4filelayout.h    |    5 +-
 fs/nfs/nfs4filelayoutdev.c |  255 ++++++++++++++++++++++++++++++++------------
 3 files changed, 191 insertions(+), 76 deletions(-)
fs/nfs/nfs4filelayout.c +3 -4
index be79dc9..583adb3 100644
@@ -343,8 +343,7 @@ filelayout_read_pagelist(struct nfs_read_data *data)
 		set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
 		return PNFS_NOT_ATTEMPTED;
 	}
-	dprintk("%s USE DS:ip %x %hu\n", __func__,
-		ntohl(ds->ds_ip_addr), ntohs(ds->ds_port));
+	dprintk("%s USE DS: %s\n", __func__, ds->ds_remotestr);
 
 	/* No multipath support. Use first DS */
 	data->ds_clp = ds->ds_clp;
@@ -383,9 +382,9 @@ filelayout_write_pagelist(struct nfs_write_data *data, int sync)
 		set_bit(lo_fail_bit(IOMODE_READ), &lseg->pls_layout->plh_flags);
 		return PNFS_NOT_ATTEMPTED;
 	}
-	dprintk("%s ino %lu sync %d req %Zu@%llu DS:%x:%hu\n", __func__,
+	dprintk("%s ino %lu sync %d req %Zu@%llu DS: %s\n", __func__,
 		data->inode->i_ino, sync, (size_t) data->args.count, offset,
-		ntohl(ds->ds_ip_addr), ntohs(ds->ds_port));
+		ds->ds_remotestr);
 
 	data->write_done_cb = filelayout_write_done_cb;
 	data->ds_clp = ds->ds_clp;
fs/nfs/nfs4filelayout.h +3 -2
index 2b461d7..1dfd7eb 100644
@@ -49,8 +49,9 @@ enum stripetype4 {
 /* Individual ip address */
 struct nfs4_pnfs_ds {
 	struct list_head	ds_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
-	u32			ds_ip_addr;
-	u32			ds_port;
+	struct sockaddr_storage	ds_addr;
+	size_t			ds_addrlen;
+	char			*ds_remotestr;	/* human readable addr+port */
 	struct nfs_client	*ds_clp;
 	atomic_t		ds_count;
 };
fs/nfs/nfs4filelayoutdev.c +185 -70

385 lines not on this page · raw message

Signature · 1 line
1.7.4.2
#2 lore raw

PATCH 2/2 NFS: Parse and store all multipath DS addresses

In reply to Weston Andros Adamson

This parses and stores all addresses associated with each data server, laying the groundwork for supporting multipath to data servers.

- Skips over addresses that cannot be parsed (ie IPv6 addrs if v6 is not enabled). Only fails if none of the addresses are recognizable
- Currently only uses the first address that parsed cleanly
- Tested against pynfs server (modified to support multipath)

---
 fs/nfs/nfs4filelayout.h    |   12 +-
 fs/nfs/nfs4filelayoutdev.c |  363 ++++++++++++++++++++++++++++----------------
 2 files changed, 243 insertions(+), 132 deletions(-)
fs/nfs/nfs4filelayout.h +9 -3
index 1dfd7eb..2d7525d 100644
@@ -47,11 +47,17 @@ enum stripetype4 {
 };
 
 /* Individual ip address */
+struct nfs4_pnfs_ds_addr {
+	struct sockaddr_storage	da_addr;
+	size_t			da_addrlen;
+	struct list_head	da_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
+	char			*da_remotestr;	/* human readable addr+port */
+};
+
 struct nfs4_pnfs_ds {
 	struct list_head	ds_node;  /* nfs4_pnfs_dev_hlist dev_dslist */
-	struct sockaddr_storage	ds_addr;
-	size_t			ds_addrlen;
-	char			*ds_remotestr;	/* human readable addr+port */
+	char			*ds_remotestr;	/* comma sep list of addrs */
+	struct list_head	ds_addrs;
 	struct nfs_client	*ds_clp;
 	atomic_t		ds_count;
 };
fs/nfs/nfs4filelayoutdev.c +234 -129

515 lines not on this page · raw message

Signature · 1 line
1.7.4.2
#3 lore raw
In reply to Weston Andros Adamson
Quoted 6 lines · Weston Andros Adamson

These two patches add support for IPv6 dataserver connectivity and parsing all multipath addresses.

IPv6: basically same patch as before:
- no longer calls kzalloc() while holding spinlock
- i verified that everything works as expected when CONFIG_IPV6 is not defined

You'll also need to worry about when IPv6 is built in a kernel module, but ipv6.ko cannot be loaded.

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#4 lore raw

Yeah, that should work too. Like other parts of fs/nfs/, I relied on rpc_pton() to allow or disallow parsing ipv6 addresses.

-dros

Quoted 19 lines · Chuck Lever
Quoted 6 lines · Weston Andros Adamson

These two patches add support for IPv6 dataserver connectivity and parsing all multipath addresses.

IPv6: basically same patch as before:
- no longer calls kzalloc() while holding spinlock
- i verified that everything works as expected when CONFIG_IPV6 is not defined

You'll also need to worry about when IPv6 is built in a kernel module, but ipv6.ko cannot be loaded.

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#5 lore raw

Some clarification:

If ipv6.ko can't be found, this patch will still try to connect to the v6 address, fail (EIO) and revert to the MDS.

In order to properly handle this, we need to handle errors on connect and try another multipath address.
I feel that this is really part of the other "half" of the multipath work (actually using more than one address), which we will get to very soon and should be treated as a separate patch. Unless there are objections...

-dros

Quoted 30 lines · Weston Andros Adamson

Yeah, that should work too. Like other parts of fs/nfs/, I relied on rpc_pton() to allow or disallow parsing ipv6 addresses.

-dros

Quoted 19 lines · Chuck Lever
Quoted 6 lines · Weston Andros Adamson

These two patches add support for IPv6 dataserver connectivity and parsing all multipath addresses.

IPv6: basically same patch as before:
- no longer calls kzalloc() while holding spinlock
- i verified that everything works as expected when CONFIG_IPV6 is not defined

You'll also need to worry about when IPv6 is built in a kernel module, but ipv6.ko cannot be loaded.

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

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

#6 lore raw
Quoted 6 lines · Weston Andros Adamson

Some clarification:

If ipv6.ko can't be found, this patch will still try to connect to the v6 address, fail (EIO) and revert to the MDS.

In order to properly handle this, we need to handle errors on connect and try another multipath address.
I feel that this is really part of the other "half" of the multipath work (actually using more than one address), which we will get to very soon and should be treated as a separate patch. Unless there are objections...

Sounds like a plan. My only concern is that your proposed code fails gracefully in the case that ipv6.ko cannot be loaded. Crashing was a typical failure mode for this case while IPv6 support was being developed.

Quoted 35 lines

-dros

Quoted 30 lines · Weston Andros Adamson

Yeah, that should work too. Like other parts of fs/nfs/, I relied on rpc_pton() to allow or disallow parsing ipv6 addresses.

-dros

Quoted 19 lines · Chuck Lever
Quoted 6 lines · Weston Andros Adamson

These two patches add support for IPv6 dataserver connectivity and parsing all multipath addresses.

IPv6: basically same patch as before:
- no longer calls kzalloc() while holding spinlock
- i verified that everything works as expected when CONFIG_IPV6 is not defined

You'll also need to worry about when IPv6 is built in a kernel module, but ipv6.ko cannot be loaded.

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

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

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com