History

Merge tag 'nfsd-6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux

Pull nfsd updates from Chuck Lever: "NFSD is finally able to offer write delegations to clients that open files with O_WRONLY, thanks to patches from Dai Ngo. We're expecting this to accelerate a few interesting corner cases. The cap on the number of operations per NFSv4 COMPOUND has been lifted. Now, clients that send COMPOUNDs containing dozens of operations (for example, a long stream of LOOKUP operations to walk a pathname in a single round trip) will no longer be rejected. This release re-enables the ability for NFSD to perform NFSv4.2 COPY operations asynchronously. This feature has been disabled to mitigate the risk of denial-of-service when too many such requests arrive. Many thanks to the contributors, reviewers, testers, and bug reporters who participated during the v6.17 development cycle" * tag 'nfsd-6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (32 commits) nfsd: Drop dprintk in blocklayout xdr functions sunrpc: make svc_tcp_sendmsg() take a signed sentp pointer sunrpc: rearrange struct svc_rqst for fewer cachelines sunrpc: return better error in svcauth_gss_accept() on alloc failure sunrpc: reset rq_accept_statp when starting a new RPC sunrpc: remove SVC_SYSERR sunrpc: fix handling of unknown auth status codes NFSD: Simplify struct knfsd_fh NFSD: Access a knfsd_fh's fsid by pointer Revert "NFSD: Force all NFSv4.2 COPY requests to be synchronous" NFSD: Avoid multiple -Wflex-array-member-not-at-end warnings NFSD: Use vfs_iocb_iter_write() NFSD: Use vfs_iocb_iter_read() NFSD: Clean up kdoc for nfsd_open_local_fh() NFSD: Clean up kdoc for nfsd_file_put_local() NFSD: Remove definition for trace_nfsd_ctl_maxconn NFSD: Remove definition for trace_nfsd_file_gc_recent NFSD: Remove definitions for unused trace_nfsd_file_lru trace points NFSD: Remove definition for trace_nfsd_file_unhash_and_queue nfsd: Use correct error code when decoding extents ...

Linus Torvalds committed 1 year ago

Commit ce3f5bb2 parents a90f1b6 e33996731 files · +341 −347Browse files

Unified · Split

31 files
  1. fs/nfsd/blocklayout.c +12 −8
  2. fs/nfsd/blocklayoutxdr.c +63 −48
  3. fs/nfsd/blocklayoutxdr.h +4 −4
  4. fs/nfsd/export.c +3 −5
  5. fs/nfsd/export.h +1 −1
  6. fs/nfsd/filecache.c +1 −1
  7. fs/nfsd/localio.c +1 −1
  8. fs/nfsd/nfs3proc.c +1 −1
  9. fs/nfsd/nfs4layouts.c +2 −2
  10. fs/nfsd/nfs4proc.c +2 −19
  11. fs/nfsd/nfs4state.c +84 −35
  12. fs/nfsd/nfs4xdr.c +1 −3
  13. fs/nfsd/nfsctl.c +16 −15
  14. fs/nfsd/nfsd.h +2 −4
  15. fs/nfsd/nfsfh.c +9 −7
  16. fs/nfsd/nfsfh.h +15 −11
  17. fs/nfsd/nfsproc.c +1 −1
  18. fs/nfsd/state.h +1 −0
  19. fs/nfsd/trace.h +2 −25
  20. fs/nfsd/vfs.c +10 −7
  21. fs/nfsd/xdr4.h +0 −1
  22. include/linux/sunrpc/msg_prot.h +10 −8
  23. include/linux/sunrpc/svc.h +3 −3
  24. include/linux/sunrpc/svcauth.h +0 −1
  25. include/linux/sunrpc/xdr.h +3 −2
  26. include/trace/events/sunrpc.h +18 −7
  27. net/sunrpc/auth_gss/svcauth_gss.c +2 −1
  28. net/sunrpc/socklib.c +59 −105
  29. net/sunrpc/svc.c +9 −11
  30. net/sunrpc/svcsock.c +2 −3
  31. net/sunrpc/xdr.c +4 −7
