Commit 7e574f0d authored by Weston Andros Adamson's avatar Weston Andros Adamson Committed by Trond Myklebust

NFS: pnfs: loop over multipath addrs on connect

Don't just use the first addr in the multipath list - instead, loop
over addresses when calling nfs4_set_ds_client() (which calls connect)
until it is successful.

Although this is not real multipath support, it's a quick fix to handle when
an MDS sends a list of addresses for a DS and some of the addr families are
unsupported or misconfigured (like no routable ipv6 addr assigned).
This will attempt all paths to the DS before giving up, instead of immediately
falling back to the MDS.

As before, an error encountered after a successful connect() will cause all
i/o to fall back to the MDS.
Signed-off-by: default avatarWeston Andros Adamson <dros@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 14f9a607
...@@ -169,7 +169,7 @@ _data_server_match_all_addrs_locked(struct list_head *dsaddrs1, ...@@ -169,7 +169,7 @@ _data_server_match_all_addrs_locked(struct list_head *dsaddrs1,
static int static int
nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds) nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
{ {
struct nfs_client *clp; struct nfs_client *clp = ERR_PTR(-EIO);
struct nfs4_pnfs_ds_addr *da; struct nfs4_pnfs_ds_addr *da;
int status = 0; int status = 0;
...@@ -178,13 +178,17 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds) ...@@ -178,13 +178,17 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
BUG_ON(list_empty(&ds->ds_addrs)); BUG_ON(list_empty(&ds->ds_addrs));
da = list_first_entry(&ds->ds_addrs, struct nfs4_pnfs_ds_addr, da_node); list_for_each_entry(da, &ds->ds_addrs, da_node) {
dprintk("%s: using the first address for DS %s: %s\n", dprintk("%s: DS %s: trying address %s\n",
__func__, ds->ds_remotestr, da->da_remotestr); __func__, ds->ds_remotestr, da->da_remotestr);
clp = nfs4_set_ds_client(mds_srv->nfs_client, clp = nfs4_set_ds_client(mds_srv->nfs_client,
(struct sockaddr *)&da->da_addr, (struct sockaddr *)&da->da_addr,
da->da_addrlen, IPPROTO_TCP); da->da_addrlen, IPPROTO_TCP);
if (!IS_ERR(clp))
break;
}
if (IS_ERR(clp)) { if (IS_ERR(clp)) {
status = PTR_ERR(clp); status = PTR_ERR(clp);
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment