From nobody Sun Oct 16 20:28:25 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MrBXT4hDWz4g1Sr; Sun, 16 Oct 2022 20:28:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MrBXT3wqjz3H7S; Sun, 16 Oct 2022 20:28:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665952105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I42YWJ50rBAnTBgFIkyow4mraOXexwXwFQmxSA920d8=; b=LXXoVYV58UGgtpHIRC4owM9Y8HfirV689SvlCi/URWSbDKmixpEXkhIaVjXHCUc5bkLrVZ 0PH9oWJlLgqoob5g1z5Vj/CCKvo9uliZOcc3z/jG5yflWYixDQUD+1wy43F62M/w2vG0D4 bTFwCAQr8NkXL/s+5o/6aZxjwB/ViOMVFO9izxR2YIqlKgy9ZbDNgPh8uRhwi/UmZqwPHe ouxPMCs/uhH304D0qf7sxwBDTTcrMizYCHOAqvy9qCTXxqkCow6jxE/S07VDGERBfcpv4F hLAwVjQYWgeTrMfOAMhGF1tPwzUao8fwv/aHbSJZmxsTC/mcA28wSGOx3pR3Gw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MrBXT2vjDzZwp; Sun, 16 Oct 2022 20:28:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29GKSPhn070170; Sun, 16 Oct 2022 20:28:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29GKSP0d070169; Sun, 16 Oct 2022 20:28:25 GMT (envelope-from git) Date: Sun, 16 Oct 2022 20:28:25 GMT Message-Id: <202210162028.29GKSP0d070169@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 8063dc03202f - main - nfsd: Make Setxattr/Removexattr NFSv4.2 ops IO_SYNC List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8063dc03202fad7d6bdf34976bc8556fa3f23fa1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665952105; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I42YWJ50rBAnTBgFIkyow4mraOXexwXwFQmxSA920d8=; b=TLRUYCt7um5oFjGsQLGDDuZZVy6X8LOinHVwZsRN4qe837GjBewynxJcjP3FumLyiPlI24 sAyXk5VcdrYdqGyGTQHU6ubPZuPnSJQklwIMSxbzcZmQd6T5pegvQWby7nprApZ1/D+61d AF+selfZmttzuTcGMVnRDWt4g/gMCg14QcRSaShoA4ShUmSlVXDrnoiTfIT9NpVCOpvFW0 dpTV2wOjl+Qdqk3tairIC7CaZNmgArrqZHOxwBB7cGSAOeji6bCxU4+5kxydVZnJnxQIFn Tv/x9U6ecLgKsgD2leyPfxMEvICWISkgciSmbTlipCecmbZA/Q0+6PE0yoAw6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665952105; a=rsa-sha256; cv=none; b=ZRDF6p6BzT7dD9OCguZZa6o2JD++ySzLAd6Cqws+HMtwyjarJG9/IstsdXyny1rrIAPh+I Cm0Vea5ibgJvd774mG/7cfklOoL9SRt1AdJ5q7TORqP6hcjFhYxHEFsafvKJGKtgAoWDZ6 lPU1yt7Pijf1rbJOq4BqYNU1v/shgivvEqv1LemReaC0VKRlaFvGhRBPIKehWqyKBtnFZA VNG5BY27NfEtiZrP7nuVCW124CroXf+Bagx9RY+uWNyblneqkRZLzV9kEwNIPAlWWe/yfk w6hlRTyKMUWUtTQpcVM02Ba4ESIz3wVC34CJPYsasTgWoCC1vKjMJacqAX50+g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=8063dc03202fad7d6bdf34976bc8556fa3f23fa1 commit 8063dc03202fad7d6bdf34976bc8556fa3f23fa1 Author: Rick Macklem AuthorDate: 2022-10-16 20:27:32 +0000 Commit: Rick Macklem CommitDate: 2022-10-16 20:27:32 +0000 nfsd: Make Setxattr/Removexattr NFSv4.2 ops IO_SYNC When the NFS server does Setxattr or Removexattr, the operations must be done IO_SYNC. If a server crashes/reboots immediately after replying it must have the extended attribute changes. Since UFS does extended attributes asynchronously by default and there is no "ioflag" argument in the VOP calls, follow the VOP calls with VOP_FSYNC(), to ensure the operation has been done synchronously. This was found by inspection while investigating a bug discovered during a recent IETF NFSv4 testing event, where the Change attribute wasn't changed in the operation reply. This bug will take further work for ZFS and the pNFS server configuration, but is now fixed for a non-pNFS UFS exported file system. MFC after: 1 month --- sys/fs/nfsserver/nfs_nfsdport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 8e15237bc10c..f7a97ef04018 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -6776,6 +6776,8 @@ nfsvno_setxattr(struct vnode *vp, char *name, int len, struct mbuf *m, if (error == 0) { error = VOP_SETEXTATTR(vp, EXTATTR_NAMESPACE_USER, name, uiop, cred, p); + if (error == 0) + error = VOP_FSYNC(vp, MNT_WAIT, p); free(iv, M_TEMP); } @@ -6811,6 +6813,8 @@ nfsvno_rmxattr(struct nfsrv_descript *nd, struct vnode *vp, char *name, if (error == EOPNOTSUPP) error = VOP_SETEXTATTR(vp, EXTATTR_NAMESPACE_USER, name, NULL, cred, p); + if (error == 0) + error = VOP_FSYNC(vp, MNT_WAIT, p); out: NFSEXITCODE(error); return (error);