Date: Tue, 04 Jul 2023 18:37:37 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 272367] openat(..., O_NONBLOCK | O_EXLOCK) may wrongly return EAGAIN Message-ID: <bug-272367-227-q2voB27J2a@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-272367-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272367 Mateusz Guzik <mjg@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mjg@FreeBSD.org --- Comment #1 from Mateusz Guzik <mjg@FreeBSD.org> --- Quick look suggests this is about the P_ADVLOCK flag, which to my reading is not being set for the child. Then fdclosexec -> ... -> closef fails to take action here: if (fp->f_type == DTYPE_VNODE) { vp = fp->f_vnode; if ((td->td_proc->p_leader->p_flag & P_ADVLOCK) != 0) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; lf.l_type = F_UNLCK; (void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader, F_UNLCK, &lf, F_POSIX); } I don't know what the real semantics are supposed to be here. If any close by *anyone* is supposed to do the unlock, then this should be patched to something like this: diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 908c3352514b..fc03137f6c24 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -2790,7 +2790,7 @@ closef(struct file *fp, struct thread *td) */ if (fp->f_type == DTYPE_VNODE) { vp = fp->f_vnode; - if ((td->td_proc->p_leader->p_flag & P_ADVLOCK) != 0) { + if ((fp->f_flag & FHASLOCK) != 0) { lf.l_whence = SEEK_SET; lf.l_start = 0; lf.l_len = 0; -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272367-227-q2voB27J2a>
