git: cba91bf59c79 - stable/14 - unlink, rmdir: call notify_upper from VOP pre method instead of syscall

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 11 Feb 2025 01:11:55 UTC
The branch stable/14 has been updated by kib:

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

commit cba91bf59c79eadc3b60b83fe2185116496f08fb
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-02-04 00:23:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-02-11 01:11:49 +0000

    unlink, rmdir: call notify_upper from VOP pre method instead of syscall
    
    PR:     254210
    
    (cherry picked from commit 1a0cb938f7b461edc40316cb44a80438df674174)
---
 sys/kern/vfs_subr.c     | 2 ++
 sys/kern/vfs_syscalls.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 729741ea901f..5a0a7f9161ed 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -6157,6 +6157,7 @@ vop_remove_pre(void *ap)
 	a = ap;
 	dvp = a->a_dvp;
 	vp = a->a_vp;
+	vfs_notify_upper(vp, VFS_NOTIFY_UPPER_UNLINK);
 	vn_seqc_write_begin(dvp);
 	vn_seqc_write_begin(vp);
 }
@@ -6225,6 +6226,7 @@ vop_rmdir_pre(void *ap)
 	a = ap;
 	dvp = a->a_dvp;
 	vp = a->a_vp;
+	vfs_notify_upper(vp, VFS_NOTIFY_UPPER_UNLINK);
 	vn_seqc_write_begin(dvp);
 	vn_seqc_write_begin(vp);
 }
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 45a9a0c2bd48..17ab419fb0ae 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1996,7 +1996,6 @@ restart:
 		if (error != 0)
 			goto out;
 #endif
-		vfs_notify_upper(vp, VFS_NOTIFY_UPPER_UNLINK);
 		error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
 #ifdef MAC
 out:
@@ -3964,7 +3963,6 @@ restart:
 			goto fdout;
 		goto restart;
 	}
-	vfs_notify_upper(vp, VFS_NOTIFY_UPPER_UNLINK);
 	error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
 	vn_finished_write(mp);
 out: