@@ -3935,6 +3935,56 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle)
3935
3935
return err ;
3936
3936
}
3937
3937
3938
+ static void test_fs_location_for_trunking (struct nfs4_fs_location * location ,
3939
+ struct nfs_client * clp ,
3940
+ struct nfs_server * server )
3941
+ {
3942
+ int i ;
3943
+
3944
+ for (i = 0 ; i < location -> nservers ; i ++ ) {
3945
+ struct nfs4_string * srv_loc = & location -> servers [i ];
3946
+ struct sockaddr addr ;
3947
+ size_t addrlen ;
3948
+ struct xprt_create xprt_args = {
3949
+ .ident = 0 ,
3950
+ .net = clp -> cl_net ,
3951
+ };
3952
+ struct nfs4_add_xprt_data xprtdata = {
3953
+ .clp = clp ,
3954
+ };
3955
+ struct rpc_add_xprt_test rpcdata = {
3956
+ .add_xprt_test = clp -> cl_mvops -> session_trunk ,
3957
+ .data = & xprtdata ,
3958
+ };
3959
+ char * servername = NULL ;
3960
+
3961
+ if (!srv_loc -> len )
3962
+ continue ;
3963
+
3964
+ addrlen = nfs_parse_server_name (srv_loc -> data , srv_loc -> len ,
3965
+ & addr , sizeof (addr ),
3966
+ clp -> cl_net , server -> port );
3967
+ if (!addrlen )
3968
+ return ;
3969
+ xprt_args .dstaddr = & addr ;
3970
+ xprt_args .addrlen = addrlen ;
3971
+ servername = kmalloc (srv_loc -> len + 1 , GFP_KERNEL );
3972
+ if (!servername )
3973
+ return ;
3974
+ memcpy (servername , srv_loc -> data , srv_loc -> len );
3975
+ servername [srv_loc -> len ] = '\0' ;
3976
+ xprt_args .servername = servername ;
3977
+
3978
+ xprtdata .cred = nfs4_get_clid_cred (clp );
3979
+ rpc_clnt_add_xprt (clp -> cl_rpcclient , & xprt_args ,
3980
+ rpc_clnt_setup_test_and_add_xprt ,
3981
+ & rpcdata );
3982
+ if (xprtdata .cred )
3983
+ put_cred (xprtdata .cred );
3984
+ kfree (servername );
3985
+ }
3986
+ }
3987
+
3938
3988
static int _nfs4_discover_trunking (struct nfs_server * server ,
3939
3989
struct nfs_fh * fhandle )
3940
3990
{
@@ -3944,7 +3994,7 @@ static int _nfs4_discover_trunking(struct nfs_server *server,
3944
3994
struct nfs_client * clp = server -> nfs_client ;
3945
3995
const struct nfs4_state_maintenance_ops * ops =
3946
3996
clp -> cl_mvops -> state_renewal_ops ;
3947
- int status = - ENOMEM ;
3997
+ int status = - ENOMEM , i ;
3948
3998
3949
3999
cred = ops -> get_state_renewal_cred (clp );
3950
4000
if (cred == NULL ) {
@@ -3962,6 +4012,10 @@ static int _nfs4_discover_trunking(struct nfs_server *server,
3962
4012
cred );
3963
4013
if (status )
3964
4014
goto out ;
4015
+
4016
+ for (i = 0 ; i < locations -> nlocations ; i ++ )
4017
+ test_fs_location_for_trunking (& locations -> locations [i ], clp ,
4018
+ server );
3965
4019
out :
3966
4020
if (page )
3967
4021
__free_page (page );
0 commit comments