Date: Wed, 6 Sep 2023 21:56:37 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 5febbe8a14ca - stable/13 - aio: Fix a test and set race in aio_biowakeup. Message-ID: <202309062156.386Lub2k022625@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5febbe8a14ca293f031236a77054f734b1ff5b7e commit 5febbe8a14ca293f031236a77054f734b1ff5b7e Author: Keith Reynolds <keith.reynolds@hpe.com> AuthorDate: 2023-02-15 18:56:39 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-09-06 21:56:09 +0000 aio: Fix a test and set race in aio_biowakeup. Use atomic_fetchadd in place of separate atomic_subtract / atomic_load. Reviewed by: markj Sponsored by: HPE TidalScale Differential Revision: https://reviews.freebsd.org/D38559 (cherry picked from commit 40734fc57ec0158690e9f03284229553b050b8ea) --- sys/kern/vfs_aio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 5ffc0b31c2ae..7ca0848c5f46 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -2491,10 +2491,9 @@ aio_biowakeup(struct bio *bp) atomic_add_int(&job->outblock, nblks); else atomic_add_int(&job->inblock, nblks); - atomic_subtract_int(&job->nbio, 1); - if (atomic_load_int(&job->nbio) == 0) { + if (atomic_fetchadd_int(&job->nbio, -1) == 1) { if (atomic_load_int(&job->error)) aio_complete(job, -1, job->error); else
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309062156.386Lub2k022625>