git: 150da1e3cd51 - main - nfscl: Partially revert commit 867c27c23a5c

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Thu, 16 Dec 2021 22:33:56 UTC
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=150da1e3cd51e552f7d6bc159b387e540c5a3733

commit 150da1e3cd51e552f7d6bc159b387e540c5a3733
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-12-16 22:30:37 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-12-16 22:30:37 +0000

    nfscl: Partially revert commit 867c27c23a5c
    
    Commit 867c27c23a5c enabled the n_directio_opens code
    in open/close, which sets/clears NNONCACHE, for
    IO_APPEND. This code should not be enabled unless
    newnfs_directio_enable is non-zero.
    
    This patch reverts that part of commit 867c27c23a5c.
    
    A future patch that fixes the case where the
    file that is being written IO_APPEND is mmap()'d.
    
    MFC after:      3 months
---
 sys/fs/nfsclient/nfs_clvnops.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index db2ef26a77c6..ba2ba27b8fb6 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -709,8 +709,8 @@ nfs_open(struct vop_open_args *ap)
 	/*
 	 * If the object has >= 1 O_DIRECT active opens, we disable caching.
 	 */
-	if (vp->v_type == VREG && ((newnfs_directio_enable && (fmode &
-	    O_DIRECT)) || (fmode & O_APPEND))) {
+	if (newnfs_directio_enable && (fmode & O_DIRECT) &&
+	    (vp->v_type == VREG)) {
 		if (np->n_directio_opens == 0) {
 			NFSUNLOCKNODE(np);
 			if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
@@ -967,11 +967,11 @@ nfs_close(struct vop_close_args *ap)
 			error = nfscl_maperr(ap->a_td, error, (uid_t)0,
 			    (gid_t)0);
 	}
-	if (vp->v_type == VREG && ((newnfs_directio_enable && (fmode &
-	    O_DIRECT)) || (fmode & O_APPEND))) {
+	if (newnfs_directio_enable)
 		KASSERT((np->n_directio_asyncwr == 0),
 			("nfs_close: dirty unflushed (%d) directio buffers\n",
 			 np->n_directio_asyncwr));
+	if (newnfs_directio_enable && (fmode & O_DIRECT) && (vp->v_type == VREG)) {
 		NFSLOCKNODE(np);
 		KASSERT((np->n_directio_opens > 0), 
 			("nfs_close: unexpectedly value (0) of n_directio_opens\n"));