@@ -3935,6 +3935,60 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle)
3935
3935
return err ;
3936
3936
}
3937
3937
3938
+ static int _nfs4_discover_trunking (struct nfs_server * server ,
3939
+ struct nfs_fh * fhandle )
3940
+ {
3941
+ struct nfs4_fs_locations * locations = NULL ;
3942
+ struct page * page ;
3943
+ const struct cred * cred ;
3944
+ struct nfs_client * clp = server -> nfs_client ;
3945
+ const struct nfs4_state_maintenance_ops * ops =
3946
+ clp -> cl_mvops -> state_renewal_ops ;
3947
+ int status = - ENOMEM ;
3948
+
3949
+ cred = ops -> get_state_renewal_cred (clp );
3950
+ if (cred == NULL ) {
3951
+ cred = nfs4_get_clid_cred (clp );
3952
+ if (cred == NULL )
3953
+ return - ENOKEY ;
3954
+ }
3955
+
3956
+ page = alloc_page (GFP_KERNEL );
3957
+ locations = kmalloc (sizeof (struct nfs4_fs_locations ), GFP_KERNEL );
3958
+ if (page == NULL || locations == NULL )
3959
+ goto out ;
3960
+
3961
+ status = nfs4_proc_get_locations (server , fhandle , locations , page ,
3962
+ cred );
3963
+ if (status )
3964
+ goto out ;
3965
+ out :
3966
+ if (page )
3967
+ __free_page (page );
3968
+ kfree (locations );
3969
+ return status ;
3970
+ }
3971
+
3972
+ static int nfs4_discover_trunking (struct nfs_server * server ,
3973
+ struct nfs_fh * fhandle )
3974
+ {
3975
+ struct nfs4_exception exception = {
3976
+ .interruptible = true,
3977
+ };
3978
+ struct nfs_client * clp = server -> nfs_client ;
3979
+ int err = 0 ;
3980
+
3981
+ if (!nfs4_has_session (clp ))
3982
+ goto out ;
3983
+ do {
3984
+ err = nfs4_handle_exception (server ,
3985
+ _nfs4_discover_trunking (server , fhandle ),
3986
+ & exception );
3987
+ } while (exception .retry );
3988
+ out :
3989
+ return err ;
3990
+ }
3991
+
3938
3992
static int _nfs4_lookup_root (struct nfs_server * server , struct nfs_fh * fhandle ,
3939
3993
struct nfs_fsinfo * info )
3940
3994
{
@@ -7823,18 +7877,18 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
7823
7877
* appended to this compound to identify the client ID which is
7824
7878
* performing recovery.
7825
7879
*/
7826
- static int _nfs40_proc_get_locations (struct inode * inode ,
7880
+ static int _nfs40_proc_get_locations (struct nfs_server * server ,
7881
+ struct nfs_fh * fhandle ,
7827
7882
struct nfs4_fs_locations * locations ,
7828
7883
struct page * page , const struct cred * cred )
7829
7884
{
7830
- struct nfs_server * server = NFS_SERVER (inode );
7831
7885
struct rpc_clnt * clnt = server -> client ;
7832
7886
u32 bitmask [2 ] = {
7833
7887
[0 ] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS ,
7834
7888
};
7835
7889
struct nfs4_fs_locations_arg args = {
7836
7890
.clientid = server -> nfs_client -> cl_clientid ,
7837
- .fh = NFS_FH ( inode ) ,
7891
+ .fh = fhandle ,
7838
7892
.page = page ,
7839
7893
.bitmask = bitmask ,
7840
7894
.migration = 1 , /* skip LOOKUP */
@@ -7880,17 +7934,17 @@ static int _nfs40_proc_get_locations(struct inode *inode,
7880
7934
* When the client supports GETATTR(fs_locations_info), it can
7881
7935
* be plumbed in here.
7882
7936
*/
7883
- static int _nfs41_proc_get_locations (struct inode * inode ,
7937
+ static int _nfs41_proc_get_locations (struct nfs_server * server ,
7938
+ struct nfs_fh * fhandle ,
7884
7939
struct nfs4_fs_locations * locations ,
7885
7940
struct page * page , const struct cred * cred )
7886
7941
{
7887
- struct nfs_server * server = NFS_SERVER (inode );
7888
7942
struct rpc_clnt * clnt = server -> client ;
7889
7943
u32 bitmask [2 ] = {
7890
7944
[0 ] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS ,
7891
7945
};
7892
7946
struct nfs4_fs_locations_arg args = {
7893
- .fh = NFS_FH ( inode ) ,
7947
+ .fh = fhandle ,
7894
7948
.page = page ,
7895
7949
.bitmask = bitmask ,
7896
7950
.migration = 1 , /* skip LOOKUP */
@@ -7939,11 +7993,11 @@ static int _nfs41_proc_get_locations(struct inode *inode,
7939
7993
* -NFS4ERR_LEASE_MOVED is returned if the server still has leases
7940
7994
* from this client that require migration recovery.
7941
7995
*/
7942
- int nfs4_proc_get_locations (struct inode * inode ,
7996
+ int nfs4_proc_get_locations (struct nfs_server * server ,
7997
+ struct nfs_fh * fhandle ,
7943
7998
struct nfs4_fs_locations * locations ,
7944
7999
struct page * page , const struct cred * cred )
7945
8000
{
7946
- struct nfs_server * server = NFS_SERVER (inode );
7947
8001
struct nfs_client * clp = server -> nfs_client ;
7948
8002
const struct nfs4_mig_recovery_ops * ops =
7949
8003
clp -> cl_mvops -> mig_recovery_ops ;
@@ -7956,10 +8010,11 @@ int nfs4_proc_get_locations(struct inode *inode,
7956
8010
(unsigned long long )server -> fsid .major ,
7957
8011
(unsigned long long )server -> fsid .minor ,
7958
8012
clp -> cl_hostname );
7959
- nfs_display_fhandle (NFS_FH ( inode ) , __func__ );
8013
+ nfs_display_fhandle (fhandle , __func__ );
7960
8014
7961
8015
do {
7962
- status = ops -> get_locations (inode , locations , page , cred );
8016
+ status = ops -> get_locations (server , fhandle , locations , page ,
8017
+ cred );
7963
8018
if (status != - NFS4ERR_DELAY )
7964
8019
break ;
7965
8020
nfs4_handle_exception (server , status , & exception );
@@ -10428,6 +10483,7 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
10428
10483
.free_client = nfs4_free_client ,
10429
10484
.create_server = nfs4_create_server ,
10430
10485
.clone_server = nfs_clone_server ,
10486
+ .discover_trunking = nfs4_discover_trunking ,
10431
10487
};
10432
10488
10433
10489
static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = {
0 commit comments