Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3227811imw; Mon, 11 Jul 2022 04:45:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vuLgEKQjiCuk71vP3/p9sGvsCSjTxSjNNWT7h+ytJU2c+BeWYwBuyluZg2gYa1wwOwWRAW X-Received: by 2002:a17:90b:4b10:b0:1f0:f81:5e33 with SMTP id lx16-20020a17090b4b1000b001f00f815e33mr14584601pjb.150.1657539939537; Mon, 11 Jul 2022 04:45:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657539939; cv=none; d=google.com; s=arc-20160816; b=mTgZz7HzuCv3xMBVGeuY81MGcDQB+ybkclOS8ohLfDWbfT/EKr/me95DxjsDSF/QYB ACIqMQyaSyrRElwYu5I+ZdAQ4EaTzsbgyQlJPQ6J4Ks+RJLR+c0VaVWsRkxQqco2eddQ BzNZ3WV6XrNiuxt4Or1s+qeTVxou32sob51yvJZxkrLcGwFzybvMgSuUtclUw9/C5RSB SOiKAkXzGUuagHyn1WfIUl6EpyJ0hvSKjSrZg0vrv+lGJpuGz5oyKCqYGngxho64Sutw 5qffRIUS1ot8CSUsnZgpGqz3BdFZFQoPna+jtXnXwOpzsxgQWOHnrx/mSq0ttrMdwQzk 2aAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=dyo4MQAWmbpvaesdFv5LAfUfaxRMlmW4IH88UKwEjrU=; b=CjZwZ8e4t8dNBvUJKqsYtVaCErcKF6EzOaAEW8NQIME5SR60JtHzHvTLd1hjUdjvli boGff5c/oxE6xndsJNYJTMX5kP8v7r3XkTIIuPY3jchpQlIm4CvxYAJZVX7rNxDW80rq 0XhRyMvWnwvjUzQhLrc0y+xHAs3KgWf+JwDdpEPQ0+a3EgYEMjS7W9dxrO5TfMhdG5dP 21yavT6CwzjflQYlL4OPALs7Q8oCifVoLyn0+02LwW+eaHcpCFReE+ot0onBdM9eOvwn 6cQpTvfuSgl8K3/u0o9FlWHILllhmx1XXqRKgK7ujftecpdjsqC1d0Z0H4OK8VD7mDRB CkYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P8a5F9r5; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h25-20020a635319000000b00408a759223fsi9339997pgb.776.2022.07.11.04.45.16; Mon, 11 Jul 2022 04:45:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P8a5F9r5; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbiGKLnC (ORCPT + 99 others); Mon, 11 Jul 2022 07:43:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231405AbiGKLmo (ORCPT ); Mon, 11 Jul 2022 07:42:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6824B5F46; Mon, 11 Jul 2022 04:36:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EB4ADB80ECA; Mon, 11 Jul 2022 11:36:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C9DCC34115; Mon, 11 Jul 2022 11:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657539414; bh=kF3naYkn9TsKaZxpNPMS3m1oJCrlOfY++NFPSnWbcjk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=P8a5F9r5XUQTZxeQBnSEB9XXLYdHMVXuux1hN/ka+MQ6Xe67ra0vQHidEgJ+AMn/E xdLwveOcrMKOFHhvp6QTopbVM9KW7qBIUgQhupCxdHy8/i+DQWtu48uPgjCeIZOhHZ //TbAEQWhLJxYrvTcCNyNwkS1l2cQGifpBWPTHnIFd5RtlWc5WknQ80Bz23saRPht2 AMUKOEkSx8YvcPI1WqRa0P5RDJnWVL6vuYDnVqsH7UKCdER1N0OgKGCDX3m/WpnnOQ IQcIX7DcBdbNInCTC4ksfs72e2jz/zbzWOrfPDjiMY/kX3B+HbIhk2t6JS6eef1Kys 7I3kGpTh0dMCg== Message-ID: <531053e36e291fc5d99bb766e76d52b0333ecc94.camel@kernel.org> Subject: Re: [PATCH v1] NFSD: Decode NFSv4 birth time attribute From: Jeff Layton To: Chuck Lever , imammedo@redhat.com Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 11 Jul 2022 07:36:52 -0400 In-Reply-To: <165747876458.1259.8334435718280903102.stgit@bazille.1015granger.net> References: <165747876458.1259.8334435718280903102.stgit@bazille.1015granger.net> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.3 (3.44.3-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sun, 2022-07-10 at 14:46 -0400, Chuck Lever wrote: > NFSD has advertised support for the NFSv4 time_create attribute > since commit e377a3e698fb ("nfsd: Add support for the birth time > attribute"). >=20 > Igor Mammedov reports that Mac OS clients attempt to set the NFSv4 > birth time attribute via OPEN(CREATE) and SETATTR if the server > indicates that it supports it, but since the above commit was > merged, those attempts now fail. >=20 > Table 5 in RFC 8881 lists the time_create attribute as one that can > be both set and retrieved, but the above commit did not add server > support for clients to provide a time_create attribute. IMO that's > a bug in our implementation of the NFSv4 protocol, which this commit > addresses. >=20 > Whether NFSD silently ignores the new birth time or actually sets it > is another matter. I haven't found another filesystem service in the > Linux kernel that enables users or clients to modify a file's birth > time attribute. >=20 > This commit reflects my (perhaps incorrect) understanding of whether > Linux users can set a file's birth time. NFSD will now recognize a > time_create attribute but it ignores its value. It clears the > time_create bit in the returned attribute bitmask to indicate that > the value was not used. >=20 > Reported-by: Igor Mammedov > Fixes: e377a3e698fb ("nfsd: Add support for the birth time attribute") > Signed-off-by: Chuck Lever > --- > fs/nfsd/nfs4xdr.c | 9 +++++++++ > fs/nfsd/nfsd.h | 3 ++- > 2 files changed, 11 insertions(+), 1 deletion(-) >=20 > diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c > index 61b2aae81abb..2acea7792bb2 100644 > --- a/fs/nfsd/nfs4xdr.c > +++ b/fs/nfsd/nfs4xdr.c > @@ -470,6 +470,15 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp,= u32 *bmval, u32 bmlen, > return nfserr_bad_xdr; > } > } > + if (bmval[1] & FATTR4_WORD1_TIME_CREATE) { > + struct timespec64 ts; > + > + /* No Linux filesystem supports setting this attribute. */ > + bmval[1] &=3D ~FATTR4_WORD1_TIME_CREATE; > + status =3D nfsd4_decode_nfstime4(argp, &ts); > + if (status) > + return status; > + } > if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { > u32 set_it; > =20 > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h > index 847b482155ae..9a8b09afc173 100644 > --- a/fs/nfsd/nfsd.h > +++ b/fs/nfsd/nfsd.h > @@ -465,7 +465,8 @@ static inline bool nfsd_attrs_supported(u32 minorvers= ion, const u32 *bmval) > (FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL) > #define NFSD_WRITEABLE_ATTRS_WORD1 \ > (FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \ > - | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_MODIFY_SET) > + | FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_CREATE \ > + | FATTR4_WORD1_TIME_MODIFY_SET) > #ifdef CONFIG_NFSD_V4_SECURITY_LABEL > #define MAYBE_FATTR4_WORD2_SECURITY_LABEL \ > FATTR4_WORD2_SECURITY_LABEL >=20 >=20 RFC5661 lists time_create as being writeable, so silently ignoring it seems wrong. It seems like we ought to have nfsd attempt to set the btime and then just return an error if it doesn't work...but, I don't see a mechanism in the kernel for setting it. ATTR_BTIME doesn't exist, for instance. Still, since we can't set it, returning an error there seems more correct. NFS4ERR_INVAL is probably the wrong one -- maybe NFS4ERR_NOTSUPP ? It's a bit weird since we do support querying it, but not setting it. Maybe we need to propose a new NFS4ERR_ATTR_RO ? --=20 Jeff Layton