git: 0de4895aac4e - main - Fix pjfstest issue tests/rename/23.t

From: Fedor Uporov <fsu_at_FreeBSD.org>
Date: Sun, 29 Jan 2023 08:19:31 UTC
The branch main has been updated by fsu:

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

commit 0de4895aac4ef86dcde43ec8c992b8abd1a3fcbf
Author:     Fedor Uporov <fsu@FreeBSD.org>
AuthorDate: 2023-01-26 10:23:22 +0000
Commit:     Fedor Uporov <fsu@FreeBSD.org>
CommitDate: 2023-01-29 08:12:32 +0000

    Fix pjfstest issue tests/rename/23.t
    
    This test creates two files like file0 and file1,
    then creates link to file1 and checks ctime on it.
    Then renames file0 to file1. Then checks ctime on
    link again. It is expected, that second ctime will
    be higher then first ctime, because rename happen.
    Add ctime updating for directory entry,
    which will be deleted on rename.
    
    Reviewed by:    kib
    MFC after:      2 week
    Differential revision:  https://reviews.freebsd.org/D38051
---
 sys/fs/tmpfs/tmpfs_vnops.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index da934338948b..6a58ffdc0f4b 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -1233,6 +1233,10 @@ tmpfs_rename(struct vop_rename_args *v)
 		tde = tmpfs_dir_lookup(tdnode, tnode, tcnp);
 		tmpfs_dir_detach(tdvp, tde);
 
+		/* Update node's ctime because of possible hardlinks. */
+		tnode->tn_status |= TMPFS_NODE_CHANGED;
+		tmpfs_update(tvp);
+
 		/*
 		 * Free the directory entry we just deleted.  Note that the
 		 * node referred by it will not be removed until the vnode is