git: ab87c39c257e - main - nfscl: Set n_localmodtime in Deallocate

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Sat, 30 Oct 2021 23:49:27 UTC
The branch main has been updated by rmacklem:

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

commit ab87c39c257e7130677867f8e5c11a3ec53fa1bc
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-10-30 23:46:14 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-10-30 23:46:14 +0000

    nfscl: Set n_localmodtime in Deallocate
    
    Commit 2be417843a04 added n_localmodtime, which is used by Lookup
    and ReaddirPlus to check to see if the file attributes in an RPC
    reply might be stale.  This patch sets n_localmodtime in Deallocate.
    Done as a separate commit, since Deallocate is not in stable/13.
    
    PR:     259071
    Reviewed by:    asomers
    Differential Revision:  https://reviews.freebsd.org/D32635
---
 sys/fs/nfsclient/nfs_clvnops.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index e8c713086717..f63eadf26a91 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -3767,6 +3767,7 @@ nfs_deallocate(struct vop_deallocate_args *ap)
 	off_t tlen, mlen;
 	int attrflag, error, ret;
 	bool clipped;
+	struct timespec ts;
 
 	error = 0;
 	attrflag = 0;
@@ -3809,6 +3810,10 @@ nfs_deallocate(struct vop_deallocate_args *ap)
 		if (error == 0) {
 			NFSCL_DEBUG(4, "dealloc: attrflag=%d na_size=%ju\n",
 			    attrflag, (uintmax_t)nfsva.na_size);
+			nanouptime(&ts);
+			NFSLOCKNODE(np);
+			np->n_localmodtime = ts;
+			NFSUNLOCKNODE(np);
 			if (attrflag != 0) {
 				if ((uint64_t)*ap->a_offset < nfsva.na_size)
 					*ap->a_offset += omin((off_t)