Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2025 22:20:31 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1a0cb938f7b4 - main - unlink, rmdir: call notify_upper from VOP pre method instead of syscall
Message-ID:  <202502042220.514MKV6Y063988@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

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

commit 1a0cb938f7b461edc40316cb44a80438df674174
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-02-04 00:23:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-02-04 22:19:50 +0000

    unlink, rmdir: call notify_upper from VOP pre method instead of syscall
    
    Suppose that there are two or more nullfs mounts over some fs, and
    suppose the we unlink a file on one of the nullfs mount.
    This way notify_upper get called from the lower vnode as well, allowing
    the other nullfs mounts to note that and drop their caches for the
    unlinked vnode.
    
    PR:     254210
    Reviewed by:    olce
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D48825
---
 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 ef51fdba8e7c..9e9b56064ecf 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -6224,6 +6224,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);
 }
@@ -6292,6 +6293,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 bbd67c2b0326..41609d7c5351 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2034,7 +2034,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:
@@ -4002,7 +4001,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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502042220.514MKV6Y063988>