OCaml 4.14.0 rebuild
[arch-packages.git] / linux-lts / repos / core-x86_64 / 0006-Fix-NFSv4-mount-regression.patch
blob470822db1b0fb0e7b074abfd74adb6349e297da8
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
3 Date: Sat, 6 Aug 2022 22:54:33 +0200
4 Subject: [PATCH] Fix NFSv4 mount regression
6 This reverts commit 6f2836341d8a (NFSv4.1 query for fs_location attr on
7 a new file system, 2022-01-12).
9 For: https://bugs.archlinux.org/task/73838
10 For: https://bugs.archlinux.org/task/73860
11 ---
12 fs/nfs/client.c | 7 ----
13 fs/nfs/nfs4_fs.h | 9 +++--
14 fs/nfs/nfs4proc.c | 76 ++++++-----------------------------------
15 fs/nfs/nfs4state.c | 3 +-
16 include/linux/nfs_xdr.h | 1 -
17 5 files changed, 15 insertions(+), 81 deletions(-)
19 diff --git a/fs/nfs/client.c b/fs/nfs/client.c
20 index 090b16890e3d..551833862171 100644
21 --- a/fs/nfs/client.c
22 +++ b/fs/nfs/client.c
23 @@ -860,13 +860,6 @@ int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs
24 server->namelen = pathinfo.max_namelen;
27 - if (clp->rpc_ops->discover_trunking != NULL &&
28 - (server->caps & NFS_CAP_FS_LOCATIONS)) {
29 - error = clp->rpc_ops->discover_trunking(server, mntfh);
30 - if (error < 0)
31 - return error;
32 - }
34 return 0;
36 EXPORT_SYMBOL_GPL(nfs_probe_fsinfo);
37 diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
38 index f8672a34fd63..36471dd0e82b 100644
39 --- a/fs/nfs/nfs4_fs.h
40 +++ b/fs/nfs/nfs4_fs.h
41 @@ -261,8 +261,8 @@ struct nfs4_state_maintenance_ops {
44 struct nfs4_mig_recovery_ops {
45 - int (*get_locations)(struct nfs_server *, struct nfs_fh *,
46 - struct nfs4_fs_locations *, struct page *, const struct cred *);
47 + int (*get_locations)(struct inode *, struct nfs4_fs_locations *,
48 + struct page *, const struct cred *);
49 int (*fsid_present)(struct inode *, const struct cred *);
52 @@ -304,9 +304,8 @@ extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait);
53 extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
54 extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const struct qstr *,
55 struct nfs4_fs_locations *, struct page *);
56 -extern int nfs4_proc_get_locations(struct nfs_server *, struct nfs_fh *,
57 - struct nfs4_fs_locations *,
58 - struct page *page, const struct cred *);
59 +extern int nfs4_proc_get_locations(struct inode *, struct nfs4_fs_locations *,
60 + struct page *page, const struct cred *);
61 extern int nfs4_proc_fsid_present(struct inode *, const struct cred *);
62 extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *,
63 struct dentry *,
64 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
65 index cbb39aff8182..3d4dee10cb11 100644
66 --- a/fs/nfs/nfs4proc.c
67 +++ b/fs/nfs/nfs4proc.c
68 @@ -3963,60 +3963,6 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle)
69 return err;
72 -static int _nfs4_discover_trunking(struct nfs_server *server,
73 - struct nfs_fh *fhandle)
75 - struct nfs4_fs_locations *locations = NULL;
76 - struct page *page;
77 - const struct cred *cred;
78 - struct nfs_client *clp = server->nfs_client;
79 - const struct nfs4_state_maintenance_ops *ops =
80 - clp->cl_mvops->state_renewal_ops;
81 - int status = -ENOMEM;
83 - cred = ops->get_state_renewal_cred(clp);
84 - if (cred == NULL) {
85 - cred = nfs4_get_clid_cred(clp);
86 - if (cred == NULL)
87 - return -ENOKEY;
88 - }
90 - page = alloc_page(GFP_KERNEL);
91 - locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL);
92 - if (page == NULL || locations == NULL)
93 - goto out;
95 - status = nfs4_proc_get_locations(server, fhandle, locations, page,
96 - cred);
97 - if (status)
98 - goto out;
99 -out:
100 - if (page)
101 - __free_page(page);
102 - kfree(locations);
103 - return status;
106 -static int nfs4_discover_trunking(struct nfs_server *server,
107 - struct nfs_fh *fhandle)
109 - struct nfs4_exception exception = {
110 - .interruptible = true,
111 - };
112 - struct nfs_client *clp = server->nfs_client;
113 - int err = 0;
115 - if (!nfs4_has_session(clp))
116 - goto out;
117 - do {
118 - err = nfs4_handle_exception(server,
119 - _nfs4_discover_trunking(server, fhandle),
120 - &exception);
121 - } while (exception.retry);
122 -out:
123 - return err;
126 static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
127 struct nfs_fsinfo *info)
129 @@ -7952,18 +7898,18 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
130 * appended to this compound to identify the client ID which is
131 * performing recovery.
133 -static int _nfs40_proc_get_locations(struct nfs_server *server,
134 - struct nfs_fh *fhandle,
135 +static int _nfs40_proc_get_locations(struct inode *inode,
136 struct nfs4_fs_locations *locations,
137 struct page *page, const struct cred *cred)
139 + struct nfs_server *server = NFS_SERVER(inode);
140 struct rpc_clnt *clnt = server->client;
141 u32 bitmask[2] = {
142 [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
144 struct nfs4_fs_locations_arg args = {
145 .clientid = server->nfs_client->cl_clientid,
146 - .fh = fhandle,
147 + .fh = NFS_FH(inode),
148 .page = page,
149 .bitmask = bitmask,
150 .migration = 1, /* skip LOOKUP */
151 @@ -8009,17 +7955,17 @@ static int _nfs40_proc_get_locations(struct nfs_server *server,
152 * When the client supports GETATTR(fs_locations_info), it can
153 * be plumbed in here.
155 -static int _nfs41_proc_get_locations(struct nfs_server *server,
156 - struct nfs_fh *fhandle,
157 +static int _nfs41_proc_get_locations(struct inode *inode,
158 struct nfs4_fs_locations *locations,
159 struct page *page, const struct cred *cred)
161 + struct nfs_server *server = NFS_SERVER(inode);
162 struct rpc_clnt *clnt = server->client;
163 u32 bitmask[2] = {
164 [0] = FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS,
166 struct nfs4_fs_locations_arg args = {
167 - .fh = fhandle,
168 + .fh = NFS_FH(inode),
169 .page = page,
170 .bitmask = bitmask,
171 .migration = 1, /* skip LOOKUP */
172 @@ -8068,28 +8014,27 @@ static int _nfs41_proc_get_locations(struct nfs_server *server,
173 * -NFS4ERR_LEASE_MOVED is returned if the server still has leases
174 * from this client that require migration recovery.
176 -int nfs4_proc_get_locations(struct nfs_server *server,
177 - struct nfs_fh *fhandle,
178 +int nfs4_proc_get_locations(struct inode *inode,
179 struct nfs4_fs_locations *locations,
180 struct page *page, const struct cred *cred)
182 + struct nfs_server *server = NFS_SERVER(inode);
183 struct nfs_client *clp = server->nfs_client;
184 const struct nfs4_mig_recovery_ops *ops =
185 clp->cl_mvops->mig_recovery_ops;
186 struct nfs4_exception exception = {
187 .interruptible = true,
189 int status;
191 dprintk("%s: FSID %llx:%llx on \"%s\"\n", __func__,
192 (unsigned long long)server->fsid.major,
193 (unsigned long long)server->fsid.minor,
194 clp->cl_hostname);
195 - nfs_display_fhandle(fhandle, __func__);
196 + nfs_display_fhandle(NFS_FH(inode), __func__);
198 do {
199 - status = ops->get_locations(server, fhandle, locations, page,
200 - cred);
201 + status = ops->get_locations(inode, locations, page, cred);
202 if (status != -NFS4ERR_DELAY)
203 break;
204 nfs4_handle_exception(server, status, &exception);
205 @@ -10586,7 +10531,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
206 .free_client = nfs4_free_client,
207 .create_server = nfs4_create_server,
208 .clone_server = nfs_clone_server,
209 - .discover_trunking = nfs4_discover_trunking,
212 static const struct xattr_handler nfs4_xattr_nfs4_acl_handler = {
213 diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
214 index 83c88b54d712..42707e12d35c 100644
215 --- a/fs/nfs/nfs4state.c
216 +++ b/fs/nfs/nfs4state.c
217 @@ -2098,8 +2098,7 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
220 inode = d_inode(server->super->s_root);
221 - result = nfs4_proc_get_locations(server, NFS_FH(inode), locations,
222 - page, cred);
223 + result = nfs4_proc_get_locations(inode, locations, page, cred);
224 if (result) {
225 dprintk("<-- %s: failed to retrieve fs_locations: %d\n",
226 __func__, result);
227 diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
228 index ecd74cc34797..e9698b6278a5 100644
229 --- a/include/linux/nfs_xdr.h
230 +++ b/include/linux/nfs_xdr.h
231 @@ -1805,7 +1805,6 @@ struct nfs_rpc_ops {
232 struct nfs_server *(*create_server)(struct fs_context *);
233 struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
234 struct nfs_fattr *, rpc_authflavor_t);
235 - int (*discover_trunking)(struct nfs_server *, struct nfs_fh *);