summarylogtreecommitdiffstats
path: root/0007-Revert-NFSv4.1-query-for-fs_location-attr-on-a-new-f.patch
blob: 517e5eeaefe00fd57b8c18e07e4c450ca0df2c23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
From 0092dcf3f0e0ee394a018a86989aea69081c4cea Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Thu, 24 Feb 2022 03:14:51 +0100
Subject: [PATCH 7/8] Revert "NFSv4.1 query for fs_location attr on a new file
 system"

This reverts commit 55b35b43a16ebed88df3ffac11e17ad0909bdf19.

For: https://bugs.archlinux.org/task/73838
For: https://bugs.archlinux.org/task/73860
---
 fs/nfs/client.c         |  7 ----
 fs/nfs/nfs4_fs.h        |  9 +++--
 fs/nfs/nfs4proc.c       | 76 ++++++-----------------------------------
 fs/nfs/nfs4state.c      |  3 +-
 include/linux/nfs_xdr.h |  1 -
 5 files changed, 15 insertions(+), 81 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index a1e87419f3a4..2d2f2c091c65 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -860,13 +860,6 @@ static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, str
 			server->namelen = pathinfo.max_namelen;
 	}
 
-	if (clp->rpc_ops->discover_trunking != NULL &&
-			(server->caps & NFS_CAP_FS_LOCATIONS)) {
-		error = clp->rpc_ops->discover_trunking(server, mntfh);
-		if (error < 0)
-			return error;
-	}
-
 	return 0;
 }
 
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 85c5d08dfa9c..2364661a6a08 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -260,8 +260,8 @@ struct nfs4_state_maintenance_ops {
 };
 
 struct nfs4_mig_recovery_ops {
-	int (*get_locations)(struct nfs_server *, struct nfs_fh *,
-		struct nfs4_fs_locations *, struct page *, const struct cred *);
+	int (*get_locations)(struct inode *, struct nfs4_fs_locations *,
+		struct page *, const struct cred *);
 	int (*fsid_present)(struct inode *, const struct cred *);
 };
 
@@ -303,9 +303,8 @@ extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait);
 extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
 extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *,
 				  struct nfs4_fs_locations *, struct page *);
-extern int nfs4_proc_get_locations(struct nfs_server *, struct nfs_fh *,
-				   struct nfs4_fs_locations *,
-				   struct page *page, const struct cred *);
+extern int nfs4_proc_get_locations(struct inode *, struct nfs4_fs_locations *,
+		struct page *page, const struct cred *);
 extern int nfs4_proc_fsid_present(struct inode *, const struct cred *);
 extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *,
 						    struct dentry *,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0abbbf5d2bdf..ba3aa4575d25 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3933,60 +3933,6 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle)
 	return err;
 }
 
-static int _nfs4_discover_trunking(struct nfs_server *server,
-				   struct nfs_fh *fhandle)
-{
-	struct nfs4_fs_locations *locations = NULL;
-	struct page *page;
-	const struct cred *cred;
-	struct nfs_client *clp = server->nfs_client;
-	const struct nfs4_state_maintenance_ops *ops =
-		clp->cl_mvops->state_renewal_ops;
-	int status = -ENOMEM;
-
-	cred = ops->get_state_renewal_cred(clp);
-	if (cred == NULL) {
-		cred = nfs4_get_clid_cred(clp);
-		if (cred == NULL)
-			return -ENOKEY;
-	}
-
-	page = alloc_page(GFP_KERNEL);
-	locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL);
-	if (page == NULL || locations == NULL)
-		goto out;
-
-	status = nfs4_proc_get_locations(server, fhandle, locations, page,
-					 cred);
-	if (status)
-		goto out;
-out:
-	if (page)
-		__free_page(page);
-	kfree(locations);
-	return status;
-}
-
-static int nfs4_discover_trunking(struct nfs_server *server,
-				  struct nfs_fh *fhandle)
-{
-	struct nfs4_exception exception = {
-		.interruptible = true,
-	};
-	struct nfs_client *clp = server->nfs_client;
-	int err = 0;
-
-	if (!nfs4_has_session(clp))
-		goto out;
-	do {
-		err = nfs4_handle_exception(server,
-				_nfs4_discover_trunking(server, fhandle),
-				&exception);
-	} while (exception.retry);
-out:
-	return err;
-}
-
 static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
 		struct nfs_fsinfo *info)
 {
@@ -7873,18 +7819,18 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
  * appended to this compound to identify the client ID which is
  * performing recovery.
  */
-static int _nfs40_proc_get_locations(struct nfs_server *server,
-				     struct nfs_fh *fhandle,
+static int _nfs40_proc_get_locations(struct inode *inode,
 				     struct nfs4_fs_locations *locations,
 				     struct page *page, const struct cred *cred)
 {
+	struct nfs_server *server = NFS_SERVER(inode);
 	struct rpc_clnt *clnt = server->client;
 	u32 bitmask[2] = {
 		[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
 	};
 	struct nfs4_fs_locations_arg args = {
 		.clientid	= server->nfs_client->cl_clientid,
-		.fh		= fhandle,
+		.fh		= NFS_FH(inode),
 		.page		= page,
 		.bitmask	= bitmask,
 		.migration	= 1,		/* skip LOOKUP */
@@ -7930,17 +7876,17 @@ static int _nfs40_proc_get_locations(struct nfs_server *server,
  * When the client supports GETATTR(fs_locations_info), it can
  * be plumbed in here.
  */
-static int _nfs41_proc_get_locations(struct nfs_server *server,
-				     struct nfs_fh *fhandle,
+static int _nfs41_proc_get_locations(struct inode *inode,
 				     struct nfs4_fs_locations *locations,
 				     struct page *page, const struct cred *cred)
 {
+	struct nfs_server *server = NFS_SERVER(inode);
 	struct rpc_clnt *clnt = server->client;
 	u32 bitmask[2] = {
 		[0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
 	};
 	struct nfs4_fs_locations_arg args = {
-		.fh		= fhandle,
+		.fh		= NFS_FH(inode),
 		.page		= page,
 		.bitmask	= bitmask,
 		.migration	= 1,		/* skip LOOKUP */
@@ -7989,11 +7935,11 @@ static int _nfs41_proc_get_locations(struct nfs_server *server,
  * -NFS4ERR_LEASE_MOVED is returned if the server still has leases
  * from this client that require migration recovery.
  */
-int nfs4_proc_get_locations(struct nfs_server *server,
-			    struct nfs_fh *fhandle,
+int nfs4_proc_get_locations(struct inode *inode,
 			    struct nfs4_fs_locations *locations,
 			    struct page *page, const struct cred *cred)
 {
+	struct nfs_server *server = NFS_SERVER(inode);
 	struct nfs_client *clp = server->nfs_client;
 	const struct nfs4_mig_recovery_ops *ops =
 					clp->cl_mvops->mig_recovery_ops;
@@ -8006,11 +7952,10 @@ int nfs4_proc_get_locations(struct nfs_server *server,
 		(unsigned long long)server->fsid.major,
 		(unsigned long long)server->fsid.minor,
 		clp->cl_hostname);
-	nfs_display_fhandle(fhandle, __func__);
+	nfs_display_fhandle(NFS_FH(inode), __func__);
 
 	do {
-		status = ops->get_locations(server, fhandle, locations, page,
-					    cred);
+		status = ops->get_locations(inode, locations, page, cred);
 		if (status != -NFS4ERR_DELAY)
 			break;
 		nfs4_handle_exception(server, status, &exception);
@@ -10479,7 +10424,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
 	.free_client	= nfs4_free_client,
 	.create_server	= nfs4_create_server,
 	.clone_server	= nfs_clone_server,
-	.discover_trunking = nfs4_discover_trunking,
 };
 
 static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = {
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 499bef9fe118..f3265575c28d 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -2098,8 +2098,7 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
 	}
 
 	inode = d_inode(server->super->s_root);
-	result = nfs4_proc_get_locations(server, NFS_FH(inode), locations,
-					 page, cred);
+	result = nfs4_proc_get_locations(inode, locations, page, cred);
 	if (result) {
 		dprintk("<-- %s: failed to retrieve fs_locations: %d\n",
 			__func__, result);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 695fa84611b6..967a0098f0a9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1795,7 +1795,6 @@ struct nfs_rpc_ops {
 	struct nfs_server *(*create_server)(struct fs_context *);
 	struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
 					   struct nfs_fattr *, rpc_authflavor_t);
-	int	(*discover_trunking)(struct nfs_server *, struct nfs_fh *);
 };
 
 /*
-- 
2.35.1