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/> References: <bug-272367-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272367 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 =3D=3D DTYPE_VNODE) { vp =3D fp->f_vnode; if ((td->td_proc->p_leader->p_flag & P_ADVLOCK) !=3D 0) { lf.l_whence =3D SEEK_SET; lf.l_start =3D 0; lf.l_len =3D 0; lf.l_type =3D F_UNLCK; (void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_lead= er, 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 somet= hing 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 =3D=3D DTYPE_VNODE) { vp =3D fp->f_vnode; - if ((td->td_proc->p_leader->p_flag & P_ADVLOCK) !=3D 0) { + if ((fp->f_flag & FHASLOCK) !=3D 0) { lf.l_whence =3D SEEK_SET; lf.l_start =3D 0; lf.l_len =3D 0; --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272367-227-q2voB27J2a>