Date: Tue, 1 Dec 2020 22:53:33 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368265 - head/sys/kern Message-ID: <202012012253.0B1MrXmL028986@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Dec 1 22:53:33 2020 New Revision: 368265 URL: https://svnweb.freebsd.org/changeset/base/368265 Log: lio_listio(2): send signal even if number of jobs is zero. Right now, if lio registered zero jobs, syscall frees lio job structure, cleaning up queued ksi. As result, the realtime signal is dequeued and never delivered. Fix it by allowing sendsig() to copy ksi when job count is zero. PR: 220398 Reported and reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27421 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Dec 1 22:46:51 2020 (r368264) +++ head/sys/kern/vfs_aio.c Tue Dec 1 22:53:33 2020 (r368265) @@ -466,7 +466,7 @@ aio_init_aioinfo(struct proc *p) } static int -aio_sendsig(struct proc *p, struct sigevent *sigev, ksiginfo_t *ksi) +aio_sendsig(struct proc *p, struct sigevent *sigev, ksiginfo_t *ksi, bool ext) { struct thread *td; int error; @@ -477,7 +477,7 @@ aio_sendsig(struct proc *p, struct sigevent *sigev, ks if (!KSI_ONQ(ksi)) { ksiginfo_set_sigev(ksi, sigev); ksi->ksi_code = SI_ASYNCIO; - ksi->ksi_flags |= KSI_EXT | KSI_INS; + ksi->ksi_flags |= ext ? (KSI_EXT | KSI_INS) : 0; tdsendsignal(p, td, ksi->ksi_signo, ksi); } PROC_UNLOCK(p); @@ -896,7 +896,7 @@ aio_bio_done_notify(struct proc *userp, struct kaiocb if (job->uaiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL || job->uaiocb.aio_sigevent.sigev_notify == SIGEV_THREAD_ID) - aio_sendsig(userp, &job->uaiocb.aio_sigevent, &job->ksi); + aio_sendsig(userp, &job->uaiocb.aio_sigevent, &job->ksi, true); KNOTE_LOCKED(&job->klist, 1); @@ -909,7 +909,8 @@ aio_bio_done_notify(struct proc *userp, struct kaiocb == LIOJ_SIGNAL && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { - aio_sendsig(userp, &lj->lioj_signal, &lj->lioj_ksi); + aio_sendsig(userp, &lj->lioj_signal, &lj->lioj_ksi, + true); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } @@ -2238,7 +2239,8 @@ kern_lio_listio(struct thread *td, int mode, struct ai LIOJ_SIGNAL_POSTED)) == LIOJ_SIGNAL && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { - aio_sendsig(p, &lj->lioj_signal, &lj->lioj_ksi); + aio_sendsig(p, &lj->lioj_signal, &lj->lioj_ksi, + lj->lioj_count != 1); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012012253.0B1MrXmL028986>