From 5d0ebfe1d97801518755c7025f57ba7d5bf1c8db Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 4 Jun 2026 20:53:26 +0300 Subject: [PATCH] renameat(2): when retrying, check for pending signals The vn_start_write() call there is already interruptible. Check for user signals before restarting due to ERELOOKUP, or after failed vn_start_write(). Note that vn_start_write(V_XSLEEP | V_PCATCH) does not check for signals if not sleeping. PR: 295826 Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57453 --- sys/kern/vfs_syscalls.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 0c4eeb584d4..71d37e08c65 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3855,6 +3855,9 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, vfs_rel(tmp); tmp = NULL; } + error = sig_intr(); + if (error != 0) + return (error); error = vn_start_write(NULL, &mp, V_XSLEEP | V_PCATCH); if (error != 0) return (error); @@ -3937,8 +3940,11 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, out1: if (error == ERESTART) return (0); - if (error == ERELOOKUP) - goto again; + if (error == ERELOOKUP) { + error = sig_intr(); + if (error == 0) + goto again; + } return (error); }