Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp70431rdb; Mon, 18 Sep 2023 08:29:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvfRjTrN7nOE5v/C6tm09Rv4wm2IiTNEFQtqcjVbSbPxgZ8be0P5mHrBGB2I3NT5CpoNPB X-Received: by 2002:a05:6a00:2da2:b0:68f:c9e0:1a68 with SMTP id fb34-20020a056a002da200b0068fc9e01a68mr8744552pfb.3.1695050969760; Mon, 18 Sep 2023 08:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695050969; cv=none; d=google.com; s=arc-20160816; b=G2iewPdgiaakx9a5Bz43jyUXyObkWttHYmsjtPbWysHMCgAhZqNDqm7UQ2T2KHHRGY f6JAhVZJYyZZuXb8KOyTZx8OgpeGNiTnwKGA3EfRF7MdbuJsOGZ9lKXrfV2kOsaj/3ZP PdhRsNI6a/9TAbSxyc8R5UD5dMlsptSzbJefjARy7N57ZKsssHvrMWQIXy+15Mp/kzp/ J1DiWWQZQuwu0UO09lq48dwxd8P2wlI/9LP8zzBdF1UidDzHPuvh8xq/yW/FMl349bq4 M+6c9NOFz5Sru89Gt916DCqKb+Q8lAwuZE8p3A00Kdcf4HoWW/vhpKaP8cHG51d4yLiY of8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=wmq1VoAfKIXkjMEnN2P+1Fy1IKQ3VXanq4YA5D8G2c0=; fh=v8a13lpFSZWlL4AptTEJnmXnlqoWXhGCGCgvrcnCT9I=; b=lPRVdrPg65X6rj9IAsUCrBvQ82AznIwmneLGFrWGv5R7nuoPxAARPTKhsTrQJLsIYK ePfONWqxM/o7t/OPjmymf9oOT1lMg9i4NbNkP/H3V26030yGMrmF19N55NVMqQhlr9eG RoBkw4I/UXUdcmasnb77gtPfWjBjjFLxiR73+UsPa9JGOu41CD7oDgCRRVMpD8yEDzOK VadaSAGD/EFMbJfdQP1tNDtzbjNp5Uw8WYDXt4T+VJi8M5eC2jrBTXKsO08Sanxefly2 y44TBFZ/FjkwTlUkL/T2LDVaKErU/kxiPASdlJeTh2r753fDcNLv3ERgloC9Ssunye9l 3ZiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DPCFphlE; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k62-20020a638441000000b00578a2da998asi356607pgd.304.2023.09.18.08.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 08:29:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DPCFphlE; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D3EA38034A61; Mon, 18 Sep 2023 08:26:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236845AbjIRP0g (ORCPT + 99 others); Mon, 18 Sep 2023 11:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbjIRP0f (ORCPT ); Mon, 18 Sep 2023 11:26:35 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 082FECF7 for ; Mon, 18 Sep 2023 08:24:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE457C193E8; Mon, 18 Sep 2023 14:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695045720; bh=4vsR15IVGU06iZtarv4SttIYOkjf26iIBQmJQ/9hrZU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=DPCFphlEmt/zQJYP6cM6jOcmMLgY6kbrSRLSmRlKFb9rFHc8FhDGMu/nOgU8p+r/q rWnsm7i4PDILNwIziGIVctw4Eb2UL53mvuq+7EjMn92sC2uCQg//9i4aweMTzENe0E vNycyVjdLOe4pgfIQl2yyiicC7ZovuzUd11OFz7jpTqRcKylvvaEwlZ379kyg1sazK ZciqqJbU4pUR0NpGMWujs8a2QzIyzZEYIMVj+Fm9jmacvgP8Yzk+vvI9qMlBHKiRlB i6AFtOZOJNNpBvijng2SB9ZsKCOz0jrkhzWxIw+GF0FmZ7jhVWZI0KVmqmnCxkfn1Z WM7cx9xazdDnA== Subject: [PATCH v1 49/52] NFSD: Add nfsd4_encode_fattr4_xattr_support() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 18 Sep 2023 10:01:59 -0400 Message-ID: <169504571981.133720.8100882888549390817.stgit@manet.1015granger.net> In-Reply-To: <169504501081.133720.4162400017732492854.stgit@manet.1015granger.net> References: <169504501081.133720.4162400017732492854.stgit@manet.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 18 Sep 2023 08:26:37 -0700 (PDT) From: Chuck Lever Refactor the encoder for FATTR4_XATTR_SUPPORT into a helper. In a subsequent patch, this helper will be called from a bitmask loop. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 137e7368dbfd..97654a2b876f 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3346,6 +3346,14 @@ static __be32 nfsd4_encode_fattr4_sec_label(struct xdr_stream *xdr, } #endif +static __be32 nfsd4_encode_fattr4_xattr_support(struct xdr_stream *xdr, + const struct nfsd4_fattr_args *args) +{ + int err = xattr_supports_user_prefix(d_inode(args->dentry)); + + return nfsd4_encode_bool(xdr, err == 0); +} + /* * Note: @fhp can be NULL; in this case, we might have to compose the filehandle * ourselves. @@ -3361,10 +3369,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, u32 bmval1 = bmval[1]; u32 bmval2 = bmval[2]; struct svc_fh *tempfh = NULL; - __be32 *p, *attrlen_p; int starting_len = xdr->buf->len; + __be32 *attrlen_p, status; int attrlen_offset; - __be32 status; int err; struct nfsd4_compoundres *resp = rqstp->rq_resp; u32 minorversion = resp->cstate.minorversion; @@ -3730,11 +3737,9 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, #endif if (bmval2 & FATTR4_WORD2_XATTR_SUPPORT) { - p = xdr_reserve_space(xdr, 4); - if (!p) - goto out_resource; - err = xattr_supports_user_prefix(d_inode(dentry)); - *p++ = cpu_to_be32(err == 0); + status = nfsd4_encode_fattr4_xattr_support(xdr, &args); + if (status != nfs_ok) + goto out; } *attrlen_p = cpu_to_be32(xdr->buf->len - attrlen_offset - XDR_UNIT);