aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2025-02-04 00:23:05 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2025-02-04 22:19:50 +0000
commit1a0cb938f7b461edc40316cb44a80438df674174 (patch)
treed36600ea3ca519286d31e0f865dc5ab6983a5b87
parentf16ca171eaad70563872f61042eccd2971da572f (diff)
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
-rw-r--r--sys/kern/vfs_subr.c2
-rw-r--r--sys/kern/vfs_syscalls.c2
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: