2 * Copyright (c) 2001 The Regents of the University of Michigan.
5 * Kendrick Smith <kmsmith@umich.edu>
6 * Andy Adamson <andros@umich.edu>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the University nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include <linux/sunrpc/clnt.h>
35 #include <linux/sunrpc/xprt.h>
36 #include <linux/sunrpc/svc_xprt.h>
37 #include <linux/slab.h>
45 #define NFSDDBG_FACILITY NFSDDBG_PROC
47 static void nfsd4_mark_cb_fault(struct nfs4_client *, int reason);
49 #define NFSPROC4_CB_NULL 0
50 #define NFSPROC4_CB_COMPOUND 1
52 /* Index of predefined Linux callback client operations */
54 struct nfs4_cb_compound_hdr {
56 u32 ident; /* minorversion 0 only */
64 static __be32 *xdr_encode_empty_array(__be32 *p)
71 * Encode/decode NFSv4 CB basic data types
73 * Basic NFSv4 callback data types are defined in section 15 of RFC
74 * 3530: "Network File System (NFS) version 4 Protocol" and section
75 * 20 of RFC 5661: "Network File System (NFS) Version 4 Minor Version
79 static void encode_uint32(struct xdr_stream *xdr, u32 n)
81 WARN_ON_ONCE(xdr_stream_encode_u32(xdr, n) < 0);
84 static void encode_bitmap4(struct xdr_stream *xdr, const __u32 *bitmap,
87 xdr_stream_encode_uint32_array(xdr, bitmap, len);
90 static int decode_cb_fattr4(struct xdr_stream *xdr, uint32_t *bitmap,
91 struct nfs4_cb_fattr *fattr)
93 fattr->ncf_cb_change = 0;
94 fattr->ncf_cb_fsize = 0;
95 if (bitmap[0] & FATTR4_WORD0_CHANGE)
96 if (xdr_stream_decode_u64(xdr, &fattr->ncf_cb_change) < 0)
97 return -NFSERR_BAD_XDR;
98 if (bitmap[0] & FATTR4_WORD0_SIZE)
99 if (xdr_stream_decode_u64(xdr, &fattr->ncf_cb_fsize) < 0)
100 return -NFSERR_BAD_XDR;
107 * enum nfs_cb_opnum4 {
115 OP_CB_LAYOUTRECALL = 5,
117 OP_CB_PUSH_DELEG = 7,
118 OP_CB_RECALL_ANY = 8,
119 OP_CB_RECALLABLE_OBJ_AVAIL = 9,
120 OP_CB_RECALL_SLOT = 10,
122 OP_CB_WANTS_CANCELLED = 12,
123 OP_CB_NOTIFY_LOCK = 13,
124 OP_CB_NOTIFY_DEVICEID = 14,
126 OP_CB_ILLEGAL = 10044
129 static void encode_nfs_cb_opnum4(struct xdr_stream *xdr, enum nfs_cb_opnum4 op)
133 p = xdr_reserve_space(xdr, 4);
134 *p = cpu_to_be32(op);
140 * typedef opaque nfs_fh4<NFS4_FHSIZE>;
142 static void encode_nfs_fh4(struct xdr_stream *xdr, const struct knfsd_fh *fh)
144 u32 length = fh->fh_size;
147 BUG_ON(length > NFS4_FHSIZE);
148 p = xdr_reserve_space(xdr, 4 + length);
149 xdr_encode_opaque(p, &fh->fh_raw, length);
160 static void encode_stateid4(struct xdr_stream *xdr, const stateid_t *sid)
164 p = xdr_reserve_space(xdr, NFS4_STATEID_SIZE);
165 *p++ = cpu_to_be32(sid->si_generation);
166 xdr_encode_opaque_fixed(p, &sid->si_opaque, NFS4_STATEID_OTHER_SIZE);
172 * typedef opaque sessionid4[NFS4_SESSIONID_SIZE];
174 static void encode_sessionid4(struct xdr_stream *xdr,
175 const struct nfsd4_session *session)
179 p = xdr_reserve_space(xdr, NFS4_MAX_SESSIONID_LEN);
180 xdr_encode_opaque_fixed(p, session->se_sessionid.data,
181 NFS4_MAX_SESSIONID_LEN);
187 static const struct {
190 } nfs_cb_errtbl[] = {
192 { NFS4ERR_PERM, -EPERM },
193 { NFS4ERR_NOENT, -ENOENT },
194 { NFS4ERR_IO, -EIO },
195 { NFS4ERR_NXIO, -ENXIO },
196 { NFS4ERR_ACCESS, -EACCES },
197 { NFS4ERR_EXIST, -EEXIST },
198 { NFS4ERR_XDEV, -EXDEV },
199 { NFS4ERR_NOTDIR, -ENOTDIR },
200 { NFS4ERR_ISDIR, -EISDIR },
201 { NFS4ERR_INVAL, -EINVAL },
202 { NFS4ERR_FBIG, -EFBIG },
203 { NFS4ERR_NOSPC, -ENOSPC },
204 { NFS4ERR_ROFS, -EROFS },
205 { NFS4ERR_MLINK, -EMLINK },
206 { NFS4ERR_NAMETOOLONG, -ENAMETOOLONG },
207 { NFS4ERR_NOTEMPTY, -ENOTEMPTY },
208 { NFS4ERR_DQUOT, -EDQUOT },
209 { NFS4ERR_STALE, -ESTALE },
210 { NFS4ERR_BADHANDLE, -EBADHANDLE },
211 { NFS4ERR_BAD_COOKIE, -EBADCOOKIE },
212 { NFS4ERR_NOTSUPP, -ENOTSUPP },
213 { NFS4ERR_TOOSMALL, -ETOOSMALL },
214 { NFS4ERR_SERVERFAULT, -ESERVERFAULT },
215 { NFS4ERR_BADTYPE, -EBADTYPE },
216 { NFS4ERR_LOCKED, -EAGAIN },
217 { NFS4ERR_RESOURCE, -EREMOTEIO },
218 { NFS4ERR_SYMLINK, -ELOOP },
219 { NFS4ERR_OP_ILLEGAL, -EOPNOTSUPP },
220 { NFS4ERR_DEADLOCK, -EDEADLK },
225 * If we cannot translate the error, the recovery routines should
228 * Note: remaining NFSv4 error codes have values > 10000, so should
229 * not conflict with native Linux error codes.
231 static int nfs_cb_stat_to_errno(int status)
235 for (i = 0; nfs_cb_errtbl[i].stat != -1; i++) {
236 if (nfs_cb_errtbl[i].stat == status)
237 return nfs_cb_errtbl[i].errno;
240 dprintk("NFSD: Unrecognized NFS CB status value: %u\n", status);
244 static int decode_cb_op_status(struct xdr_stream *xdr,
245 enum nfs_cb_opnum4 expected, int *status)
250 p = xdr_inline_decode(xdr, 4 + 4);
251 if (unlikely(p == NULL))
253 op = be32_to_cpup(p++);
254 if (unlikely(op != expected))
256 *status = nfs_cb_stat_to_errno(be32_to_cpup(p));
261 dprintk("NFSD: Callback server returned operation %d but "
262 "we issued a request for %d\n", op, expected);
269 * struct CB_COMPOUND4args {
271 * uint32_t minorversion;
272 * uint32_t callback_ident;
273 * nfs_cb_argop4 argarray<>;
276 static void encode_cb_compound4args(struct xdr_stream *xdr,
277 struct nfs4_cb_compound_hdr *hdr)
281 p = xdr_reserve_space(xdr, 4 + 4 + 4 + 4);
282 p = xdr_encode_empty_array(p); /* empty tag */
283 *p++ = cpu_to_be32(hdr->minorversion);
284 *p++ = cpu_to_be32(hdr->ident);
287 *p = cpu_to_be32(hdr->nops); /* argarray element count */
291 * Update argarray element count
293 static void encode_cb_nops(struct nfs4_cb_compound_hdr *hdr)
295 BUG_ON(hdr->nops > NFS4_MAX_BACK_CHANNEL_OPS);
296 *hdr->nops_p = cpu_to_be32(hdr->nops);
302 * struct CB_COMPOUND4res {
305 * nfs_cb_resop4 resarray<>;
308 static int decode_cb_compound4res(struct xdr_stream *xdr,
309 struct nfs4_cb_compound_hdr *hdr)
314 p = xdr_inline_decode(xdr, 4 + 4);
315 if (unlikely(p == NULL))
317 hdr->status = be32_to_cpup(p++);
319 length = be32_to_cpup(p++);
320 p = xdr_inline_decode(xdr, length + 4);
321 if (unlikely(p == NULL))
323 p += XDR_QUADLEN(length);
324 hdr->nops = be32_to_cpup(p);
333 * struct CB_RECALL4args {
339 static void encode_cb_recall4args(struct xdr_stream *xdr,
340 const struct nfs4_delegation *dp,
341 struct nfs4_cb_compound_hdr *hdr)
345 encode_nfs_cb_opnum4(xdr, OP_CB_RECALL);
346 encode_stateid4(xdr, &dp->dl_stid.sc_stateid);
348 p = xdr_reserve_space(xdr, 4);
349 *p++ = xdr_zero; /* truncate */
351 encode_nfs_fh4(xdr, &dp->dl_stid.sc_file->fi_fhandle);
359 * struct CB_RECALLANY4args {
360 * uint32_t craa_objects_to_keep;
361 * bitmap4 craa_type_mask;
365 encode_cb_recallany4args(struct xdr_stream *xdr,
366 struct nfs4_cb_compound_hdr *hdr, struct nfsd4_cb_recall_any *ra)
368 encode_nfs_cb_opnum4(xdr, OP_CB_RECALL_ANY);
369 encode_uint32(xdr, ra->ra_keep);
370 encode_bitmap4(xdr, ra->ra_bmval, ARRAY_SIZE(ra->ra_bmval));
376 * struct CB_GETATTR4args {
378 * bitmap4 attr_request;
381 * The size and change attributes are the only one
382 * guaranteed to be serviced by the client.
385 encode_cb_getattr4args(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr,
386 struct nfs4_cb_fattr *fattr)
388 struct nfs4_delegation *dp =
389 container_of(fattr, struct nfs4_delegation, dl_cb_fattr);
390 struct knfsd_fh *fh = &dp->dl_stid.sc_file->fi_fhandle;
392 encode_nfs_cb_opnum4(xdr, OP_CB_GETATTR);
393 encode_nfs_fh4(xdr, fh);
394 encode_bitmap4(xdr, fattr->ncf_cb_bmap, ARRAY_SIZE(fattr->ncf_cb_bmap));
401 * struct CB_SEQUENCE4args {
402 * sessionid4 csa_sessionid;
403 * sequenceid4 csa_sequenceid;
404 * slotid4 csa_slotid;
405 * slotid4 csa_highest_slotid;
406 * bool csa_cachethis;
407 * referring_call_list4 csa_referring_call_lists<>;
410 static void encode_cb_sequence4args(struct xdr_stream *xdr,
411 const struct nfsd4_callback *cb,
412 struct nfs4_cb_compound_hdr *hdr)
414 struct nfsd4_session *session = cb->cb_clp->cl_cb_session;
417 if (hdr->minorversion == 0)
420 encode_nfs_cb_opnum4(xdr, OP_CB_SEQUENCE);
421 encode_sessionid4(xdr, session);
423 p = xdr_reserve_space(xdr, 4 + 4 + 4 + 4 + 4);
424 *p++ = cpu_to_be32(session->se_cb_seq_nr); /* csa_sequenceid */
425 *p++ = xdr_zero; /* csa_slotid */
426 *p++ = xdr_zero; /* csa_highest_slotid */
427 *p++ = xdr_zero; /* csa_cachethis */
428 xdr_encode_empty_array(p); /* csa_referring_call_lists */
436 * struct CB_SEQUENCE4resok {
437 * sessionid4 csr_sessionid;
438 * sequenceid4 csr_sequenceid;
439 * slotid4 csr_slotid;
440 * slotid4 csr_highest_slotid;
441 * slotid4 csr_target_highest_slotid;
444 * union CB_SEQUENCE4res switch (nfsstat4 csr_status) {
446 * CB_SEQUENCE4resok csr_resok4;
451 * Our current back channel implmentation supports a single backchannel
452 * with a single slot.
454 static int decode_cb_sequence4resok(struct xdr_stream *xdr,
455 struct nfsd4_callback *cb)
457 struct nfsd4_session *session = cb->cb_clp->cl_cb_session;
458 int status = -ESERVERFAULT;
463 * If the server returns different values for sessionID, slotID or
464 * sequence number, the server is looney tunes.
466 p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4 + 4 + 4);
467 if (unlikely(p == NULL))
470 if (memcmp(p, session->se_sessionid.data, NFS4_MAX_SESSIONID_LEN)) {
471 dprintk("NFS: %s Invalid session id\n", __func__);
474 p += XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN);
476 dummy = be32_to_cpup(p++);
477 if (dummy != session->se_cb_seq_nr) {
478 dprintk("NFS: %s Invalid sequence number\n", __func__);
482 dummy = be32_to_cpup(p++);
484 dprintk("NFS: %s Invalid slotid\n", __func__);
489 * FIXME: process highest slotid and target highest slotid
493 cb->cb_seq_status = status;
500 static int decode_cb_sequence4res(struct xdr_stream *xdr,
501 struct nfsd4_callback *cb)
505 if (cb->cb_clp->cl_minorversion == 0)
508 status = decode_cb_op_status(xdr, OP_CB_SEQUENCE, &cb->cb_seq_status);
509 if (unlikely(status || cb->cb_seq_status))
512 return decode_cb_sequence4resok(xdr, cb);
516 * NFSv4.0 and NFSv4.1 XDR encode functions
518 * NFSv4.0 callback argument types are defined in section 15 of RFC
519 * 3530: "Network File System (NFS) version 4 Protocol" and section 20
520 * of RFC 5661: "Network File System (NFS) Version 4 Minor Version 1
525 * NB: Without this zero space reservation, callbacks over krb5p fail
527 static void nfs4_xdr_enc_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
528 const void *__unused)
530 xdr_reserve_space(xdr, 0);
534 * 20.1. Operation 3: CB_GETATTR - Get Attributes
536 static void nfs4_xdr_enc_cb_getattr(struct rpc_rqst *req,
537 struct xdr_stream *xdr, const void *data)
539 const struct nfsd4_callback *cb = data;
540 struct nfs4_cb_fattr *ncf =
541 container_of(cb, struct nfs4_cb_fattr, ncf_getattr);
542 struct nfs4_cb_compound_hdr hdr = {
543 .ident = cb->cb_clp->cl_cb_ident,
544 .minorversion = cb->cb_clp->cl_minorversion,
547 encode_cb_compound4args(xdr, &hdr);
548 encode_cb_sequence4args(xdr, cb, &hdr);
549 encode_cb_getattr4args(xdr, &hdr, ncf);
550 encode_cb_nops(&hdr);
554 * 20.2. Operation 4: CB_RECALL - Recall a Delegation
556 static void nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, struct xdr_stream *xdr,
559 const struct nfsd4_callback *cb = data;
560 const struct nfs4_delegation *dp = cb_to_delegation(cb);
561 struct nfs4_cb_compound_hdr hdr = {
562 .ident = cb->cb_clp->cl_cb_ident,
563 .minorversion = cb->cb_clp->cl_minorversion,
566 encode_cb_compound4args(xdr, &hdr);
567 encode_cb_sequence4args(xdr, cb, &hdr);
568 encode_cb_recall4args(xdr, dp, &hdr);
569 encode_cb_nops(&hdr);
573 * 20.6. Operation 8: CB_RECALL_ANY - Keep Any N Recallable Objects
576 nfs4_xdr_enc_cb_recall_any(struct rpc_rqst *req,
577 struct xdr_stream *xdr, const void *data)
579 const struct nfsd4_callback *cb = data;
580 struct nfsd4_cb_recall_any *ra;
581 struct nfs4_cb_compound_hdr hdr = {
582 .ident = cb->cb_clp->cl_cb_ident,
583 .minorversion = cb->cb_clp->cl_minorversion,
586 ra = container_of(cb, struct nfsd4_cb_recall_any, ra_cb);
587 encode_cb_compound4args(xdr, &hdr);
588 encode_cb_sequence4args(xdr, cb, &hdr);
589 encode_cb_recallany4args(xdr, &hdr, ra);
590 encode_cb_nops(&hdr);
594 * NFSv4.0 and NFSv4.1 XDR decode functions
596 * NFSv4.0 callback result types are defined in section 15 of RFC
597 * 3530: "Network File System (NFS) version 4 Protocol" and section 20
598 * of RFC 5661: "Network File System (NFS) Version 4 Minor Version 1
602 static int nfs4_xdr_dec_cb_null(struct rpc_rqst *req, struct xdr_stream *xdr,
609 * 20.1. Operation 3: CB_GETATTR - Get Attributes
611 static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp,
612 struct xdr_stream *xdr,
615 struct nfsd4_callback *cb = data;
616 struct nfs4_cb_compound_hdr hdr;
620 struct nfs4_cb_fattr *ncf =
621 container_of(cb, struct nfs4_cb_fattr, ncf_getattr);
623 status = decode_cb_compound4res(xdr, &hdr);
624 if (unlikely(status))
627 status = decode_cb_sequence4res(xdr, cb);
628 if (unlikely(status || cb->cb_seq_status))
631 status = decode_cb_op_status(xdr, OP_CB_GETATTR, &cb->cb_status);
634 if (xdr_stream_decode_uint32_array(xdr, bitmap, 3) < 0)
635 return -NFSERR_BAD_XDR;
636 if (xdr_stream_decode_u32(xdr, &attrlen) < 0)
637 return -NFSERR_BAD_XDR;
638 if (attrlen > (sizeof(ncf->ncf_cb_change) + sizeof(ncf->ncf_cb_fsize)))
639 return -NFSERR_BAD_XDR;
640 status = decode_cb_fattr4(xdr, bitmap, ncf);
645 * 20.2. Operation 4: CB_RECALL - Recall a Delegation
647 static int nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp,
648 struct xdr_stream *xdr,
651 struct nfsd4_callback *cb = data;
652 struct nfs4_cb_compound_hdr hdr;
655 status = decode_cb_compound4res(xdr, &hdr);
656 if (unlikely(status))
659 status = decode_cb_sequence4res(xdr, cb);
660 if (unlikely(status || cb->cb_seq_status))
663 return decode_cb_op_status(xdr, OP_CB_RECALL, &cb->cb_status);
667 * 20.6. Operation 8: CB_RECALL_ANY - Keep Any N Recallable Objects
670 nfs4_xdr_dec_cb_recall_any(struct rpc_rqst *rqstp,
671 struct xdr_stream *xdr,
674 struct nfsd4_callback *cb = data;
675 struct nfs4_cb_compound_hdr hdr;
678 status = decode_cb_compound4res(xdr, &hdr);
679 if (unlikely(status))
681 status = decode_cb_sequence4res(xdr, cb);
682 if (unlikely(status || cb->cb_seq_status))
684 status = decode_cb_op_status(xdr, OP_CB_RECALL_ANY, &cb->cb_status);
688 #ifdef CONFIG_NFSD_PNFS
690 * CB_LAYOUTRECALL4args
692 * struct layoutrecall_file4 {
694 * offset4 lor_offset;
695 * length4 lor_length;
696 * stateid4 lor_stateid;
699 * union layoutrecall4 switch(layoutrecall_type4 lor_recalltype) {
700 * case LAYOUTRECALL4_FILE:
701 * layoutrecall_file4 lor_layout;
702 * case LAYOUTRECALL4_FSID:
704 * case LAYOUTRECALL4_ALL:
708 * struct CB_LAYOUTRECALL4args {
709 * layouttype4 clora_type;
710 * layoutiomode4 clora_iomode;
711 * bool clora_changed;
712 * layoutrecall4 clora_recall;
715 static void encode_cb_layout4args(struct xdr_stream *xdr,
716 const struct nfs4_layout_stateid *ls,
717 struct nfs4_cb_compound_hdr *hdr)
721 BUG_ON(hdr->minorversion == 0);
723 p = xdr_reserve_space(xdr, 5 * 4);
724 *p++ = cpu_to_be32(OP_CB_LAYOUTRECALL);
725 *p++ = cpu_to_be32(ls->ls_layout_type);
726 *p++ = cpu_to_be32(IOMODE_ANY);
727 *p++ = cpu_to_be32(1);
728 *p = cpu_to_be32(RETURN_FILE);
730 encode_nfs_fh4(xdr, &ls->ls_stid.sc_file->fi_fhandle);
732 p = xdr_reserve_space(xdr, 2 * 8);
733 p = xdr_encode_hyper(p, 0);
734 xdr_encode_hyper(p, NFS4_MAX_UINT64);
736 encode_stateid4(xdr, &ls->ls_recall_sid);
741 static void nfs4_xdr_enc_cb_layout(struct rpc_rqst *req,
742 struct xdr_stream *xdr,
745 const struct nfsd4_callback *cb = data;
746 const struct nfs4_layout_stateid *ls =
747 container_of(cb, struct nfs4_layout_stateid, ls_recall);
748 struct nfs4_cb_compound_hdr hdr = {
750 .minorversion = cb->cb_clp->cl_minorversion,
753 encode_cb_compound4args(xdr, &hdr);
754 encode_cb_sequence4args(xdr, cb, &hdr);
755 encode_cb_layout4args(xdr, ls, &hdr);
756 encode_cb_nops(&hdr);
759 static int nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp,
760 struct xdr_stream *xdr,
763 struct nfsd4_callback *cb = data;
764 struct nfs4_cb_compound_hdr hdr;
767 status = decode_cb_compound4res(xdr, &hdr);
768 if (unlikely(status))
771 status = decode_cb_sequence4res(xdr, cb);
772 if (unlikely(status || cb->cb_seq_status))
775 return decode_cb_op_status(xdr, OP_CB_LAYOUTRECALL, &cb->cb_status);
777 #endif /* CONFIG_NFSD_PNFS */
779 static void encode_stateowner(struct xdr_stream *xdr, struct nfs4_stateowner *so)
783 p = xdr_reserve_space(xdr, 8 + 4 + so->so_owner.len);
784 p = xdr_encode_opaque_fixed(p, &so->so_client->cl_clientid, 8);
785 xdr_encode_opaque(p, so->so_owner.data, so->so_owner.len);
788 static void nfs4_xdr_enc_cb_notify_lock(struct rpc_rqst *req,
789 struct xdr_stream *xdr,
792 const struct nfsd4_callback *cb = data;
793 const struct nfsd4_blocked_lock *nbl =
794 container_of(cb, struct nfsd4_blocked_lock, nbl_cb);
795 struct nfs4_lockowner *lo = (struct nfs4_lockowner *)nbl->nbl_lock.fl_owner;
796 struct nfs4_cb_compound_hdr hdr = {
798 .minorversion = cb->cb_clp->cl_minorversion,
803 BUG_ON(hdr.minorversion == 0);
805 encode_cb_compound4args(xdr, &hdr);
806 encode_cb_sequence4args(xdr, cb, &hdr);
808 p = xdr_reserve_space(xdr, 4);
809 *p = cpu_to_be32(OP_CB_NOTIFY_LOCK);
810 encode_nfs_fh4(xdr, &nbl->nbl_fh);
811 encode_stateowner(xdr, &lo->lo_owner);
814 encode_cb_nops(&hdr);
817 static int nfs4_xdr_dec_cb_notify_lock(struct rpc_rqst *rqstp,
818 struct xdr_stream *xdr,
821 struct nfsd4_callback *cb = data;
822 struct nfs4_cb_compound_hdr hdr;
825 status = decode_cb_compound4res(xdr, &hdr);
826 if (unlikely(status))
829 status = decode_cb_sequence4res(xdr, cb);
830 if (unlikely(status || cb->cb_seq_status))
833 return decode_cb_op_status(xdr, OP_CB_NOTIFY_LOCK, &cb->cb_status);
837 * struct write_response4 {
838 * stateid4 wr_callback_id<1>;
840 * stable_how4 wr_committed;
841 * verifier4 wr_writeverf;
843 * union offload_info4 switch (nfsstat4 coa_status) {
845 * write_response4 coa_resok4;
847 * length4 coa_bytes_copied;
849 * struct CB_OFFLOAD4args {
851 * stateid4 coa_stateid;
852 * offload_info4 coa_offload_info;
855 static void encode_offload_info4(struct xdr_stream *xdr,
856 const struct nfsd4_cb_offload *cbo)
860 p = xdr_reserve_space(xdr, 4);
862 switch (cbo->co_nfserr) {
864 p = xdr_reserve_space(xdr, 4 + 8 + 4 + NFS4_VERIFIER_SIZE);
865 p = xdr_encode_empty_array(p);
866 p = xdr_encode_hyper(p, cbo->co_res.wr_bytes_written);
867 *p++ = cpu_to_be32(cbo->co_res.wr_stable_how);
868 p = xdr_encode_opaque_fixed(p, cbo->co_res.wr_verifier.data,
872 p = xdr_reserve_space(xdr, 8);
873 /* We always return success if bytes were written */
874 p = xdr_encode_hyper(p, 0);
878 static void encode_cb_offload4args(struct xdr_stream *xdr,
879 const struct nfsd4_cb_offload *cbo,
880 struct nfs4_cb_compound_hdr *hdr)
884 p = xdr_reserve_space(xdr, 4);
885 *p = cpu_to_be32(OP_CB_OFFLOAD);
886 encode_nfs_fh4(xdr, &cbo->co_fh);
887 encode_stateid4(xdr, &cbo->co_res.cb_stateid);
888 encode_offload_info4(xdr, cbo);
893 static void nfs4_xdr_enc_cb_offload(struct rpc_rqst *req,
894 struct xdr_stream *xdr,
897 const struct nfsd4_callback *cb = data;
898 const struct nfsd4_cb_offload *cbo =
899 container_of(cb, struct nfsd4_cb_offload, co_cb);
900 struct nfs4_cb_compound_hdr hdr = {
902 .minorversion = cb->cb_clp->cl_minorversion,
905 encode_cb_compound4args(xdr, &hdr);
906 encode_cb_sequence4args(xdr, cb, &hdr);
907 encode_cb_offload4args(xdr, cbo, &hdr);
908 encode_cb_nops(&hdr);
911 static int nfs4_xdr_dec_cb_offload(struct rpc_rqst *rqstp,
912 struct xdr_stream *xdr,
915 struct nfsd4_callback *cb = data;
916 struct nfs4_cb_compound_hdr hdr;
919 status = decode_cb_compound4res(xdr, &hdr);
920 if (unlikely(status))
923 status = decode_cb_sequence4res(xdr, cb);
924 if (unlikely(status || cb->cb_seq_status))
927 return decode_cb_op_status(xdr, OP_CB_OFFLOAD, &cb->cb_status);
930 * RPC procedure tables
932 #define PROC(proc, call, argtype, restype) \
933 [NFSPROC4_CLNT_##proc] = { \
934 .p_proc = NFSPROC4_CB_##call, \
935 .p_encode = nfs4_xdr_enc_##argtype, \
936 .p_decode = nfs4_xdr_dec_##restype, \
937 .p_arglen = NFS4_enc_##argtype##_sz, \
938 .p_replen = NFS4_dec_##restype##_sz, \
939 .p_statidx = NFSPROC4_CB_##call, \
943 static const struct rpc_procinfo nfs4_cb_procedures[] = {
944 PROC(CB_NULL, NULL, cb_null, cb_null),
945 PROC(CB_RECALL, COMPOUND, cb_recall, cb_recall),
946 #ifdef CONFIG_NFSD_PNFS
947 PROC(CB_LAYOUT, COMPOUND, cb_layout, cb_layout),
949 PROC(CB_NOTIFY_LOCK, COMPOUND, cb_notify_lock, cb_notify_lock),
950 PROC(CB_OFFLOAD, COMPOUND, cb_offload, cb_offload),
951 PROC(CB_RECALL_ANY, COMPOUND, cb_recall_any, cb_recall_any),
952 PROC(CB_GETATTR, COMPOUND, cb_getattr, cb_getattr),
955 static unsigned int nfs4_cb_counts[ARRAY_SIZE(nfs4_cb_procedures)];
956 static const struct rpc_version nfs_cb_version4 = {
958 * Note on the callback rpc program version number: despite language in rfc
959 * 5661 section 18.36.3 requiring servers to use 4 in this field, the
960 * official xdr descriptions for both 4.0 and 4.1 specify version 1, and
961 * in practice that appears to be what implementations use. The section
962 * 18.36.3 language is expected to be fixed in an erratum.
965 .nrprocs = ARRAY_SIZE(nfs4_cb_procedures),
966 .procs = nfs4_cb_procedures,
967 .counts = nfs4_cb_counts,
970 static const struct rpc_version *nfs_cb_version[2] = {
971 [1] = &nfs_cb_version4,
974 static const struct rpc_program cb_program;
976 static struct rpc_stat cb_stats = {
977 .program = &cb_program
980 #define NFS4_CALLBACK 0x40000000
981 static const struct rpc_program cb_program = {
983 .number = NFS4_CALLBACK,
984 .nrvers = ARRAY_SIZE(nfs_cb_version),
985 .version = nfs_cb_version,
987 .pipe_dir_name = "nfsd4_cb",
990 static int max_cb_time(struct net *net)
992 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
995 * nfsd4_lease is set to at most one hour in __nfsd4_write_time,
996 * so we can use 32-bit math on it. Warn if that assumption
997 * ever stops being true.
999 if (WARN_ON_ONCE(nn->nfsd4_lease > 3600))
1002 return max(((u32)nn->nfsd4_lease)/10, 1u) * HZ;
1005 static struct workqueue_struct *callback_wq;
1007 static bool nfsd4_queue_cb(struct nfsd4_callback *cb)
1009 return queue_work(callback_wq, &cb->cb_work);
1012 static void nfsd41_cb_inflight_begin(struct nfs4_client *clp)
1014 atomic_inc(&clp->cl_cb_inflight);
1017 static void nfsd41_cb_inflight_end(struct nfs4_client *clp)
1020 if (atomic_dec_and_test(&clp->cl_cb_inflight))
1021 wake_up_var(&clp->cl_cb_inflight);
1024 static void nfsd41_cb_inflight_wait_complete(struct nfs4_client *clp)
1026 wait_var_event(&clp->cl_cb_inflight,
1027 !atomic_read(&clp->cl_cb_inflight));
1030 static const struct cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses)
1032 if (clp->cl_minorversion == 0) {
1033 client->cl_principal = clp->cl_cred.cr_targ_princ ?
1034 clp->cl_cred.cr_targ_princ : "nfs";
1036 return get_cred(rpc_machine_cred());
1040 kcred = prepare_kernel_cred(&init_task);
1044 kcred->fsuid = ses->se_cb_sec.uid;
1045 kcred->fsgid = ses->se_cb_sec.gid;
1050 static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
1052 int maxtime = max_cb_time(clp->net);
1053 struct rpc_timeout timeparms = {
1054 .to_initval = maxtime,
1056 .to_maxval = maxtime,
1058 struct rpc_create_args args = {
1060 .address = (struct sockaddr *) &conn->cb_addr,
1061 .addrsize = conn->cb_addrlen,
1062 .saddress = (struct sockaddr *) &conn->cb_saddr,
1063 .timeout = &timeparms,
1064 .program = &cb_program,
1066 .flags = (RPC_CLNT_CREATE_NOPING | RPC_CLNT_CREATE_QUIET),
1067 .cred = current_cred(),
1069 struct rpc_clnt *client;
1070 const struct cred *cred;
1072 if (clp->cl_minorversion == 0) {
1073 if (!clp->cl_cred.cr_principal &&
1074 (clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5)) {
1075 trace_nfsd_cb_setup_err(clp, -EINVAL);
1078 args.client_name = clp->cl_cred.cr_principal;
1079 args.prognumber = conn->cb_prog;
1080 args.protocol = XPRT_TRANSPORT_TCP;
1081 args.authflavor = clp->cl_cred.cr_flavor;
1082 clp->cl_cb_ident = conn->cb_ident;
1086 clp->cl_cb_session = ses;
1087 args.bc_xprt = conn->cb_xprt;
1088 args.prognumber = clp->cl_cb_session->se_cb_prog;
1089 args.protocol = conn->cb_xprt->xpt_class->xcl_ident |
1091 args.authflavor = ses->se_cb_sec.flavor;
1093 /* Create RPC client */
1094 client = rpc_create(&args);
1095 if (IS_ERR(client)) {
1096 trace_nfsd_cb_setup_err(clp, PTR_ERR(client));
1097 return PTR_ERR(client);
1099 cred = get_backchannel_cred(clp, client, ses);
1101 trace_nfsd_cb_setup_err(clp, -ENOMEM);
1102 rpc_shutdown_client(client);
1106 if (clp->cl_minorversion != 0)
1107 clp->cl_cb_conn.cb_xprt = conn->cb_xprt;
1108 clp->cl_cb_client = client;
1109 clp->cl_cb_cred = cred;
1111 trace_nfsd_cb_setup(clp, rpc_peeraddr2str(client, RPC_DISPLAY_NETID),
1117 static void nfsd4_mark_cb_state(struct nfs4_client *clp, int newstate)
1119 if (clp->cl_cb_state != newstate) {
1120 clp->cl_cb_state = newstate;
1121 trace_nfsd_cb_state(clp);
1125 static void nfsd4_mark_cb_down(struct nfs4_client *clp, int reason)
1127 if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
1129 nfsd4_mark_cb_state(clp, NFSD4_CB_DOWN);
1132 static void nfsd4_mark_cb_fault(struct nfs4_client *clp, int reason)
1134 if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
1136 nfsd4_mark_cb_state(clp, NFSD4_CB_FAULT);
1139 static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
1141 struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null);
1143 if (task->tk_status)
1144 nfsd4_mark_cb_down(clp, task->tk_status);
1146 nfsd4_mark_cb_state(clp, NFSD4_CB_UP);
1149 static void nfsd4_cb_probe_release(void *calldata)
1151 struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null);
1153 nfsd41_cb_inflight_end(clp);
1157 static const struct rpc_call_ops nfsd4_cb_probe_ops = {
1158 /* XXX: release method to ensure we set the cb channel down if
1159 * necessary on early failure? */
1160 .rpc_call_done = nfsd4_cb_probe_done,
1161 .rpc_release = nfsd4_cb_probe_release,
1165 * Poke the callback thread to process any updates to the callback
1166 * parameters, and send a null probe.
1168 void nfsd4_probe_callback(struct nfs4_client *clp)
1170 trace_nfsd_cb_probe(clp);
1171 nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN);
1172 set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
1173 nfsd4_run_cb(&clp->cl_cb_null);
1176 void nfsd4_probe_callback_sync(struct nfs4_client *clp)
1178 nfsd4_probe_callback(clp);
1179 flush_workqueue(callback_wq);
1182 void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
1184 nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN);
1185 spin_lock(&clp->cl_lock);
1186 memcpy(&clp->cl_cb_conn, conn, sizeof(struct nfs4_cb_conn));
1187 spin_unlock(&clp->cl_lock);
1191 * There's currently a single callback channel slot.
1192 * If the slot is available, then mark it busy. Otherwise, set the
1193 * thread for sleeping on the callback RPC wait queue.
1195 static bool nfsd41_cb_get_slot(struct nfsd4_callback *cb, struct rpc_task *task)
1197 struct nfs4_client *clp = cb->cb_clp;
1199 if (!cb->cb_holds_slot &&
1200 test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
1201 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL);
1203 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) {
1204 dprintk("%s slot is busy\n", __func__);
1207 rpc_wake_up_queued_task(&clp->cl_cb_waitq, task);
1209 cb->cb_holds_slot = true;
1213 static void nfsd41_cb_release_slot(struct nfsd4_callback *cb)
1215 struct nfs4_client *clp = cb->cb_clp;
1217 if (cb->cb_holds_slot) {
1218 cb->cb_holds_slot = false;
1219 clear_bit(0, &clp->cl_cb_slot_busy);
1220 rpc_wake_up_next(&clp->cl_cb_waitq);
1224 static void nfsd41_destroy_cb(struct nfsd4_callback *cb)
1226 struct nfs4_client *clp = cb->cb_clp;
1228 nfsd41_cb_release_slot(cb);
1229 if (cb->cb_ops && cb->cb_ops->release)
1230 cb->cb_ops->release(cb);
1231 nfsd41_cb_inflight_end(clp);
1235 * TODO: cb_sequence should support referring call lists, cachethis, multiple
1236 * slots, and mark callback channel down on communication errors.
1238 static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata)
1240 struct nfsd4_callback *cb = calldata;
1241 struct nfs4_client *clp = cb->cb_clp;
1242 u32 minorversion = clp->cl_minorversion;
1245 * cb_seq_status is only set in decode_cb_sequence4res,
1246 * and so will remain 1 if an rpc level failure occurs.
1248 cb->cb_seq_status = 1;
1250 if (minorversion && !nfsd41_cb_get_slot(cb, task))
1252 rpc_call_start(task);
1255 static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback *cb)
1257 struct nfs4_client *clp = cb->cb_clp;
1258 struct nfsd4_session *session = clp->cl_cb_session;
1261 if (!clp->cl_minorversion) {
1263 * If the backchannel connection was shut down while this
1264 * task was queued, we need to resubmit it after setting up
1265 * a new backchannel connection.
1267 * Note that if we lost our callback connection permanently
1268 * the submission code will error out, so we don't need to
1269 * handle that case here.
1271 if (RPC_SIGNALLED(task))
1277 if (!cb->cb_holds_slot)
1280 switch (cb->cb_seq_status) {
1283 * No need for lock, access serialized in nfsd4_cb_prepare
1286 * If CB_SEQUENCE returns an error, then the state of the slot
1287 * (sequence ID, cached reply) MUST NOT change.
1289 ++session->se_cb_seq_nr;
1292 ++session->se_cb_seq_nr;
1295 case -NFS4ERR_BADSESSION:
1296 nfsd4_mark_cb_fault(cb->cb_clp, cb->cb_seq_status);
1299 case -NFS4ERR_DELAY:
1300 if (!rpc_restart_call(task))
1303 rpc_delay(task, 2 * HZ);
1305 case -NFS4ERR_BADSLOT:
1307 case -NFS4ERR_SEQ_MISORDERED:
1308 if (session->se_cb_seq_nr != 1) {
1309 session->se_cb_seq_nr = 1;
1314 nfsd4_mark_cb_fault(cb->cb_clp, cb->cb_seq_status);
1315 dprintk("%s: unprocessed error %d\n", __func__,
1319 nfsd41_cb_release_slot(cb);
1320 dprintk("%s: freed slot, new seqid=%d\n", __func__,
1321 clp->cl_cb_session->se_cb_seq_nr);
1323 if (RPC_SIGNALLED(task))
1328 if (rpc_restart_call_prepare(task))
1332 if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) {
1333 task->tk_status = 0;
1334 cb->cb_need_restart = true;
1339 static void nfsd4_cb_done(struct rpc_task *task, void *calldata)
1341 struct nfsd4_callback *cb = calldata;
1342 struct nfs4_client *clp = cb->cb_clp;
1344 if (!nfsd4_cb_sequence_done(task, cb))
1347 if (cb->cb_status) {
1348 WARN_ON_ONCE(task->tk_status);
1349 task->tk_status = cb->cb_status;
1352 switch (cb->cb_ops->done(cb, task)) {
1354 task->tk_status = 0;
1355 rpc_restart_call_prepare(task);
1358 switch (task->tk_status) {
1362 nfsd4_mark_cb_down(clp, task->tk_status);
1370 static void nfsd4_cb_release(void *calldata)
1372 struct nfsd4_callback *cb = calldata;
1374 if (cb->cb_need_restart)
1377 nfsd41_destroy_cb(cb);
1381 static const struct rpc_call_ops nfsd4_cb_ops = {
1382 .rpc_call_prepare = nfsd4_cb_prepare,
1383 .rpc_call_done = nfsd4_cb_done,
1384 .rpc_release = nfsd4_cb_release,
1387 int nfsd4_create_callback_queue(void)
1389 callback_wq = alloc_ordered_workqueue("nfsd4_callbacks", 0);
1395 void nfsd4_destroy_callback_queue(void)
1397 destroy_workqueue(callback_wq);
1400 /* must be called under the state lock */
1401 void nfsd4_shutdown_callback(struct nfs4_client *clp)
1403 if (clp->cl_cb_state != NFSD4_CB_UNKNOWN)
1404 trace_nfsd_cb_shutdown(clp);
1406 set_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags);
1408 * Note this won't actually result in a null callback;
1409 * instead, nfsd4_run_cb_null() will detect the killed
1410 * client, destroy the rpc client, and stop:
1412 nfsd4_run_cb(&clp->cl_cb_null);
1413 flush_workqueue(callback_wq);
1414 nfsd41_cb_inflight_wait_complete(clp);
1417 /* requires cl_lock: */
1418 static struct nfsd4_conn * __nfsd4_find_backchannel(struct nfs4_client *clp)
1420 struct nfsd4_session *s;
1421 struct nfsd4_conn *c;
1423 list_for_each_entry(s, &clp->cl_sessions, se_perclnt) {
1424 list_for_each_entry(c, &s->se_conns, cn_persession) {
1425 if (c->cn_flags & NFS4_CDFC4_BACK)
1433 * Note there isn't a lot of locking in this code; instead we depend on
1434 * the fact that it is run from the callback_wq, which won't run two
1435 * work items at once. So, for example, callback_wq handles all access
1436 * of cl_cb_client and all calls to rpc_create or rpc_shutdown_client.
1438 static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
1440 struct nfs4_cb_conn conn;
1441 struct nfs4_client *clp = cb->cb_clp;
1442 struct nfsd4_session *ses = NULL;
1443 struct nfsd4_conn *c;
1447 * This is either an update, or the client dying; in either case,
1448 * kill the old client:
1450 if (clp->cl_cb_client) {
1451 rpc_shutdown_client(clp->cl_cb_client);
1452 clp->cl_cb_client = NULL;
1453 put_cred(clp->cl_cb_cred);
1454 clp->cl_cb_cred = NULL;
1456 if (clp->cl_cb_conn.cb_xprt) {
1457 svc_xprt_put(clp->cl_cb_conn.cb_xprt);
1458 clp->cl_cb_conn.cb_xprt = NULL;
1460 if (test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags))
1462 spin_lock(&clp->cl_lock);
1464 * Only serialized callback code is allowed to clear these
1465 * flags; main nfsd code can only set them:
1467 BUG_ON(!(clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK));
1468 clear_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
1469 memcpy(&conn, &cb->cb_clp->cl_cb_conn, sizeof(struct nfs4_cb_conn));
1470 c = __nfsd4_find_backchannel(clp);
1472 svc_xprt_get(c->cn_xprt);
1473 conn.cb_xprt = c->cn_xprt;
1474 ses = c->cn_session;
1476 spin_unlock(&clp->cl_lock);
1478 err = setup_callback_client(clp, &conn, ses);
1480 nfsd4_mark_cb_down(clp, err);
1482 svc_xprt_put(c->cn_xprt);
1488 nfsd4_run_cb_work(struct work_struct *work)
1490 struct nfsd4_callback *cb =
1491 container_of(work, struct nfsd4_callback, cb_work);
1492 struct nfs4_client *clp = cb->cb_clp;
1493 struct rpc_clnt *clnt;
1496 if (cb->cb_need_restart) {
1497 cb->cb_need_restart = false;
1499 if (cb->cb_ops && cb->cb_ops->prepare)
1500 cb->cb_ops->prepare(cb);
1503 if (clp->cl_flags & NFSD4_CLIENT_CB_FLAG_MASK)
1504 nfsd4_process_cb_update(cb);
1506 clnt = clp->cl_cb_client;
1508 /* Callback channel broken, or client killed; give up: */
1509 nfsd41_destroy_cb(cb);
1514 * Don't send probe messages for 4.1 or later.
1516 if (!cb->cb_ops && clp->cl_minorversion) {
1517 nfsd4_mark_cb_state(clp, NFSD4_CB_UP);
1518 nfsd41_destroy_cb(cb);
1522 cb->cb_msg.rpc_cred = clp->cl_cb_cred;
1523 flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN;
1524 rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | flags,
1525 cb->cb_ops ? &nfsd4_cb_ops : &nfsd4_cb_probe_ops, cb);
1528 void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
1529 const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op)
1532 cb->cb_msg.rpc_proc = &nfs4_cb_procedures[op];
1533 cb->cb_msg.rpc_argp = cb;
1534 cb->cb_msg.rpc_resp = cb;
1536 INIT_WORK(&cb->cb_work, nfsd4_run_cb_work);
1537 cb->cb_seq_status = 1;
1539 cb->cb_need_restart = false;
1540 cb->cb_holds_slot = false;
1544 * nfsd4_run_cb - queue up a callback job to run
1545 * @cb: callback to queue
1547 * Kick off a callback to do its thing. Returns false if it was already
1548 * on a queue, true otherwise.
1550 bool nfsd4_run_cb(struct nfsd4_callback *cb)
1552 struct nfs4_client *clp = cb->cb_clp;
1555 nfsd41_cb_inflight_begin(clp);
1556 queued = nfsd4_queue_cb(cb);
1558 nfsd41_cb_inflight_end(clp);