fs/nfsd/blocklayout.c+12−8
@@ -178,11 +178,13 @@ nfsd4_block_proc_layoutcommit(struct inode *inode, · 177 unmodified lines
178178 {
179179 struct iomap *iomaps;
180180 int nr_iomaps;
181+ __be32 nfserr;
181182
182− nr_iomaps = nfsd4_block_decode_layoutupdate(lcp->lc_up_layout,
183− lcp->lc_up_len, &iomaps, i_blocksize(inode));
184− if (nr_iomaps < 0)
185− return nfserrno(nr_iomaps);
183+ nfserr = nfsd4_block_decode_layoutupdate(lcp->lc_up_layout,
184+ lcp->lc_up_len, &iomaps, &nr_iomaps,
185+ i_blocksize(inode));
186+ if (nfserr != nfs_ok)
187+ return nfserr;
186188
187189 return nfsd4_block_commit_blocks(inode, lcp, iomaps, nr_iomaps);
188190 }
@@ -316,11 +318,13 @@ nfsd4_scsi_proc_layoutcommit(struct inode *inode, · 127 unmodified lines
316318 {
317319 struct iomap *iomaps;
318320 int nr_iomaps;
321+ __be32 nfserr;
319322
320− nr_iomaps = nfsd4_scsi_decode_layoutupdate(lcp->lc_up_layout,
321− lcp->lc_up_len, &iomaps, i_blocksize(inode));
322− if (nr_iomaps < 0)
323− return nfserrno(nr_iomaps);
323+ nfserr = nfsd4_scsi_decode_layoutupdate(lcp->lc_up_layout,
324+ lcp->lc_up_len, &iomaps, &nr_iomaps,
325+ i_blocksize(inode));
326+ if (nfserr != nfs_ok)
327+ return nfserr;
324328
325329 return nfsd4_block_commit_blocks(inode, lcp, iomaps, nr_iomaps);
326330 }
fs/nfsd/blocklayoutxdr.c+63−48
@@ -112,35 +112,46 @@ nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr, · 111 unmodified lines
112112 return 0;
113113 }
114114
115−int
115+/**
116+ * nfsd4_block_decode_layoutupdate - decode the block layout extent array
117+ * @p: pointer to the xdr data
118+ * @len: number of bytes to decode
119+ * @iomapp: pointer to store the decoded extent array
120+ * @nr_iomapsp: pointer to store the number of extents
121+ * @block_size: alignment of extent offset and length
122+ *
123+ * This function decodes the opaque field of the layoutupdate4 structure
124+ * in a layoutcommit request for the block layout driver. The field is
125+ * actually an array of extents sent by the client. It also checks that
126+ * the file offset, storage offset and length of each extent are aligned
127+ * by @block_size.
128+ *
129+ * Return values:
130+ * %nfs_ok: Successful decoding, @iomapp and @nr_iomapsp are valid
131+ * %nfserr_bad_xdr: The encoded array in @p is invalid
132+ * %nfserr_inval: An unaligned extent found
133+ * %nfserr_delay: Failed to allocate memory for @iomapp
134+ */
135+__be32
116136 nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
117− u32 block_size)
137+ int *nr_iomapsp, u32 block_size)
118138 {
119139 struct iomap *iomaps;
120140 u32 nr_iomaps, i;
121141
122− if (len < sizeof(u32)) {
123− dprintk("%s: extent array too small: %u\n", __func__, len);
124− return -EINVAL;
125− }
142+ if (len < sizeof(u32))
143+ return nfserr_bad_xdr;
126144 len -= sizeof(u32);
127− if (len % PNFS_BLOCK_EXTENT_SIZE) {
128− dprintk("%s: extent array invalid: %u\n", __func__, len);
129− return -EINVAL;
130− }
145+ if (len % PNFS_BLOCK_EXTENT_SIZE)
146+ return nfserr_bad_xdr;
131147
132148 nr_iomaps = be32_to_cpup(p++);
133− if (nr_iomaps != len / PNFS_BLOCK_EXTENT_SIZE) {
134− dprintk("%s: extent array size mismatch: %u/%u\n",
135− __func__, len, nr_iomaps);
136− return -EINVAL;
137− }
149+ if (nr_iomaps != len / PNFS_BLOCK_EXTENT_SIZE)
150+ return nfserr_bad_xdr;
138151
139152 iomaps = kcalloc(nr_iomaps, sizeof(*iomaps), GFP_KERNEL);
140− if (!iomaps) {
141− dprintk("%s: failed to allocate extent array\n", __func__);
142− return -ENOMEM;
143− }
153+ if (!iomaps)
154+ return nfserr_delay;
144155
145156 for (i = 0; i < nr_iomaps; i++) {
146157 struct pnfs_block_extent bex;
@@ -150,26 +161,18 @@ nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp, · 3 unmodified lines
150161
151162 p = xdr_decode_hyper(p, &bex.foff);
152163 if (bex.foff & (block_size - 1)) {
153− dprintk("%s: unaligned offset 0x%llx\n",
154− __func__, bex.foff);
155164 goto fail;
156165 }
157166 p = xdr_decode_hyper(p, &bex.len);
158167 if (bex.len & (block_size - 1)) {
159− dprintk("%s: unaligned length 0x%llx\n",
160− __func__, bex.foff);
161168 goto fail;
162169 }
163170 p = xdr_decode_hyper(p, &bex.soff);
164171 if (bex.soff & (block_size - 1)) {
165− dprintk("%s: unaligned disk offset 0x%llx\n",
166− __func__, bex.soff);
167172 goto fail;
168173 }
169174 bex.es = be32_to_cpup(p++);
170175 if (bex.es != PNFS_BLOCK_READWRITE_DATA) {
171− dprintk("%s: incorrect extent state %d\n",
172− __func__, bex.es);
173176 goto fail;
174177 }
175178
@@ -178,59 +181,71 @@ nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp, · 2 unmodified lines
178181 }
179182
180183 *iomapp = iomaps;
181− return nr_iomaps;
184+ *nr_iomapsp = nr_iomaps;
185+ return nfs_ok;
182186 fail:
183187 kfree(iomaps);
184− return -EINVAL;
188+ return nfserr_inval;
185189 }
186190
187−int
191+/**
192+ * nfsd4_scsi_decode_layoutupdate - decode the scsi layout extent array
193+ * @p: pointer to the xdr data
194+ * @len: number of bytes to decode
195+ * @iomapp: pointer to store the decoded extent array
196+ * @nr_iomapsp: pointer to store the number of extents
197+ * @block_size: alignment of extent offset and length
198+ *
199+ * This function decodes the opaque field of the layoutupdate4 structure
200+ * in a layoutcommit request for the scsi layout driver. The field is
201+ * actually an array of extents sent by the client. It also checks that
202+ * the offset and length of each extent are aligned by @block_size.
203+ *
204+ * Return values:
205+ * %nfs_ok: Successful decoding, @iomapp and @nr_iomapsp are valid
206+ * %nfserr_bad_xdr: The encoded array in @p is invalid
207+ * %nfserr_inval: An unaligned extent found
208+ * %nfserr_delay: Failed to allocate memory for @iomapp
209+ */
210+__be32
188211 nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
189− u32 block_size)
212+ int *nr_iomapsp, u32 block_size)
190213 {
191214 struct iomap *iomaps;
192215 u32 nr_iomaps, expected, i;
193216
194− if (len < sizeof(u32)) {
195− dprintk("%s: extent array too small: %u\n", __func__, len);
196− return -EINVAL;
197− }
217+ if (len < sizeof(u32))
218+ return nfserr_bad_xdr;
198219
199220 nr_iomaps = be32_to_cpup(p++);
200221 expected = sizeof(__be32) + nr_iomaps * PNFS_SCSI_RANGE_SIZE;
201− if (len != expected) {
202− dprintk("%s: extent array size mismatch: %u/%u\n",
203− __func__, len, expected);
204− return -EINVAL;
205− }
222+ if (len != expected)
223+ return nfserr_bad_xdr;
206224
207225 iomaps = kcalloc(nr_iomaps, sizeof(*iomaps), GFP_KERNEL);
208− if (!iomaps) {
209− dprintk("%s: failed to allocate extent array\n", __func__);
210− return -ENOMEM;
211− }
226+ if (!iomaps)
227+ return nfserr_delay;
212228
213229 for (i = 0; i < nr_iomaps; i++) {
214230 u64 val;
215231
216232 p = xdr_decode_hyper(p, &val);
217233 if (val & (block_size - 1)) {
218− dprintk("%s: unaligned offset 0x%llx\n", __func__, val);
219234 goto fail;
220235 }
221236 iomaps[i].offset = val;
222237
223238 p = xdr_decode_hyper(p, &val);
224239 if (val & (block_size - 1)) {
225− dprintk("%s: unaligned length 0x%llx\n", __func__, val);
226240 goto fail;
227241 }
228242 iomaps[i].length = val;
229243 }
230244
231245 *iomapp = iomaps;
232− return nr_iomaps;
246+ *nr_iomapsp = nr_iomaps;
247+ return nfs_ok;
233248 fail:
234249 kfree(iomaps);
235− return -EINVAL;
250+ return nfserr_inval;
236251 }
fs/nfsd/blocklayoutxdr.h+4−4
@@ -54,9 +54,9 @@ __be32 nfsd4_block_encode_getdeviceinfo(struct xdr_stream *xdr, · 53 unmodified lines
5454 const struct nfsd4_getdeviceinfo *gdp);
5555 __be32 nfsd4_block_encode_layoutget(struct xdr_stream *xdr,
5656 const struct nfsd4_layoutget *lgp);
57−int nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
58− u32 block_size);
59−int nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
60− u32 block_size);
57+__be32 nfsd4_block_decode_layoutupdate(__be32 *p, u32 len,
58+ struct iomap **iomapp, int *nr_iomapsp, u32 block_size);
59+__be32 nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len,
60+ struct iomap **iomapp, int *nr_iomapsp, u32 block_size);
6161
6262 #endif /* _NFSD_BLOCKLAYOUTXDR_H */
fs/nfsd/export.c+3−5
@@ -82,8 +82,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) · 81 unmodified lines
8282 int len;
8383 struct auth_domain *dom = NULL;
8484 int err;
85− int fsidtype;
86− char *ep;
85+ u8 fsidtype;
8786 struct svc_expkey key;
8887 struct svc_expkey *ek = NULL;
8988
@@ -109,10 +108,9 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) · 19 unmodified lines
109108 err = -EINVAL;
110109 if (qword_get(&mesg, buf, PAGE_SIZE) <= 0)
111110 goto out;
112− fsidtype = simple_strtoul(buf, &ep, 10);
113− if (*ep)
111+ if (kstrtou8(buf, 10, &fsidtype))
114112 goto out;
115− dprintk("found fsidtype %d\n", fsidtype);
113+ dprintk("found fsidtype %u\n", fsidtype);
116114 if (key_len(fsidtype)==0) /* invalid type */
117115 goto out;
118116 if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
fs/nfsd/export.h+1−1
@@ -88,7 +88,7 @@ struct svc_expkey { · 87 unmodified lines
8888 struct cache_head h;
8989
9090 struct auth_domain * ek_client;
91− int ek_fsidtype;
91+ u8 ek_fsidtype;
9292 u32 ek_fsid[6];
9393
9494 struct path ek_path;
fs/nfsd/filecache.c+1−1
@@ -372,7 +372,7 @@ nfsd_file_put(struct nfsd_file *nf) · 371 unmodified lines
372372
373373 /**
374374 * nfsd_file_put_local - put nfsd_file reference and arm nfsd_net_put in caller
375− * @nf: nfsd_file of which to put the reference
375+ * @pnf: nfsd_file of which to put the reference
376376 *
377377 * First save the associated net to return to caller, then put
378378 * the reference of the nfsd_file.
fs/nfsd/localio.c+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 * @rpc_clnt: rpc_clnt that the client established
3333 * @cred: cred that the client established
3434 * @nfs_fh: filehandle to lookup
35− * @nfp: place to find the nfsd_file, or store it if it was non-NULL
35+ * @pnf: place to find the nfsd_file, or store it if it was non-NULL
3636 * @fmode: fmode_t to use for open
3737 *
3838 * This function maps a local fh to a path on a local filesystem.
fs/nfsd/nfs3proc.c+1−1
@@ -561,7 +561,7 @@ static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp, · 560 unmodified lines
561561 buf->pages = rqstp->rq_next_page;
562562 rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
563563
564− xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
564+ xdr_init_encode_pages(xdr, buf);
565565 }
566566
567567 /*
fs/nfsd/nfs4layouts.c+2−2
@@ -65,7 +65,7 @@ nfsd4_alloc_devid_map(const struct svc_fh *fhp) · 64 unmodified lines
6565 return;
6666
6767 map->fsid_type = fh->fh_fsid_type;
68− memcpy(&map->fsid, fh->fh_fsid, fsid_len);
68+ memcpy(&map->fsid, fh_fsid(fh), fsid_len);
6969
7070 spin_lock(&nfsd_devid_lock);
7171 if (fhp->fh_export->ex_devid_map)
@@ -75,7 +75,7 @@ nfsd4_alloc_devid_map(const struct svc_fh *fhp) · 3 unmodified lines
7575 list_for_each_entry(old, &nfsd_devid_hash[i], hash) {
7676 if (old->fsid_type != fh->fh_fsid_type)
7777 continue;
78− if (memcmp(old->fsid, fh->fh_fsid,
78+ if (memcmp(old->fsid, fh_fsid(fh),
7979 key_len(old->fsid_type)))
8080 continue;
8181
fs/nfsd/nfs4proc.c+2−19
@@ -1917,13 +1917,6 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 1916 unmodified lines
19171917 struct nfsd42_write_res *result;
19181918 __be32 status;
19191919
1920− /*
1921− * Currently, async COPY is not reliable. Force all COPY
1922− * requests to be synchronous to avoid client application
1923− * hangs waiting for COPY completion.
1924− */
1925− nfsd4_copy_set_sync(copy, true);
1926−
19271920 result = &copy->cp_res;
19281921 nfsd_copy_write_verifier((__be32 *)&result->wr_verifier.data, nn);
19291922
@@ -2842,20 +2835,10 @@ nfsd4_proc_compound(struct svc_rqst *rqstp) · 912 unmodified lines
28422835
28432836 rqstp->rq_lease_breaker = (void **)&cstate->clp;
28442837
2845− trace_nfsd_compound(rqstp, args->tag, args->taglen, args->client_opcnt);
2838+ trace_nfsd_compound(rqstp, args->tag, args->taglen, args->opcnt);
28462839 while (!status && resp->opcnt < args->opcnt) {
28472840 op = &args->ops[resp->opcnt++];
28482841
2849− if (unlikely(resp->opcnt == NFSD_MAX_OPS_PER_COMPOUND)) {
2850− /* If there are still more operations to process,
2851− * stop here and report NFS4ERR_RESOURCE. */
2852− if (cstate->minorversion == 0 &&
2853− args->client_opcnt > resp->opcnt) {
2854− op->status = nfserr_resource;
2855− goto encode_op;
2856− }
2857− }
2858−
28592842 /*
28602843 * The XDR decode routines may have pre-set op->status;
28612844 * for example, if there is a miscellaneous XDR error
@@ -2932,7 +2915,7 @@ encode_op: · 70 unmodified lines
29322915 status = op->status;
29332916 }
29342917
2935− trace_nfsd_compound_status(args->client_opcnt, resp->opcnt,
2918+ trace_nfsd_compound_status(args->opcnt, resp->opcnt,
29362919 status, nfsd4_op_name(op->opnum));
29372920
29382921 nfsd4_cstate_clear_replay(cstate);
fs/nfsd/nfs4state.c+84−35
@@ -633,18 +633,6 @@ find_readable_file(struct nfs4_file *f) · 632 unmodified lines
633633 return ret;
634634 }
635635
636−static struct nfsd_file *
637−find_rw_file(struct nfs4_file *f)
638−{
639− struct nfsd_file *ret;
640−
641− spin_lock(&f->fi_lock);
642− ret = nfsd_file_get(f->fi_fds[O_RDWR]);
643− spin_unlock(&f->fi_lock);
644−
645− return ret;
646−}
647−
648636 struct nfsd_file *
649637 find_any_file(struct nfs4_file *f)
650638 {
@@ -1218,15 +1206,20 @@ nfs4_inc_and_copy_stateid(stateid_t *dst, struct nfs4_stid *stid) · 567 unmodified lines
12181206
12191207 static void put_deleg_file(struct nfs4_file *fp)
12201208 {
1209+ struct nfsd_file *rnf = NULL;
12211210 struct nfsd_file *nf = NULL;
12221211
12231212 spin_lock(&fp->fi_lock);
1224− if (--fp->fi_delegees == 0)
1213+ if (--fp->fi_delegees == 0) {
12251214 swap(nf, fp->fi_deleg_file);
1215+ swap(rnf, fp->fi_rdeleg_file);
1216+ }
12261217 spin_unlock(&fp->fi_lock);
12271218
12281219 if (nf)
12291220 nfsd_file_put(nf);
1221+ if (rnf)
1222+ nfs4_file_put_access(fp, NFS4_SHARE_ACCESS_READ);
12301223 }
12311224
12321225 static void nfs4_unlock_deleg_lease(struct nfs4_delegation *dp)
@@ -3872,7 +3865,6 @@ static __be32 check_forechannel_attrs(struct nfsd4_channel_attrs *ca, struct nfs · 2639 unmodified lines
38723865 ca->headerpadsz = 0;
38733866 ca->maxreq_sz = min_t(u32, ca->maxreq_sz, maxrpc);
38743867 ca->maxresp_sz = min_t(u32, ca->maxresp_sz, maxrpc);
3875− ca->maxops = min_t(u32, ca->maxops, NFSD_MAX_OPS_PER_COMPOUND);
38763868 ca->maxresp_cached = min_t(u32, ca->maxresp_cached,
38773869 NFSD_SLOT_CACHE_SIZE + NFSD_MIN_HDR_SEQ_SZ);
38783870 ca->maxreqs = min_t(u32, ca->maxreqs, NFSD_MAX_SLOTS_PER_SESSION);
@@ -4697,10 +4689,16 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, · 818 unmodified lines
46974689 }
46984690 status = nfs_ok;
46994691 if (conf) {
4700− old = unconf;
4701− unhash_client_locked(old);
4702− nfsd4_change_callback(conf, &unconf->cl_cb_conn);
4703− } else {
4692+ if (get_client_locked(conf) == nfs_ok) {
4693+ old = unconf;
4694+ unhash_client_locked(old);
4695+ nfsd4_change_callback(conf, &unconf->cl_cb_conn);
4696+ } else {
4697+ conf = NULL;
4698+ }
4699+ }
4700+
4701+ if (!conf) {
47044702 old = find_confirmed_client_by_name(&unconf->cl_name, nn);
47054703 if (old) {
47064704 status = nfserr_clid_inuse;
@@ -4717,10 +4715,14 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, · 10 unmodified lines
47174715 }
47184716 trace_nfsd_clid_replaced(&old->cl_clientid);
47194717 }
4718+ status = get_client_locked(unconf);
4719+ if (status != nfs_ok) {
4720+ old = NULL;
4721+ goto out;
4722+ }
47204723 move_to_confirmed(unconf);
47214724 conf = unconf;
47224725 }
4723− get_client_locked(conf);
47244726 spin_unlock(&nn->client_lock);
47254727 if (conf == unconf)
47264728 fsnotify_dentry(conf->cl_nfsd_info_dentry, FS_MODIFY);
@@ -4750,6 +4752,7 @@ static void nfsd4_file_init(const struct svc_fh *fh, struct nfs4_file *fp) · 23 unmodified lines
47504752 INIT_LIST_HEAD(&fp->fi_clnt_odstate);
47514753 fh_copy_shallow(&fp->fi_fhandle, &fh->fh_handle);
47524754 fp->fi_deleg_file = NULL;
4755+ fp->fi_rdeleg_file = NULL;
47534756 fp->fi_had_conflict = false;
47544757 fp->fi_share_deny = 0;
47554758 memset(fp->fi_fds, 0, sizeof(fp->fi_fds));
@@ -6000,14 +6003,19 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, · 1244 unmodified lines
60006003 * "An OPEN_DELEGATE_WRITE delegation allows the client to handle,
60016004 * on its own, all opens."
60026005 *
6003− * Furthermore the client can use a write delegation for most READ
6004− * operations as well, so we require a O_RDWR file here.
6006+ * Furthermore, section 9.1.2 says:
6007+ *
6008+ * "In the case of READ, the server may perform the corresponding
6009+ * check on the access mode, or it may choose to allow READ for
6010+ * OPEN4_SHARE_ACCESS_WRITE, to accommodate clients whose WRITE
6011+ * implementation may unavoidably do reads (e.g., due to buffer
6012+ * cache constraints)."
60056013 *
6006− * Offer a write delegation in the case of a BOTH open, and ensure
6007− * we get the O_RDWR descriptor.
6014+ * We choose to offer a write delegation for OPEN with the
6015+ * OPEN4_SHARE_ACCESS_WRITE access mode to accommodate such clients.
60086016 */
6009− if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) == NFS4_SHARE_ACCESS_BOTH) {
6010− nf = find_rw_file(fp);
6017+ if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) {
6018+ nf = find_writeable_file(fp);
60116019 dl_type = deleg_ts ? OPEN_DELEGATE_WRITE_ATTRS_DELEG : OPEN_DELEGATE_WRITE;
60126020 }
60136021
@@ -6138,7 +6146,7 @@ static bool · 124 unmodified lines
61386146 nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh,
61396147 struct kstat *stat)
61406148 {
6141− struct nfsd_file *nf = find_rw_file(dp->dl_stid.sc_file);
6149+ struct nfsd_file *nf = find_writeable_file(dp->dl_stid.sc_file);
61426150 struct path path;
61436151 int rc;
61446152
@@ -6156,6 +6164,34 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh, · 11 unmodified lines
61566164 return rc == 0;
61576165 }
61586166
6167+/*
6168+ * Add NFS4_SHARE_ACCESS_READ to the write delegation granted on OPEN
6169+ * with NFS4_SHARE_ACCESS_WRITE by allocating separate nfsd_file and
6170+ * struct file to be used for read with delegation stateid.
6171+ *
6172+ */
6173+static bool
6174+nfsd4_add_rdaccess_to_wrdeleg(struct svc_rqst *rqstp, struct nfsd4_open *open,
6175+ struct svc_fh *fh, struct nfs4_ol_stateid *stp)
6176+{
6177+ struct nfs4_file *fp;
6178+ struct nfsd_file *nf = NULL;
6179+
6180+ if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) ==
6181+ NFS4_SHARE_ACCESS_WRITE) {
6182+ if (nfsd_file_acquire_opened(rqstp, fh, NFSD_MAY_READ, NULL, &nf))
6183+ return (false);
6184+ fp = stp->st_stid.sc_file;
6185+ spin_lock(&fp->fi_lock);
6186+ __nfs4_file_get_access(fp, NFS4_SHARE_ACCESS_READ);
6187+ fp = stp->st_stid.sc_file;
6188+ fp->fi_fds[O_RDONLY] = nf;
6189+ fp->fi_rdeleg_file = nf;
6190+ spin_unlock(&fp->fi_lock);
6191+ }
6192+ return true;
6193+}
6194+
61596195 /*
61606196 * The Linux NFS server does not offer write delegations to NFSv4.0
61616197 * clients in order to avoid conflicts between write delegations and
@@ -6181,8 +6217,9 @@ nfs4_delegation_stat(struct nfs4_delegation *dp, struct svc_fh *currentfh, · 19 unmodified lines
61816217 * open or lock state.
61826218 */
61836219 static void
6184−nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,
6185− struct svc_fh *currentfh)
6220+nfs4_open_delegation(struct svc_rqst *rqstp, struct nfsd4_open *open,
6221+ struct nfs4_ol_stateid *stp, struct svc_fh *currentfh,
6222+ struct svc_fh *fh)
61866223 {
61876224 struct nfs4_openowner *oo = openowner(stp->st_stateowner);
61886225 bool deleg_ts = nfsd4_want_deleg_timestamps(open);
@@ -6227,7 +6264,8 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, · 38 unmodified lines
62276264 memcpy(&open->op_delegate_stateid, &dp->dl_stid.sc_stateid, sizeof(dp->dl_stid.sc_stateid));
62286265
62296266 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) {
6230− if (!nfs4_delegation_stat(dp, currentfh, &stat)) {
6267+ if (!nfsd4_add_rdaccess_to_wrdeleg(rqstp, open, fh, stp) ||
6268+ !nfs4_delegation_stat(dp, currentfh, &stat)) {
62316269 nfs4_put_stid(&dp->dl_stid);
62326270 destroy_delegation(dp);
62336271 goto out_no_deleg;
@@ -6322,6 +6360,20 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf · 88 unmodified lines
63226360 status = nfs4_check_deleg(cl, open, &dp);
63236361 if (status)
63246362 goto out;
6363+ if (dp && nfsd4_is_deleg_cur(open) &&
6364+ (dp->dl_stid.sc_file != fp)) {
6365+ /*
6366+ * RFC8881 section 8.2.4 mandates the server to return
6367+ * NFS4ERR_BAD_STATEID if the selected table entry does
6368+ * not match the current filehandle. However returning
6369+ * NFS4ERR_BAD_STATEID in the OPEN can cause the client
6370+ * to repeatedly retry the operation with the same
6371+ * stateid, since the stateid itself is valid. To avoid
6372+ * this situation NFSD returns NFS4ERR_INVAL instead.
6373+ */
6374+ status = nfserr_inval;
6375+ goto out;
6376+ }
63256377 stp = nfsd4_find_and_lock_existing_open(fp, open);
63266378 } else {
63276379 open->op_file = NULL;
@@ -6383,7 +6435,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf · 55 unmodified lines
63836435 * Attempt to hand out a delegation. No error return, because the
63846436 * OPEN succeeds even if we fail.
63856437 */
6386− nfs4_open_delegation(open, stp, &resp->cstate.current_fh);
6438+ nfs4_open_delegation(rqstp, open, stp,
6439+ &resp->cstate.current_fh, current_fh);
63876440
63886441 /*
63896442 * If there is an existing open stateid, it must be updated and
@@ -7076,7 +7129,7 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate, · 686 unmodified lines
70767129 return_revoked = true;
70777130 if (typemask & SC_TYPE_DELEG)
70787131 /* Always allow REVOKED for DELEG so we can
7079− * retturn the appropriate error.
7132+ * return the appropriate error.
70807133 */
70817134 statusmask |= SC_STATUS_REVOKED;
70827135
@@ -7119,10 +7172,6 @@ nfs4_find_file(struct nfs4_stid *s, int flags) · 36 unmodified lines
71197172
71207173 switch (s->sc_type) {
71217174 case SC_TYPE_DELEG:
7122− spin_lock(&s->sc_file->fi_lock);
7123− ret = nfsd_file_get(s->sc_file->fi_deleg_file);
7124− spin_unlock(&s->sc_file->fi_lock);
7125− break;
71267175 case SC_TYPE_OPEN:
71277176 case SC_TYPE_LOCK:
71287177 if (flags & RD_STATE)
fs/nfsd/nfs4xdr.c+1−3
@@ -2500,10 +2500,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) · 2499 unmodified lines
25002500
25012501 if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0)
25022502 return false;
2503− if (xdr_stream_decode_u32(argp->xdr, &argp->client_opcnt) < 0)
2503+ if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0)
25042504 return false;
2505− argp->opcnt = min_t(u32, argp->client_opcnt,
2506− NFSD_MAX_OPS_PER_COMPOUND);
25072505
25082506 if (argp->opcnt > ARRAY_SIZE(argp->iops)) {
25092507 argp->ops = vcalloc(argp->opcnt, sizeof(*argp->ops));
fs/nfsd/nfsctl.c+16−15
@@ -1436,7 +1436,7 @@ unsigned int nfsd_net_id; · 1435 unmodified lines
14361436
14371437 static int nfsd_genl_rpc_status_compose_msg(struct sk_buff *skb,
14381438 struct netlink_callback *cb,
1439− struct nfsd_genl_rqstp *rqstp)
1439+ struct nfsd_genl_rqstp *genl_rqstp)
14401440 {
14411441 void *hdr;
14421442 u32 i;
@@ -1446,22 +1446,22 @@ static int nfsd_genl_rpc_status_compose_msg(struct sk_buff *skb, · 3 unmodified lines
14461446 if (!hdr)
14471447 return -ENOBUFS;
14481448
1449− if (nla_put_be32(skb, NFSD_A_RPC_STATUS_XID, rqstp->rq_xid) ||
1450− nla_put_u32(skb, NFSD_A_RPC_STATUS_FLAGS, rqstp->rq_flags) ||
1451− nla_put_u32(skb, NFSD_A_RPC_STATUS_PROG, rqstp->rq_prog) ||
1452− nla_put_u32(skb, NFSD_A_RPC_STATUS_PROC, rqstp->rq_proc) ||
1453− nla_put_u8(skb, NFSD_A_RPC_STATUS_VERSION, rqstp->rq_vers) ||
1449+ if (nla_put_be32(skb, NFSD_A_RPC_STATUS_XID, genl_rqstp->rq_xid) ||
1450+ nla_put_u32(skb, NFSD_A_RPC_STATUS_FLAGS, genl_rqstp->rq_flags) ||
1451+ nla_put_u32(skb, NFSD_A_RPC_STATUS_PROG, genl_rqstp->rq_prog) ||
1452+ nla_put_u32(skb, NFSD_A_RPC_STATUS_PROC, genl_rqstp->rq_proc) ||
1453+ nla_put_u8(skb, NFSD_A_RPC_STATUS_VERSION, genl_rqstp->rq_vers) ||
14541454 nla_put_s64(skb, NFSD_A_RPC_STATUS_SERVICE_TIME,
1455− ktime_to_us(rqstp->rq_stime),
1455+ ktime_to_us(genl_rqstp->rq_stime),
14561456 NFSD_A_RPC_STATUS_PAD))
14571457 return -ENOBUFS;
14581458
1459− switch (rqstp->rq_saddr.sa_family) {
1459+ switch (genl_rqstp->rq_saddr.sa_family) {
14601460 case AF_INET: {
14611461 const struct sockaddr_in *s_in, *d_in;
14621462
1463− s_in = (const struct sockaddr_in *)&rqstp->rq_saddr;
1464− d_in = (const struct sockaddr_in *)&rqstp->rq_daddr;
1463+ s_in = (const struct sockaddr_in *)&genl_rqstp->rq_saddr;
1464+ d_in = (const struct sockaddr_in *)&genl_rqstp->rq_daddr;
14651465 if (nla_put_in_addr(skb, NFSD_A_RPC_STATUS_SADDR4,
14661466 s_in->sin_addr.s_addr) ||
14671467 nla_put_in_addr(skb, NFSD_A_RPC_STATUS_DADDR4,
@@ -1476,8 +1476,8 @@ static int nfsd_genl_rpc_status_compose_msg(struct sk_buff *skb, · 8 unmodified lines
14761476 case AF_INET6: {
14771477 const struct sockaddr_in6 *s_in, *d_in;
14781478
1479− s_in = (const struct sockaddr_in6 *)&rqstp->rq_saddr;
1480− d_in = (const struct sockaddr_in6 *)&rqstp->rq_daddr;
1479+ s_in = (const struct sockaddr_in6 *)&genl_rqstp->rq_saddr;
1480+ d_in = (const struct sockaddr_in6 *)&genl_rqstp->rq_daddr;
14811481 if (nla_put_in6_addr(skb, NFSD_A_RPC_STATUS_SADDR6,
14821482 &s_in->sin6_addr) ||
14831483 nla_put_in6_addr(skb, NFSD_A_RPC_STATUS_DADDR6,
@@ -1491,9 +1491,9 @@ static int nfsd_genl_rpc_status_compose_msg(struct sk_buff *skb, · 7 unmodified lines
14911491 }
14921492 }
14931493
1494− for (i = 0; i < rqstp->rq_opcnt; i++)
1494+ for (i = 0; i < genl_rqstp->rq_opcnt; i++)
14951495 if (nla_put_u32(skb, NFSD_A_RPC_STATUS_COMPOUND_OPS,
1496− rqstp->rq_opnum[i]))
1496+ genl_rqstp->rq_opnum[i]))
14971497 return -ENOBUFS;
14981498
14991499 genlmsg_end(skb, hdr);
@@ -1569,7 +1569,8 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb, · 69 unmodified lines
15691569 int j;
15701570
15711571 args = rqstp->rq_argp;
1572− genl_rqstp.rq_opcnt = args->opcnt;
1572+ genl_rqstp.rq_opcnt = min_t(u32, args->opcnt,
1573+ ARRAY_SIZE(genl_rqstp.rq_opnum));
15731574 for (j = 0; j < genl_rqstp.rq_opcnt; j++)
15741575 genl_rqstp.rq_opnum[j] =
15751576 args->ops[j].opnum;
fs/nfsd/nfsd.h+2−4
@@ -57,9 +57,6 @@ struct readdir_cd { · 56 unmodified lines
5757 __be32 err; /* 0, nfserr, or nfserr_eof */
5858 };
5959
60−/* Maximum number of operations per session compound */
61−#define NFSD_MAX_OPS_PER_COMPOUND 50
62−
6360 struct nfsd_genl_rqstp {
6461 struct sockaddr rq_daddr;
6562 struct sockaddr rq_saddr;
@@ -72,7 +69,7 @@ struct nfsd_genl_rqstp { · 6 unmodified lines
7269
7370 /* NFSv4 compound */
7471 u32 rq_opcnt;
75− u32 rq_opnum[NFSD_MAX_OPS_PER_COMPOUND];
72+ u32 rq_opnum[16];
7673 };
7774
7875 extern struct svc_program nfsd_programs[];
@@ -283,6 +280,7 @@ void nfsd_lockd_shutdown(void); · 204 unmodified lines
283280 #define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
284281 #define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
285282 #define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
283+#define nfserr_delay cpu_to_be32(NFS4ERR_DELAY)
286284 #define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
287285 #define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
288286 #define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
fs/nfsd/nfsfh.c+9−7
@@ -172,6 +172,8 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct net *net, · 171 unmodified lines
172172 if (len == 0)
173173 return error;
174174 if (fh->fh_fsid_type == FSID_MAJOR_MINOR) {
175+ u32 *fsid = fh_fsid(fh);
176+
175177 /* deprecated, convert to type 3 */
176178 len = key_len(FSID_ENCODE_DEV)/4;
177179 fh->fh_fsid_type = FSID_ENCODE_DEV;
@@ -181,17 +183,17 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct net *net, · 3 unmodified lines
181183 * confuses sparse, so we must use __force here to
182184 * keep it from complaining.
183185 */
184− fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl((__force __be32)fh->fh_fsid[0]),
185− ntohl((__force __be32)fh->fh_fsid[1])));
186− fh->fh_fsid[1] = fh->fh_fsid[2];
186+ fsid[0] = new_encode_dev(MKDEV(ntohl((__force __be32)fsid[0]),
187+ ntohl((__force __be32)fsid[1])));
188+ fsid[1] = fsid[2];
187189 }
188190 data_left -= len;
189191 if (data_left < 0)
190192 return error;
191193 exp = rqst_exp_find(rqstp ? &rqstp->rq_chandle : NULL,
192194 net, client, gssclient,
193− fh->fh_fsid_type, fh->fh_fsid);
194− fid = (struct fid *)(fh->fh_fsid + len);
195+ fh->fh_fsid_type, fh_fsid(fh));
196+ fid = (struct fid *)(fh_fsid(fh) + len);
195197
196198 error = nfserr_stale;
197199 if (IS_ERR(exp)) {
@@ -463,7 +465,7 @@ static void _fh_update(struct svc_fh *fhp, struct svc_export *exp, · 265 unmodified lines
463465 {
464466 if (dentry != exp->ex_path.dentry) {
465467 struct fid *fid = (struct fid *)
466− (fhp->fh_handle.fh_fsid + fhp->fh_handle.fh_size/4 - 1);
468+ (fh_fsid(&fhp->fh_handle) + fhp->fh_handle.fh_size/4 - 1);
467469 int maxsize = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
468470 int fh_flags = (exp->ex_flags & NFSEXP_NOSUBTREECHECK) ? 0 :
469471 EXPORT_FH_CONNECTABLE;
@@ -614,7 +616,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, · 144 unmodified lines
614616 fhp->fh_handle.fh_auth_type = 0;
615617
616618 mk_fsid(fhp->fh_handle.fh_fsid_type,
617− fhp->fh_handle.fh_fsid,
619+ fh_fsid(&fhp->fh_handle),
618620 ex_dev,
619621 d_inode(exp->ex_path.dentry)->i_ino,
620622 exp->ex_fsid, exp->ex_uuid);
fs/nfsd/nfsfh.h+15−11
@@ -49,18 +49,19 @@ struct knfsd_fh { · 48 unmodified lines
4949 * Points to the current size while
5050 * building a new file handle.
5151 */
52− union {
53− char fh_raw[NFS4_FHSIZE];
54− struct {
55− u8 fh_version; /* == 1 */
56− u8 fh_auth_type; /* deprecated */
57− u8 fh_fsid_type;
58− u8 fh_fileid_type;
59− u32 fh_fsid[]; /* flexible-array member */
60− };
61− };
52+ u8 fh_raw[NFS4_FHSIZE];
6253 };
6354
55+#define fh_version fh_raw[0]
56+#define fh_auth_type fh_raw[1]
57+#define fh_fsid_type fh_raw[2]
58+#define fh_fileid_type fh_raw[3]
59+
60+static inline u32 *fh_fsid(const struct knfsd_fh *fh)
61+{
62+ return (u32 *)&fh->fh_raw[4];
63+}
64+
6465 static inline __u32 ino_t_to_u32(ino_t ino)
6566 {
6667 return (__u32) ino;
@@ -260,9 +261,12 @@ static inline bool fh_match(const struct knfsd_fh *fh1, · 193 unmodified lines
260261 static inline bool fh_fsid_match(const struct knfsd_fh *fh1,
261262 const struct knfsd_fh *fh2)
262263 {
264+ u32 *fsid1 = fh_fsid(fh1);
265+ u32 *fsid2 = fh_fsid(fh2);
266+
263267 if (fh1->fh_fsid_type != fh2->fh_fsid_type)
264268 return false;
265− if (memcmp(fh1->fh_fsid, fh2->fh_fsid, key_len(fh1->fh_fsid_type)) != 0)
269+ if (memcmp(fsid1, fsid2, key_len(fh1->fh_fsid_type)) != 0)
266270 return false;
267271 return true;
268272 }
fs/nfsd/nfsproc.c+1−1
@@ -575,7 +575,7 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp, · 574 unmodified lines
575575 buf->pages = rqstp->rq_next_page;
576576 rqstp->rq_next_page++;
577577
578− xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
578+ xdr_init_encode_pages(xdr, buf);
579579 }
580580
581581 /*
fs/nfsd/state.h+1−0
@@ -665,6 +665,7 @@ struct nfs4_file { · 664 unmodified lines
665665 atomic_t fi_access[2];
666666 u32 fi_share_deny;
667667 struct nfsd_file *fi_deleg_file;
668+ struct nfsd_file *fi_rdeleg_file;
668669 int fi_delegees;
669670 struct knfsd_fh fi_fhandle;
670671 bool fi_had_conflict;
fs/nfsd/trace.h+2−25
@@ -344,7 +344,7 @@ TRACE_EVENT(nfsd_exp_find_key, · 343 unmodified lines
344344 int status),
345345 TP_ARGS(key, status),
346346 TP_STRUCT__entry(
347− __field(int, fsidtype)
347+ __field(u8, fsidtype)
348348 __array(u32, fsid, 6)
349349 __string(auth_domain, key->ek_client->name)
350350 __field(int, status)
@@ -367,7 +367,7 @@ TRACE_EVENT(nfsd_expkey_update, · 16 unmodified lines
367367 TP_PROTO(const struct svc_expkey *key, const char *exp_path),
368368 TP_ARGS(key, exp_path),
369369 TP_STRUCT__entry(
370− __field(int, fsidtype)
370+ __field(u8, fsidtype)
371371 __array(u32, fsid, 6)
372372 __string(auth_domain, key->ek_client->name)
373373 __string(path, exp_path)
@@ -1108,7 +1108,6 @@ DEFINE_NFSD_FILE_EVENT(nfsd_file_free); · 734 unmodified lines
11081108 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
11091109 DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
11101110 DEFINE_NFSD_FILE_EVENT(nfsd_file_closing);
1111−DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_queue);
11121111
11131112 TRACE_EVENT(nfsd_file_alloc,
11141113 TP_PROTO(
@@ -1344,9 +1343,7 @@ DEFINE_EVENT(nfsd_file_gc_class, name, \ · 229 unmodified lines
13441343 TP_ARGS(nf))
13451344
13461345 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add);
1347−DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_add_disposed);
13481346 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del);
1349−DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_lru_del_disposed);
13501347 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_in_use);
13511348 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_writeback);
13521349 DEFINE_NFSD_FILE_GC_EVENT(nfsd_file_gc_referenced);
@@ -1380,7 +1377,6 @@ DEFINE_EVENT(nfsd_file_lruwalk_class, name, \ · 27 unmodified lines
13801377 TP_ARGS(removed, remaining))
13811378
13821379 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_removed);
1383−DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_gc_recent);
13841380 DEFINE_NFSD_FILE_LRUWALK_EVENT(nfsd_file_shrinker_removed);
13851381
13861382 TRACE_EVENT(nfsd_file_close,
@@ -2103,25 +2099,6 @@ TRACE_EVENT(nfsd_ctl_maxblksize, · 716 unmodified lines
21032099 )
21042100 );
21052101
2106−TRACE_EVENT(nfsd_ctl_maxconn,
2107− TP_PROTO(
2108− const struct net *net,
2109− int maxconn
2110− ),
2111− TP_ARGS(net, maxconn),
2112− TP_STRUCT__entry(
2113− __field(unsigned int, netns_ino)
2114− __field(int, maxconn)
2115− ),
2116− TP_fast_assign(
2117− __entry->netns_ino = net->ns.inum;
2118− __entry->maxconn = maxconn;
2119− ),
2120− TP_printk("maxconn=%d",
2121− __entry->maxconn
2122− )
2123−);
2124−
21252102 TRACE_EVENT(nfsd_ctl_time,
21262103 TP_PROTO(
21272104 const struct net *net,
fs/nfsd/vfs.c+10−7
@@ -1086,10 +1086,13 @@ __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp, · 1085 unmodified lines
10861086 {
10871087 unsigned long v, total;
10881088 struct iov_iter iter;
1089− loff_t ppos = offset;
1089+ struct kiocb kiocb;
10901090 ssize_t host_err;
10911091 size_t len;
10921092
1093+ init_sync_kiocb(&kiocb, file);
1094+ kiocb.ki_pos = offset;
1095+
10931096 v = 0;
10941097 total = *count;
10951098 while (total) {
@@ -1104,7 +1107,7 @@ __be32 nfsd_iter_read(struct svc_rqst *rqstp, struct svc_fh *fhp, · 8 unmodified lines
11041107
11051108 trace_nfsd_read_vector(rqstp, fhp, offset, *count);
11061109 iov_iter_bvec(&iter, ITER_DEST, rqstp->rq_bvec, v, *count);
1107− host_err = vfs_iter_read(file, &iter, &ppos, 0);
1110+ host_err = vfs_iocb_iter_read(file, &kiocb, &iter);
11081111 return nfsd_finish_read(rqstp, fhp, file, offset, count, eof, host_err);
11091112 }
11101113
@@ -1170,15 +1173,14 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, · 59 unmodified lines
11701173 struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
11711174 struct file *file = nf->nf_file;
11721175 struct super_block *sb = file_inode(file)->i_sb;
1176+ struct kiocb kiocb;
11731177 struct svc_export *exp;
11741178 struct iov_iter iter;
11751179 errseq_t since;
11761180 __be32 nfserr;
11771181 int host_err;
1178− loff_t pos = offset;
11791182 unsigned long exp_op_flags = 0;
11801183 unsigned int pflags = current->flags;
1181− rwf_t flags = 0;
11821184 bool restore_flags = false;
11831185 unsigned int nvecs;
11841186
@@ -1204,16 +1206,17 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, · 19 unmodified lines
12041206
12051207 if (!EX_ISSYNC(exp))
12061208 stable = NFS_UNSTABLE;
1207−
1209+ init_sync_kiocb(&kiocb, file);
1210+ kiocb.ki_pos = offset;
12081211 if (stable && !fhp->fh_use_wgather)
1209− flags |= RWF_SYNC;
1212+ kiocb.ki_flags |= IOCB_DSYNC;
12101213
12111214 nvecs = xdr_buf_to_bvec(rqstp->rq_bvec, rqstp->rq_maxpages, payload);
12121215 iov_iter_bvec(&iter, ITER_SOURCE, rqstp->rq_bvec, nvecs, *cnt);
12131216 since = READ_ONCE(file->f_wb_err);
12141217 if (verf)
12151218 nfsd_copy_write_verifier(verf, nn);
1216− host_err = vfs_iter_write(file, &iter, &pos, flags);
1219+ host_err = vfs_iocb_iter_write(file, &kiocb, &iter);
12171220 if (host_err < 0) {
12181221 commit_reset_write_verifier(nn, rqstp, host_err);
12191222 goto out_nfserr;
fs/nfsd/xdr4.h+0−1
@@ -870,7 +870,6 @@ struct nfsd4_compoundargs { · 869 unmodified lines
870870 char * tag;
871871 u32 taglen;
872872 u32 minorversion;
873− u32 client_opcnt;
874873 u32 opcnt;
875874 bool splice_ok;
876875 struct nfsd4_op *ops;
include/linux/sunrpc/msg_prot.h+10−8
@@ -69,15 +69,17 @@ enum rpc_reject_stat { · 68 unmodified lines
6969 };
7070
7171 enum rpc_auth_stat {
72− RPC_AUTH_OK = 0,
73− RPC_AUTH_BADCRED = 1,
74− RPC_AUTH_REJECTEDCRED = 2,
75− RPC_AUTH_BADVERF = 3,
76− RPC_AUTH_REJECTEDVERF = 4,
77− RPC_AUTH_TOOWEAK = 5,
72+ RPC_AUTH_OK = 0, /* success */
73+ RPC_AUTH_BADCRED = 1, /* bad credential (seal broken) */
74+ RPC_AUTH_REJECTEDCRED = 2, /* client must begin new session */
75+ RPC_AUTH_BADVERF = 3, /* bad verifier (seal broken) */
76+ RPC_AUTH_REJECTEDVERF = 4, /* verifier expired or replayed */
77+ RPC_AUTH_TOOWEAK = 5, /* rejected for security reasons */
78+ RPC_AUTH_INVALIDRESP = 6, /* bogus response verifier */
79+ RPC_AUTH_FAILED = 7, /* reason unknown */
7880 /* RPCSEC_GSS errors */
79− RPCSEC_GSS_CREDPROBLEM = 13,
80− RPCSEC_GSS_CTXPROBLEM = 14
81+ RPCSEC_GSS_CREDPROBLEM = 13, /* no credentials for user */
82+ RPCSEC_GSS_CTXPROBLEM = 14 /* problem with context */
8183 };
8284
8385 #define RPC_MAXNETNAMELEN 256
include/linux/sunrpc/svc.h+3−3
@@ -245,10 +245,10 @@ struct svc_rqst { · 244 unmodified lines
245245 * initialisation success.
246246 */
247247
248− unsigned long bc_to_initval;
249− unsigned int bc_to_retries;
250− void ** rq_lease_breaker; /* The v4 client breaking a lease */
248+ unsigned long bc_to_initval;
249+ unsigned int bc_to_retries;
251250 unsigned int rq_status_counter; /* RPC processing counter */
251+ void **rq_lease_breaker; /* The v4 client breaking a lease */
252252 };
253253
254254 /* bits for rq_flags */
include/linux/sunrpc/svcauth.h+0−1
@@ -86,7 +86,6 @@ struct auth_domain { · 85 unmodified lines
8686
8787 enum svc_auth_status {
8888 SVC_GARBAGE = 1,
89− SVC_SYSERR,
9089 SVC_VALID,
9190 SVC_NEGATIVE,
9291 SVC_OK,
include/linux/sunrpc/xdr.h+3−2
@@ -119,6 +119,8 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) · 118 unmodified lines
119119 #define rpc_autherr_badverf cpu_to_be32(RPC_AUTH_BADVERF)
120120 #define rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF)
121121 #define rpc_autherr_tooweak cpu_to_be32(RPC_AUTH_TOOWEAK)
122+#define rpc_autherr_invalidresp cpu_to_be32(RPC_AUTH_INVALIDRESP)
123+#define rpc_autherr_failed cpu_to_be32(RPC_AUTH_FAILED)
122124 #define rpcsec_gsserr_credproblem cpu_to_be32(RPCSEC_GSS_CREDPROBLEM)
123125 #define rpcsec_gsserr_ctxproblem cpu_to_be32(RPCSEC_GSS_CTXPROBLEM)
124126
@@ -242,8 +244,7 @@ typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr, · 117 unmodified lines
242244
243245 extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf,
244246 __be32 *p, struct rpc_rqst *rqst);
245−extern void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
246− struct page **pages, struct rpc_rqst *rqst);
247+void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf);
247248 extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
248249 extern int xdr_reserve_space_vec(struct xdr_stream *xdr, size_t nbytes);
249250 extern void __xdr_commit_encode(struct xdr_stream *xdr);
include/trace/events/sunrpc.h+18−7
@@ -1691,7 +1691,6 @@ SVC_RQST_FLAG_LIST · 1690 unmodified lines
16911691 __print_flags(flags, "|", SVC_RQST_FLAG_LIST)
16921692
16931693 TRACE_DEFINE_ENUM(SVC_GARBAGE);
1694−TRACE_DEFINE_ENUM(SVC_SYSERR);
16951694 TRACE_DEFINE_ENUM(SVC_VALID);
16961695 TRACE_DEFINE_ENUM(SVC_NEGATIVE);
16971696 TRACE_DEFINE_ENUM(SVC_OK);
@@ -1704,7 +1703,6 @@ TRACE_DEFINE_ENUM(SVC_COMPLETE); · 6 unmodified lines
17041703 #define show_svc_auth_status(status) \
17051704 __print_symbolic(status, \
17061705 { SVC_GARBAGE, "SVC_GARBAGE" }, \
1707− { SVC_SYSERR, "SVC_SYSERR" }, \
17081706 { SVC_VALID, "SVC_VALID" }, \
17091707 { SVC_NEGATIVE, "SVC_NEGATIVE" }, \
17101708 { SVC_OK, "SVC_OK" }, \
@@ -2123,22 +2121,35 @@ TRACE_EVENT(svc_xprt_accept, · 412 unmodified lines
21232121 )
21242122 );
21252123
2126−TRACE_EVENT(svc_wake_up,
2127− TP_PROTO(int pid),
2124+DECLARE_EVENT_CLASS(svc_pool_thread_event,
2125+ TP_PROTO(const struct svc_pool *pool, pid_t pid),
21282126
2129− TP_ARGS(pid),
2127+ TP_ARGS(pool, pid),
21302128
21312129 TP_STRUCT__entry(
2132− __field(int, pid)
2130+ __field(unsigned int, pool_id)
2131+ __field(pid_t, pid)
21332132 ),
21342133
21352134 TP_fast_assign(
2135+ __entry->pool_id = pool->sp_id;
21362136 __entry->pid = pid;
21372137 ),
21382138
2139− TP_printk("pid=%d", __entry->pid)
2139+ TP_printk("pool=%u pid=%d", __entry->pool_id, __entry->pid)
21402140 );
21412141
2142+#define DEFINE_SVC_POOL_THREAD_EVENT(name) \
2143+ DEFINE_EVENT(svc_pool_thread_event, svc_pool_thread_##name, \
2144+ TP_PROTO( \
2145+ const struct svc_pool *pool, pid_t pid \
2146+ ), \
2147+ TP_ARGS(pool, pid))
2148+
2149+DEFINE_SVC_POOL_THREAD_EVENT(wake);
2150+DEFINE_SVC_POOL_THREAD_EVENT(running);
2151+DEFINE_SVC_POOL_THREAD_EVENT(noidle);
2152+
21422153 TRACE_EVENT(svc_alloc_arg_err,
21432154 TP_PROTO(
21442155 unsigned int requested,
net/sunrpc/auth_gss/svcauth_gss.c+2−1
@@ -1628,7 +1628,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp) · 1627 unmodified lines
16281628 int ret;
16291629 struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id);
16301630
1631− rqstp->rq_auth_stat = rpc_autherr_badcred;
1631+ rqstp->rq_auth_stat = rpc_autherr_failed;
16321632 if (!svcdata)
16331633 svcdata = kmalloc(sizeof(*svcdata), GFP_KERNEL);
16341634 if (!svcdata)
@@ -1638,6 +1638,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp) · 3 unmodified lines
16381638 svcdata->rsci = NULL;
16391639 gc = &svcdata->clcred;
16401640
1641+ rqstp->rq_auth_stat = rpc_autherr_badcred;
16411642 if (!svcauth_gss_decode_credbody(&rqstp->rq_arg_stream, gc, &rpcstart))
16421643 goto auth_err;
16431644 if (gc->gc_v != RPC_GSS_VERSION)
net/sunrpc/socklib.c+59−105
@@ -27,97 +27,60 @@ · 26 unmodified lines
2727 struct xdr_skb_reader {
2828 struct sk_buff *skb;
2929 unsigned int offset;
30+ bool need_checksum;
3031 size_t count;
3132 __wsum csum;
3233 };
3334
34−typedef size_t (*xdr_skb_read_actor)(struct xdr_skb_reader *desc, void *to,
35− size_t len);
36−
3735 /**
3836 * xdr_skb_read_bits - copy some data bits from skb to internal buffer
3937 * @desc: sk_buff copy helper
4038 * @to: copy destination
4139 * @len: number of bytes to copy
4240 *
43− * Possibly called several times to iterate over an sk_buff and copy
44− * data out of it.
41+ * Possibly called several times to iterate over an sk_buff and copy data out of
42+ * it.
4543 */
4644 static size_t
4745 xdr_skb_read_bits(struct xdr_skb_reader *desc, void *to, size_t len)
4846 {
49− if (len > desc->count)
50− len = desc->count;
51− if (unlikely(skb_copy_bits(desc->skb, desc->offset, to, len)))
52− return 0;
53− desc->count -= len;
54− desc->offset += len;
55− return len;
56−}
47+ len = min(len, desc->count);
48+
49+ if (desc->need_checksum) {
50+ __wsum csum;
51+
52+ csum = skb_copy_and_csum_bits(desc->skb, desc->offset, to, len);
53+ desc->csum = csum_block_add(desc->csum, csum, desc->offset);
54+ } else {
55+ if (unlikely(skb_copy_bits(desc->skb, desc->offset, to, len)))
56+ return 0;
57+ }
5758
58−/**
59− * xdr_skb_read_and_csum_bits - copy and checksum from skb to buffer
60− * @desc: sk_buff copy helper
61− * @to: copy destination
62− * @len: number of bytes to copy
63− *
64− * Same as skb_read_bits, but calculate a checksum at the same time.
65− */
66−static size_t xdr_skb_read_and_csum_bits(struct xdr_skb_reader *desc, void *to, size_t len)
67−{
68− unsigned int pos;
69− __wsum csum2;
70−
71− if (len > desc->count)
72− len = desc->count;
73− pos = desc->offset;
74− csum2 = skb_copy_and_csum_bits(desc->skb, pos, to, len);
75− desc->csum = csum_block_add(desc->csum, csum2, pos);
7659 desc->count -= len;
7760 desc->offset += len;
7861 return len;
7962 }
8063
81−/**
82− * xdr_partial_copy_from_skb - copy data out of an skb
83− * @xdr: target XDR buffer
84− * @base: starting offset
85− * @desc: sk_buff copy helper
86− * @copy_actor: virtual method for copying data
87− *
88− */
8964 static ssize_t
90−xdr_partial_copy_from_skb(struct xdr_buf *xdr, unsigned int base, struct xdr_skb_reader *desc, xdr_skb_read_actor copy_actor)
65+xdr_partial_copy_from_skb(struct xdr_buf *xdr, struct xdr_skb_reader *desc)
9166 {
92− struct page **ppage = xdr->pages;
93− unsigned int len, pglen = xdr->page_len;
94− ssize_t copied = 0;
95− size_t ret;
96−
97− len = xdr->head[0].iov_len;
98− if (base < len) {
99− len -= base;
100− ret = copy_actor(desc, (char *)xdr->head[0].iov_base + base, len);
101− copied += ret;
102− if (ret != len || !desc->count)
103− goto out;
104− base = 0;
105− } else
106− base -= len;
107−
108− if (unlikely(pglen == 0))
109− goto copy_tail;
110− if (unlikely(base >= pglen)) {
111− base -= pglen;
112− goto copy_tail;
113− }
114− if (base || xdr->page_base) {
115− pglen -= base;
116− base += xdr->page_base;
117− ppage += base >> PAGE_SHIFT;
118− base &= ~PAGE_MASK;
119− }
120− do {
67+ struct page **ppage = xdr->pages + (xdr->page_base >> PAGE_SHIFT);
68+ unsigned int poff = xdr->page_base & ~PAGE_MASK;
69+ unsigned int pglen = xdr->page_len;
70+ ssize_t copied = 0;
71+ size_t ret;
72+
73+ if (xdr->head[0].iov_len == 0)
74+ return 0;
75+
76+ ret = xdr_skb_read_bits(desc, xdr->head[0].iov_base,
77+ xdr->head[0].iov_len);
78+ if (ret != xdr->head[0].iov_len || !desc->count)
79+ return ret;
80+ copied += ret;
81+
82+ while (pglen) {
83+ unsigned int len = min(PAGE_SIZE - poff, pglen);
12184 char *kaddr;
12285
12386 /* ACL likes to be lazy in allocating pages - ACLs
@@ -126,36 +89,29 @@ xdr_partial_copy_from_skb(struct xdr_buf *xdr, unsigned int base, struct xdr_skb · 2 unmodified lines
12689 *ppage = alloc_page(GFP_NOWAIT | __GFP_NOWARN);
12790 if (unlikely(*ppage == NULL)) {
12891 if (copied == 0)
129− copied = -ENOMEM;
130− goto out;
92+ return -ENOMEM;
93+ return copied;
13194 }
13295 }
13396
134− len = PAGE_SIZE;
13597 kaddr = kmap_atomic(*ppage);
136− if (base) {
137− len -= base;
138− if (pglen < len)
139− len = pglen;
140− ret = copy_actor(desc, kaddr + base, len);
141− base = 0;
142− } else {
143− if (pglen < len)
144− len = pglen;
145− ret = copy_actor(desc, kaddr, len);
146− }
98+ ret = xdr_skb_read_bits(desc, kaddr + poff, len);
14799 flush_dcache_page(*ppage);
148100 kunmap_atomic(kaddr);
101+
149102 copied += ret;
150103 if (ret != len || !desc->count)
151− goto out;
104+ return copied;
152105 ppage++;
153− } while ((pglen -= len) != 0);
154−copy_tail:
155− len = xdr->tail[0].iov_len;
156− if (base < len)
157− copied += copy_actor(desc, (char *)xdr->tail[0].iov_base + base, len - base);
158−out:
106+ pglen -= len;
107+ poff = 0;
108+ }
109+
110+ if (xdr->tail[0].iov_len) {
111+ copied += xdr_skb_read_bits(desc, xdr->tail[0].iov_base,
112+ xdr->tail[0].iov_len);
113+ }
114+
159115 return copied;
160116 }
161117
@@ -169,17 +125,22 @@ out: · 7 unmodified lines
169125 */
170126 int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb)
171127 {
172− struct xdr_skb_reader desc;
173−
174− desc.skb = skb;
175− desc.offset = 0;
176− desc.count = skb->len - desc.offset;
128+ struct xdr_skb_reader desc = {
129+ .skb = skb,
130+ .count = skb->len - desc.offset,
131+ };
177132
178− if (skb_csum_unnecessary(skb))
179− goto no_checksum;
133+ if (skb_csum_unnecessary(skb)) {
134+ if (xdr_partial_copy_from_skb(xdr, &desc) < 0)
135+ return -1;
136+ if (desc.count)
137+ return -1;
138+ return 0;
139+ }
180140
141+ desc.need_checksum = true;
181142 desc.csum = csum_partial(skb->data, desc.offset, skb->csum);
182− if (xdr_partial_copy_from_skb(xdr, 0, &desc, xdr_skb_read_and_csum_bits) < 0)
143+ if (xdr_partial_copy_from_skb(xdr, &desc) < 0)
183144 return -1;
184145 if (desc.offset != skb->len) {
185146 __wsum csum2;
@@ -194,14 +155,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb) · 8 unmodified lines
194155 !skb->csum_complete_sw)
195156 netdev_rx_csum_fault(skb->dev, skb);
196157 return 0;
197−no_checksum:
198− if (xdr_partial_copy_from_skb(xdr, 0, &desc, xdr_skb_read_bits) < 0)
199− return -1;
200− if (desc.count)
201− return -1;
202− return 0;
203158 }
204−EXPORT_SYMBOL_GPL(csum_partial_copy_to_xdr);
205159
206160 static inline int xprt_sendmsg(struct socket *sock, struct msghdr *msg,
207161 size_t seek)
net/sunrpc/svc.c+9−11
@@ -751,14 +751,16 @@ void svc_pool_wake_idle_thread(struct svc_pool *pool) · 750 unmodified lines
751751 WRITE_ONCE(rqstp->rq_qtime, ktime_get());
752752 if (!task_is_running(rqstp->rq_task)) {
753753 wake_up_process(rqstp->rq_task);
754− trace_svc_wake_up(rqstp->rq_task->pid);
754+ trace_svc_pool_thread_wake(pool, rqstp->rq_task->pid);
755755 percpu_counter_inc(&pool->sp_threads_woken);
756+ } else {
757+ trace_svc_pool_thread_running(pool, rqstp->rq_task->pid);
756758 }
757759 rcu_read_unlock();
758760 return;
759761 }
760762 rcu_read_unlock();
761−
763+ trace_svc_pool_thread_noidle(pool, 0);
762764 }
763765 EXPORT_SYMBOL_GPL(svc_pool_wake_idle_thread);
764766
@@ -1332,6 +1334,9 @@ svc_process_common(struct svc_rqst *rqstp) · 567 unmodified lines
13321334 int pr, rc;
13331335 __be32 *p;
13341336
1337+ /* Reset the accept_stat for the RPC */
1338+ rqstp->rq_accept_statp = NULL;
1339+
13351340 /* Will be turned off only when NFSv4 Sessions are used */
13361341 set_bit(RQ_USEDEFERRAL, &rqstp->rq_flags);
13371342 clear_bit(RQ_DROPME, &rqstp->rq_flags);
@@ -1373,8 +1378,6 @@ svc_process_common(struct svc_rqst *rqstp) · 35 unmodified lines
13731378 case SVC_GARBAGE:
13741379 rqstp->rq_auth_stat = rpc_autherr_badcred;
13751380 goto err_bad_auth;
1376− case SVC_SYSERR:
1377− goto err_system_err;
13781381 case SVC_DENIED:
13791382 goto err_bad_auth;
13801383 case SVC_CLOSE:
@@ -1385,7 +1388,8 @@ svc_process_common(struct svc_rqst *rqstp) · 4 unmodified lines
13851388 goto sendit;
13861389 default:
13871390 pr_warn_once("Unexpected svc_auth_status (%d)\n", auth_res);
1388− goto err_system_err;
1391+ rqstp->rq_auth_stat = rpc_autherr_failed;
1392+ goto err_bad_auth;
13891393 }
13901394
13911395 if (progp == NULL)
@@ -1512,12 +1516,6 @@ err_bad_proc: · 120 unmodified lines
15121516 serv->sv_stats->rpcbadfmt++;
15131517 *rqstp->rq_accept_statp = rpc_proc_unavail;
15141518 goto sendit;
1515−
1516−err_system_err:
1517− if (serv->sv_stats)
1518− serv->sv_stats->rpcbadfmt++;
1519− *rqstp->rq_accept_statp = rpc_system_err;
1520− goto sendit;
15211519 }
15221520
15231521 /*
net/sunrpc/svcsock.c+2−3
@@ -1197,7 +1197,7 @@ err_noclose: · 1196 unmodified lines
11971197 * that the pages backing @xdr are unchanging.
11981198 */
11991199 static int svc_tcp_sendmsg(struct svc_sock *svsk, struct svc_rqst *rqstp,
1200− rpc_fraghdr marker, unsigned int *sentp)
1200+ rpc_fraghdr marker, int *sentp)
12011201 {
12021202 struct msghdr msg = {
12031203 .msg_flags = MSG_SPLICE_PAGES,
@@ -1247,8 +1247,7 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp) · 43 unmodified lines
12471247 struct xdr_buf *xdr = &rqstp->rq_res;
12481248 rpc_fraghdr marker = cpu_to_be32(RPC_LAST_STREAM_FRAGMENT |
12491249 (u32)xdr->len);
1250− unsigned int sent;
1251− int err;
1250+ int sent, err;
12521251
12531252 svc_tcp_release_ctxt(xprt, rqstp->rq_xprt_ctxt);
12541253 rqstp->rq_xprt_ctxt = NULL;
net/sunrpc/xdr.c+4−7
@@ -993,21 +993,18 @@ EXPORT_SYMBOL_GPL(xdr_init_encode); · 992 unmodified lines
993993 * xdr_init_encode_pages - Initialize an xdr_stream for encoding into pages
994994 * @xdr: pointer to xdr_stream struct
995995 * @buf: pointer to XDR buffer into which to encode data
996− * @pages: list of pages to decode into
997− * @rqst: pointer to controlling rpc_rqst, for debugging
998996 *
999997 */
1000−void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
1001− struct page **pages, struct rpc_rqst *rqst)
998+void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf)
1002999 {
10031000 xdr_reset_scratch_buffer(xdr);
10041001
10051002 xdr->buf = buf;
1006− xdr->page_ptr = pages;
1003+ xdr->page_ptr = buf->pages;
10071004 xdr->iov = NULL;
1008− xdr->p = page_address(*pages);
1005+ xdr->p = page_address(*xdr->page_ptr);
10091006 xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
1010− xdr->rqst = rqst;
1007+ xdr->rqst = NULL;
10111008 }
10121009 EXPORT_SYMBOL_GPL(xdr_init_encode_pages);
10131010

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t