Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4167101pxu; Mon, 30 Nov 2020 20:16:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDsAD0PPL08IShTEPgOili+5q4UN+bUlFKE020A+NEQxSnJG/M3vVjF33EfTmvPYbCgaqr X-Received: by 2002:a05:6402:1a30:: with SMTP id be16mr1177949edb.124.1606796193881; Mon, 30 Nov 2020 20:16:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606796193; cv=none; d=google.com; s=arc-20160816; b=l4ocOI+rWv6FjvSj0iWPagpxvCjDslID1Scw2VIVXlcchc/viY45qvIAtAruzAEnsa mtnaZNswgKOh/979rRfSkWx894G0+vXeH1GNEpTEc8dJt/bKlhHYq+s3sIvm0eUQXee/ SmxAiuH7CyGcUxyu0BUJdN5vnTK53qEqflhJVYL7NAJg6Oyd4HwTs8qjF8VKC9mVeDPR CGw2nI7t8skziQrzYYS96e/ASFqA/5pPR6EknWaBHwYscE1So49Y8cM/ANRHlfA5sBwP fEDnEUfYalpOBCT9FblqNGfDzRqmeJYt55P6nRLNwn5pEA1q8iDVg4UWYnGP2hR0dAPU LxgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=h/xsIqsauAkfVVpTRCPrmhDX8IXQZOJzUD+8DicPJ9I=; b=K8tI373NAGRdiJL6JKgIVxJjVkpl/qqErRmAIKMHKHthmeDuJGibm7P3fHU9u6MzWb qfvWaRPkjHAk32UYQ7nuylkD5Z4kGafUuQvj6vSROCbScBfSyYn3kD/VODbaHE4gakUO V6GD9+XzECsP6Xgir3J7HqNzBOPoaRkx77r2mwtaTa1Eydf2K6fHnWKu7bz0SRnxcIGj C+l+CUlKSXZntvDEKkSqAfDieEjgetcuCA08N8INahiCc9sD9g9JQwpnHVKKvSVNNTIj kBwQvRrw4gOoSDsW/n6Ijqla2rA6GPjzj/BAwiV5U4mw5AC/W2CIGL9b7C8Q+K33bgrS 8Awg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xoWbJobG; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si198204ejz.504.2020.11.30.20.15.59; Mon, 30 Nov 2020 20:16:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xoWbJobG; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 S1727897AbgLAEPL (ORCPT + 99 others); Mon, 30 Nov 2020 23:15:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:60328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728074AbgLAEPL (ORCPT ); Mon, 30 Nov 2020 23:15:11 -0500 Received: from leira.hammer.space (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FC3020796; Tue, 1 Dec 2020 04:14:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606796070; bh=30/Gux9BYIPffwuYiqP91pLD0cwJa2h+MefqshpGaoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xoWbJobGUHoglK8leMVp8dgOKap1mXg0pN3Rc5kYK2Ok3x2hmh6rm0VXc5hrZ7s8Z nLWlmIc76ySWGsFFmVL2XJD+m9nOfTOxqskypfgr1Fj3zfizQsNeg4LGYB+UV0wYt8 HFC0NhX02XTOW7Y9ZJiTOFHSSUDX72SeoxBySe8M= From: trondmy@kernel.org To: "J. Bruce Fields" , Chuck Lever Cc: linux-nfs@vger.kernel.org Subject: [PATCH 2/2] nfsd: Record NFSv4 pre/post-op attributes as non-atomic Date: Mon, 30 Nov 2020 23:14:27 -0500 Message-Id: <20201201041427.756749-2-trondmy@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201201041427.756749-1-trondmy@kernel.org> References: <20201201041427.756749-1-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust For the case of NFSv4, specify to the client that the the pre/post-op attributes were not recorded atomically with the main operation. Signed-off-by: Trond Myklebust --- fs/nfs/export.c | 3 ++- fs/nfsd/nfsfh.c | 4 ++++ fs/nfsd/nfsfh.h | 5 +++++ fs/nfsd/xdr4.h | 2 +- include/linux/exportfs.h | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/nfs/export.c b/fs/nfs/export.c index 48b879cfe6e3..7412bb164fa7 100644 --- a/fs/nfs/export.c +++ b/fs/nfs/export.c @@ -172,5 +172,6 @@ const struct export_operations nfs_export_ops = { .fh_to_dentry = nfs_fh_to_dentry, .get_parent = nfs_get_parent, .flags = EXPORT_OP_NOWCC|EXPORT_OP_NOSUBTREECHK| - EXPORT_OP_CLOSE_BEFORE_UNLINK|EXPORT_OP_REMOTE_FS, + EXPORT_OP_CLOSE_BEFORE_UNLINK|EXPORT_OP_REMOTE_FS| + EXPORT_OP_NOATOMIC_ATTR, }; diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index e80a7525561d..66f2ef67792a 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -301,6 +301,10 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) fhp->fh_export = exp; switch (rqstp->rq_vers) { + case 4: + if (dentry->d_sb->s_export_op->flags & EXPORT_OP_NOATOMIC_ATTR) + fhp->fh_no_atomic_attr = true; + break; case 3: if (dentry->d_sb->s_export_op->flags & EXPORT_OP_NOWCC) fhp->fh_no_wcc = true; diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index 347d10aa6265..cb20c2cd3469 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h @@ -36,6 +36,11 @@ typedef struct svc_fh { bool fh_locked; /* inode locked by us */ bool fh_want_write; /* remount protection taken */ bool fh_no_wcc; /* no wcc data needed */ + bool fh_no_atomic_attr; + /* + * wcc data is not atomic with + * operation + */ int fh_flags; /* FH flags */ #ifdef CONFIG_NFSD_V3 bool fh_post_saved; /* post-op attrs saved */ diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index b4556e86e97c..a60ff5ce1a37 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h @@ -748,7 +748,7 @@ static inline void set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) { BUG_ON(!fhp->fh_pre_saved); - cinfo->atomic = (u32)fhp->fh_post_saved; + cinfo->atomic = (u32)(fhp->fh_post_saved && !fhp->fh_no_atomic_attr); cinfo->before_change = fhp->fh_pre_change; cinfo->after_change = fhp->fh_post_change; diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index d93e8a6737bb..9f4d4bcbf251 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -217,6 +217,9 @@ struct export_operations { #define EXPORT_OP_NOSUBTREECHK (0x2) /* no subtree checking */ #define EXPORT_OP_CLOSE_BEFORE_UNLINK (0x4) /* close files before unlink */ #define EXPORT_OP_REMOTE_FS (0x8) /* Filesystem is remote */ +#define EXPORT_OP_NOATOMIC_ATTR (0x10) /* Filesystem cannot supply + atomic attribute updates + */ unsigned long flags; }; -- 2.28.0