From patchwork Mon Oct 2 14:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13406310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BDB3E784B7 for ; Mon, 2 Oct 2023 14:51:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237882AbjJBOvX (ORCPT ); Mon, 2 Oct 2023 10:51:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237884AbjJBOvV (ORCPT ); Mon, 2 Oct 2023 10:51:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BB7FB7 for ; Mon, 2 Oct 2023 07:51:19 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED346C433C7; Mon, 2 Oct 2023 14:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696258279; bh=tPyXOm6nZ7FsqosSypBjv4U+82u+bOPrneDVb78W5GA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=q+Os+IIEUiUYfCqTRAMzqvtStgVgnehnPfVX9cb8ZiwIYqyUsGJjyX1ab6wCd4IZt EYJ9OTWwuyUI9yCLKRhz8DNlBTmyqjQE2MhPf6iSYATDjnyMhPzwSHvHFeqVLdoWCz B6++QBLANG1kcBAw/Lf+FS9AiEElCHy5EbfzhJXQWYJXaD/qVljcrY+DOdc2S2oQA/ lxccVSTiwcwS0hnU+ds9nNCBExKzTOmWCkRi/2VYsWzcPfwp0BTpcJKCHMdtBePwIg foEv/lDH9TnO1Hln3oGKfSW10WL/kOxS2obeuJ1+0vYl5Az9AGm/Ekjgc1uyygWAQT VknKjUvc9EL0Q== Subject: [PATCH v1 1/4] NFSD: Add a utility function for encoding sessionid4 objects From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 02 Oct 2023 10:51:17 -0400 Message-ID: <169625827794.1640.6920815972016494390.stgit@klimt.1015granger.net> In-Reply-To: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> References: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever There is more than one NFSv4 operation that needs to encode a sessionid4, so extract that data type into a separate helper. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 59ac16985775..e41e46213444 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3881,6 +3881,14 @@ nfsd4_encode_stateid4(struct xdr_stream *xdr, const stateid_t *sid) return nfs_ok; } +static __be32 +nfsd4_encode_sessionid4(struct xdr_stream *xdr, + const struct nfs4_sessionid *sessionid) +{ + return nfsd4_encode_opaque_fixed(xdr, sessionid->data, + NFS4_MAX_SESSIONID_LEN); +} + static __be32 nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, union nfsd4_op_u *u) @@ -3902,17 +3910,16 @@ static __be32 nfsd4_encode_bind_conn_to_session(struct nfsd4_compoundres *resp, { struct nfsd4_bind_conn_to_session *bcts = &u->bind_conn_to_session; struct xdr_stream *xdr = resp->xdr; - __be32 *p; - p = xdr_reserve_space(xdr, NFS4_MAX_SESSIONID_LEN + 8); - if (!p) + /* bctsr_sessid */ + nfserr = nfsd4_encode_sessionid4(xdr, &bcts->sessionid); + if (nfserr != nfs_ok) + return nfserr; + /* bctsr_dir */ + if (xdr_stream_encode_u32(xdr, bcts->dir) != XDR_UNIT) return nfserr_resource; - p = xdr_encode_opaque_fixed(p, bcts->sessionid.data, - NFS4_MAX_SESSIONID_LEN); - *p++ = cpu_to_be32(bcts->dir); - /* Upshifting from TCP to RDMA is not supported */ - *p++ = cpu_to_be32(0); - return 0; + /* bctsr_use_conn_in_rdma_mode */ + return nfsd4_encode_bool(xdr, false); } static __be32 From patchwork Mon Oct 2 14:51:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13406311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B9FBE784B7 for ; Mon, 2 Oct 2023 14:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237878AbjJBOvd (ORCPT ); Mon, 2 Oct 2023 10:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237897AbjJBOv2 (ORCPT ); Mon, 2 Oct 2023 10:51:28 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC3A99F for ; Mon, 2 Oct 2023 07:51:25 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AC3CC433C7; Mon, 2 Oct 2023 14:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696258285; bh=QT/qGxYT7x1chDmfFy4c5Lf0RMA5paJelk98Q8mtl4o=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=B6AA2EP9MDPqq908d8JyNdocD8nE0MObqlRn60kt3EM6SpB56fe8b/RQ9PiaGJBbM xRuwLrwespxKdzAHoTYGLCginO7CcNvNIlfYcm63HH3FrswtHGN3zMINpLJGV0RBp0 gQg023fElt+OliBmpoxga6c6/owYcT+T6Cogx9WsBSJ+LlKyTkK3+hDHJVp9Y1vSUv xiQYIMV4HkfeBOIjlud7aYGIr6WhnTAsD1BokTx1F2zw2x1R7CW1/IlounurB4R9ec Zz/65l75Wxxwu1bv0KoEbef7S0pTVOxMvO8q8wHh5QxrcyjWqPQmBdtGavuqArslFG yxBAOXSEz4/mw== Subject: [PATCH v1 2/4] NFSD: Add nfsd4_encode_channel_attr4() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 02 Oct 2023 10:51:24 -0400 Message-ID: <169625828435.1640.4981323575080441000.stgit@klimt.1015granger.net> In-Reply-To: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> References: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever De-duplicate the encoding of the fore channel and backchannel attributes. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 80 +++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index e41e46213444..01820492c013 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4778,6 +4778,44 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, return 0; } +static __be32 +nfsd4_encode_channel_attrs4(struct xdr_stream *xdr, + const struct nfsd4_channel_attrs *attrs) +{ + __be32 status; + + /* ca_headerpadsize */ + status = nfsd4_encode_count4(xdr, 0); + if (status != nfs_ok) + return status; + /* ca_maxrequestsize */ + status = nfsd4_encode_count4(xdr, attrs->maxreq_sz); + if (status != nfs_ok) + return status; + /* ca_maxresponsesize */ + status = nfsd4_encode_count4(xdr, attrs->maxresp_sz); + if (status != nfs_ok) + return status; + /* ca_maxresponsesize_cached */ + status = nfsd4_encode_count4(xdr, attrs->maxresp_cached); + if (status != nfs_ok) + return status; + /* ca_maxoperations */ + status = nfsd4_encode_count4(xdr, attrs->maxops); + if (status != nfs_ok) + return status; + /* ca_maxrequests */ + status = nfsd4_encode_count4(xdr, attrs->maxreqs); + if (status != nfs_ok) + return status; + /* ca_rdma_ird<1> */ + if (xdr_stream_encode_u32(xdr, attrs->nr_rdma_attrs) != XDR_UNIT) + return nfserr_resource; + if (attrs->nr_rdma_attrs) + return nfsd4_encode_uint32_t(xdr, attrs->rdma_attrs); + return nfs_ok; +} + static __be32 nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr, union nfsd4_op_u *u) @@ -4794,42 +4832,12 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr, *p++ = cpu_to_be32(sess->seqid); *p++ = cpu_to_be32(sess->flags); - p = xdr_reserve_space(xdr, 28); - if (!p) - return nfserr_resource; - *p++ = cpu_to_be32(0); /* headerpadsz */ - *p++ = cpu_to_be32(sess->fore_channel.maxreq_sz); - *p++ = cpu_to_be32(sess->fore_channel.maxresp_sz); - *p++ = cpu_to_be32(sess->fore_channel.maxresp_cached); - *p++ = cpu_to_be32(sess->fore_channel.maxops); - *p++ = cpu_to_be32(sess->fore_channel.maxreqs); - *p++ = cpu_to_be32(sess->fore_channel.nr_rdma_attrs); - - if (sess->fore_channel.nr_rdma_attrs) { - p = xdr_reserve_space(xdr, 4); - if (!p) - return nfserr_resource; - *p++ = cpu_to_be32(sess->fore_channel.rdma_attrs); - } - - p = xdr_reserve_space(xdr, 28); - if (!p) - return nfserr_resource; - *p++ = cpu_to_be32(0); /* headerpadsz */ - *p++ = cpu_to_be32(sess->back_channel.maxreq_sz); - *p++ = cpu_to_be32(sess->back_channel.maxresp_sz); - *p++ = cpu_to_be32(sess->back_channel.maxresp_cached); - *p++ = cpu_to_be32(sess->back_channel.maxops); - *p++ = cpu_to_be32(sess->back_channel.maxreqs); - *p++ = cpu_to_be32(sess->back_channel.nr_rdma_attrs); - - if (sess->back_channel.nr_rdma_attrs) { - p = xdr_reserve_space(xdr, 4); - if (!p) - return nfserr_resource; - *p++ = cpu_to_be32(sess->back_channel.rdma_attrs); - } - return 0; + /* csr_fore_chan_attrs */ + nfserr = nfsd4_encode_channel_attrs4(xdr, &sess->fore_channel); + if (nfserr != nfs_ok) + return nfserr; + /* csr_back_chan_attrs */ + return nfsd4_encode_channel_attrs4(xdr, &sess->back_channel); } static __be32 From patchwork Mon Oct 2 14:51:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13406312 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9478FE784B9 for ; Mon, 2 Oct 2023 14:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237881AbjJBOvf (ORCPT ); Mon, 2 Oct 2023 10:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237875AbjJBOve (ORCPT ); Mon, 2 Oct 2023 10:51:34 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BA988E for ; Mon, 2 Oct 2023 07:51:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD702C433C8; Mon, 2 Oct 2023 14:51:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696258291; bh=0AhSkFrOERAZoJz26CpYCs5MqqGuWmGnX5QVGhtBr8k=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FTGX2Owwnc+3T4lMY4Fodcsg+KNbOPGs1Hdawuhv6PqG9v3cnE22UXpaZ+a3QBeXe KzOAcToapCfqrd4Dg5dfIyOL0IX9ig6smjMn5w6NtlwnNUdaex0zw0GXAOC5Y4D/36 /hVrOjv8y50hZ7XB7XPGw3PYR7nvi/StzBVKzgg+BUFJuj67NB+t/8jCMAZqK4UlpG JPXIj0aAIzK6TAWqlYPMJ8x42FDliUUk/TpDA3+v+ZdhghJq/j4LCeVIAPJ4mNGgKg D3J8jy+dkC9QHvEUM+zQHor4zN0z1wgXufJBAzF7KyzXQQ+3mySVGO4Xw+FdUWrgbq w48XZoyX91aSA== Subject: [PATCH v1 3/4] NFSD: Restructure nfsd4_encode_create_session() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 02 Oct 2023 10:51:30 -0400 Message-ID: <169625829068.1640.10434820352878652525.stgit@klimt.1015granger.net> In-Reply-To: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> References: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever Convert nfsd4_encode_create_session() to use the conventional XDR encoding utilities. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 21 ++++++++++++--------- fs/nfsd/xdr4.h | 1 + 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 01820492c013..505f397a6e5b 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4822,16 +4822,19 @@ nfsd4_encode_create_session(struct nfsd4_compoundres *resp, __be32 nfserr, { struct nfsd4_create_session *sess = &u->create_session; struct xdr_stream *xdr = resp->xdr; - __be32 *p; - - p = xdr_reserve_space(xdr, 24); - if (!p) - return nfserr_resource; - p = xdr_encode_opaque_fixed(p, sess->sessionid.data, - NFS4_MAX_SESSIONID_LEN); - *p++ = cpu_to_be32(sess->seqid); - *p++ = cpu_to_be32(sess->flags); + /* csr_sessionid */ + nfserr = nfsd4_encode_sessionid4(xdr, &sess->sessionid); + if (nfserr != nfs_ok) + return nfserr; + /* csr_sequence */ + nfserr = nfsd4_encode_sequenceid4(xdr, sess->seqid); + if (nfserr != nfs_ok) + return nfserr; + /* csr_flags */ + nfserr = nfsd4_encode_uint32_t(xdr, sess->flags); + if (nfserr != nfs_ok) + return nfserr; /* csr_fore_chan_attrs */ nfserr = nfsd4_encode_channel_attrs4(xdr, &sess->fore_channel); if (nfserr != nfs_ok) diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index a9ff01034ac1..7983eb679ba7 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -96,6 +96,7 @@ nfsd4_encode_uint32_t(struct xdr_stream *xdr, u32 val) #define nfsd4_encode_count4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_mode4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_nfs_lease4(x, v) nfsd4_encode_uint32_t(x, v) +#define nfsd4_encode_sequenceid4(x, v) nfsd4_encode_uint32_t(x, v) /** * nfsd4_encode_uint64_t - Encode an XDR uint64_t type result From patchwork Mon Oct 2 14:51:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13406313 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4405EE784B7 for ; Mon, 2 Oct 2023 14:51:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237860AbjJBOvm (ORCPT ); Mon, 2 Oct 2023 10:51:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237875AbjJBOvl (ORCPT ); Mon, 2 Oct 2023 10:51:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB52B8 for ; Mon, 2 Oct 2023 07:51:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BDE7C433C9; Mon, 2 Oct 2023 14:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696258298; bh=jSAf2uLBVHRO+A8Zet2h3ZWYDeFN0+UkCxTBIlRDi4Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=KBbSPnu0O0Fm6ljgQ3W6M2ImXZODM7/o4PiO7MsFUobgWTnQ8gJe2vrtWAUsSh7k+ DtZZ8lMryTAabUgRsHUoiSebICnSsLhWdM81Vza6r60IgE8e2gOYRNipV9d8f+xDMQ FFTTGVit4ueLeqTGOVz8fI9DqlSUP/hbN2/hS1QSRamicMZrSzTQVanGTGLBisoJw/ r1RHc8rBO1S/V7g1sVjZGMN/aJ6ZHeft7q5VJep3Y8d5wl9QGJKwxGOSlxNCDTZDka DtRtYm7vKoabEpG8ATD1yDLuo20PQlt0lKQlvm8Iq0kTOPqYteE+ZOosNISRiH/48W ubAIwp8BvhwIw== Subject: [PATCH v1 4/4] NFSD: Clean up nfsd4_encode_sequence() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 02 Oct 2023 10:51:37 -0400 Message-ID: <169625829708.1640.1086998477611708664.stgit@klimt.1015granger.net> In-Reply-To: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> References: <169625819958.1640.14102064750083176117.stgit@klimt.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever De-duplicate open-coded encoding of the sessionid, and convert the rest of the function to use conventional XDR utility functions. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 37 +++++++++++++++++++++++++------------ fs/nfsd/xdr4.h | 1 + 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 505f397a6e5b..f1f0b707c7d9 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4849,22 +4849,35 @@ nfsd4_encode_sequence(struct nfsd4_compoundres *resp, __be32 nfserr, { struct nfsd4_sequence *seq = &u->sequence; struct xdr_stream *xdr = resp->xdr; - __be32 *p; - p = xdr_reserve_space(xdr, NFS4_MAX_SESSIONID_LEN + 20); - if (!p) - return nfserr_resource; - p = xdr_encode_opaque_fixed(p, seq->sessionid.data, - NFS4_MAX_SESSIONID_LEN); - *p++ = cpu_to_be32(seq->seqid); - *p++ = cpu_to_be32(seq->slotid); + /* sr_sessionid */ + nfserr = nfsd4_encode_sessionid4(xdr, &seq->sessionid); + if (nfserr != nfs_ok) + return nfserr; + /* sr_sequenceid */ + nfserr = nfsd4_encode_sequenceid4(xdr, seq->seqid); + if (nfserr != nfs_ok) + return nfserr; + /* sr_slotid */ + nfserr = nfsd4_encode_slotid4(xdr, seq->slotid); + if (nfserr != nfs_ok) + return nfserr; /* Note slotid's are numbered from zero: */ - *p++ = cpu_to_be32(seq->maxslots - 1); /* sr_highest_slotid */ - *p++ = cpu_to_be32(seq->maxslots - 1); /* sr_target_highest_slotid */ - *p++ = cpu_to_be32(seq->status_flags); + /* sr_highest_slotid */ + nfserr = nfsd4_encode_slotid4(xdr, seq->maxslots - 1); + if (nfserr != nfs_ok) + return nfserr; + /* sr_target_highest_slotid */ + nfserr = nfsd4_encode_slotid4(xdr, seq->maxslots - 1); + if (nfserr != nfs_ok) + return nfserr; + /* sr_status_flags */ + nfserr = nfsd4_encode_uint32_t(xdr, seq->status_flags); + if (nfserr != nfs_ok) + return nfserr; resp->cstate.data_offset = xdr->buf->len; /* DRC cache data pointer */ - return 0; + return nfs_ok; } static __be32 diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 7983eb679ba7..cd124969589e 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -97,6 +97,7 @@ nfsd4_encode_uint32_t(struct xdr_stream *xdr, u32 val) #define nfsd4_encode_mode4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_nfs_lease4(x, v) nfsd4_encode_uint32_t(x, v) #define nfsd4_encode_sequenceid4(x, v) nfsd4_encode_uint32_t(x, v) +#define nfsd4_encode_slotid4(x, v) nfsd4_encode_uint32_t(x, v) /** * nfsd4_encode_uint64_t - Encode an XDR uint64_t type result