diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-02-22 17:58:38 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-02-22 17:58:38 -0500 |
commit | ecf7828683997dbc8e95e7beca3ccdcab5e1bfac (patch) | |
tree | f3ae2220569d995acb7874abe473bbdc3a59016b /fs/nfs | |
parent | cc1f9000eaf6d98f91602c49f1ceed54f965cc43 (diff) | |
parent | 02a95dee8cf03a73982f9cabf549c04ae354bed7 (diff) |
Merge branch 'multipath'
* multipath:
NFS add callback_ops to nfs4_proc_bind_conn_to_session_callback
pnfs/NFSv4.1: Add multipath capabilities to pNFS flexfiles servers over NFSv3
SUNRPC: Allow addition of new transports to a struct rpc_clnt
NFSv4.1: nfs4_proc_bind_conn_to_session must iterate over all connections
SUNRPC: Make NFS swap work with multipath
SUNRPC: Add a helper to apply a function to all the rpc_clnt's transports
SUNRPC: Allow caller to specify the transport to use
SUNRPC: Use the multipath iterator to assign a transport to each task
SUNRPC: Make rpc_clnt store the multipath iterators
SUNRPC: Add a structure to track multiple transports
SUNRPC: Make freeing of struct xprt rcu-safe
SUNRPC: Uninline xprt_get(); It isn't performance critical.
SUNRPC: Reorder rpc_task to put waitqueue related info in same cachelines
SUNRPC: Remove unused function rpc_task_reset_client
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 61 | ||||
-rw-r--r-- | fs/nfs/pnfs_nfs.c | 16 |
2 files changed, 71 insertions, 6 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1e103b4f4ad7..c70de30b80f1 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -6782,13 +6782,26 @@ nfs41_same_server_scope(struct nfs41_server_scope *a, | |||
6782 | return false; | 6782 | return false; |
6783 | } | 6783 | } |
6784 | 6784 | ||
6785 | static void | ||
6786 | nfs4_bind_one_conn_to_session_done(struct rpc_task *task, void *calldata) | ||
6787 | { | ||
6788 | } | ||
6789 | |||
6790 | static const struct rpc_call_ops nfs4_bind_one_conn_to_session_ops = { | ||
6791 | .rpc_call_done = &nfs4_bind_one_conn_to_session_done, | ||
6792 | }; | ||
6793 | |||
6785 | /* | 6794 | /* |
6786 | * nfs4_proc_bind_conn_to_session() | 6795 | * nfs4_proc_bind_one_conn_to_session() |
6787 | * | 6796 | * |
6788 | * The 4.1 client currently uses the same TCP connection for the | 6797 | * The 4.1 client currently uses the same TCP connection for the |
6789 | * fore and backchannel. | 6798 | * fore and backchannel. |
6790 | */ | 6799 | */ |
6791 | int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred) | 6800 | static |
6801 | int nfs4_proc_bind_one_conn_to_session(struct rpc_clnt *clnt, | ||
6802 | struct rpc_xprt *xprt, | ||
6803 | struct nfs_client *clp, | ||
6804 | struct rpc_cred *cred) | ||
6792 | { | 6805 | { |
6793 | int status; | 6806 | int status; |
6794 | struct nfs41_bind_conn_to_session_args args = { | 6807 | struct nfs41_bind_conn_to_session_args args = { |
@@ -6803,6 +6816,14 @@ int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred | |||
6803 | .rpc_resp = &res, | 6816 | .rpc_resp = &res, |
6804 | .rpc_cred = cred, | 6817 | .rpc_cred = cred, |
6805 | }; | 6818 | }; |
6819 | struct rpc_task_setup task_setup_data = { | ||
6820 | .rpc_client = clnt, | ||
6821 | .rpc_xprt = xprt, | ||
6822 | .callback_ops = &nfs4_bind_one_conn_to_session_ops, | ||
6823 | .rpc_message = &msg, | ||
6824 | .flags = RPC_TASK_TIMEOUT, | ||
6825 | }; | ||
6826 | struct rpc_task *task; | ||
6806 | 6827 | ||
6807 | dprintk("--> %s\n", __func__); | 6828 | dprintk("--> %s\n", __func__); |
6808 | 6829 | ||
@@ -6810,7 +6831,16 @@ int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred | |||
6810 | if (!(clp->cl_session->flags & SESSION4_BACK_CHAN)) | 6831 | if (!(clp->cl_session->flags & SESSION4_BACK_CHAN)) |
6811 | args.dir = NFS4_CDFC4_FORE; | 6832 | args.dir = NFS4_CDFC4_FORE; |
6812 | 6833 | ||
6813 | status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); | 6834 | /* Do not set the backchannel flag unless this is clnt->cl_xprt */ |
6835 | if (xprt != rcu_access_pointer(clnt->cl_xprt)) | ||
6836 | args.dir = NFS4_CDFC4_FORE; | ||
6837 | |||
6838 | task = rpc_run_task(&task_setup_data); | ||
6839 | if (!IS_ERR(task)) { | ||
6840 | status = task->tk_status; | ||
6841 | rpc_put_task(task); | ||
6842 | } else | ||
6843 | status = PTR_ERR(task); | ||
6814 | trace_nfs4_bind_conn_to_session(clp, status); | 6844 | trace_nfs4_bind_conn_to_session(clp, status); |
6815 | if (status == 0) { | 6845 | if (status == 0) { |
6816 | if (memcmp(res.sessionid.data, | 6846 | if (memcmp(res.sessionid.data, |
@@ -6837,6 +6867,31 @@ out: | |||
6837 | return status; | 6867 | return status; |
6838 | } | 6868 | } |
6839 | 6869 | ||
6870 | struct rpc_bind_conn_calldata { | ||
6871 | struct nfs_client *clp; | ||
6872 | struct rpc_cred *cred; | ||
6873 | }; | ||
6874 | |||
6875 | static int | ||
6876 | nfs4_proc_bind_conn_to_session_callback(struct rpc_clnt *clnt, | ||
6877 | struct rpc_xprt *xprt, | ||
6878 | void *calldata) | ||
6879 | { | ||
6880 | struct rpc_bind_conn_calldata *p = calldata; | ||
6881 | |||
6882 | return nfs4_proc_bind_one_conn_to_session(clnt, xprt, p->clp, p->cred); | ||
6883 | } | ||
6884 | |||
6885 | int nfs4_proc_bind_conn_to_session(struct nfs_client *clp, struct rpc_cred *cred) | ||
6886 | { | ||
6887 | struct rpc_bind_conn_calldata data = { | ||
6888 | .clp = clp, | ||
6889 | .cred = cred, | ||
6890 | }; | ||
6891 | return rpc_clnt_iterate_for_each_xprt(clp->cl_rpcclient, | ||
6892 | nfs4_proc_bind_conn_to_session_callback, &data); | ||
6893 | } | ||
6894 | |||
6840 | /* | 6895 | /* |
6841 | * Minimum set of SP4_MACH_CRED operations from RFC 5661 in the enforce map | 6896 | * Minimum set of SP4_MACH_CRED operations from RFC 5661 in the enforce map |
6842 | * and operations we'd like to see to enable certain features in the allow map | 6897 | * and operations we'd like to see to enable certain features in the allow map |
diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index 81ac6480f9e7..4aaed890048f 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c | |||
@@ -606,12 +606,22 @@ static int _nfs4_pnfs_v3_ds_connect(struct nfs_server *mds_srv, | |||
606 | dprintk("%s: DS %s: trying address %s\n", | 606 | dprintk("%s: DS %s: trying address %s\n", |
607 | __func__, ds->ds_remotestr, da->da_remotestr); | 607 | __func__, ds->ds_remotestr, da->da_remotestr); |
608 | 608 | ||
609 | clp = get_v3_ds_connect(mds_srv->nfs_client, | 609 | if (!IS_ERR(clp)) { |
610 | struct xprt_create xprt_args = { | ||
611 | .ident = XPRT_TRANSPORT_TCP, | ||
612 | .net = clp->cl_net, | ||
613 | .dstaddr = (struct sockaddr *)&da->da_addr, | ||
614 | .addrlen = da->da_addrlen, | ||
615 | .servername = clp->cl_hostname, | ||
616 | }; | ||
617 | /* Add this address as an alias */ | ||
618 | rpc_clnt_add_xprt(clp->cl_rpcclient, &xprt_args, | ||
619 | rpc_clnt_test_and_add_xprt, NULL); | ||
620 | } else | ||
621 | clp = get_v3_ds_connect(mds_srv->nfs_client, | ||
610 | (struct sockaddr *)&da->da_addr, | 622 | (struct sockaddr *)&da->da_addr, |
611 | da->da_addrlen, IPPROTO_TCP, | 623 | da->da_addrlen, IPPROTO_TCP, |
612 | timeo, retrans, au_flavor); | 624 | timeo, retrans, au_flavor); |
613 | if (!IS_ERR(clp)) | ||
614 | break; | ||
615 | } | 625 | } |
616 | 626 | ||
617 | if (IS_ERR(clp)) { | 627 | if (IS_ERR(clp)) { |