From nobody Wed Feb 15 18:57:44 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PH6lY0cXSz3rC1P; Wed, 15 Feb 2023 18:57:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PH6lX74nnz49sP; Wed, 15 Feb 2023 18:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676487465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M+fUdq0PDXwS+rTT6mo/7rmHZN86YpTM6hwj/DSlUNk=; b=qHIwjFHccWW5UrAjLkT3CvZoMPnGGiVlJqmrcQaYJRM0+741MH4zldIyGHngIzGJJ5fbUu s6sVVIaQBfDKlPtT6CnsaZY2Px4xsvF/hIDBS7EWQ1CXX3pN86cUJ1/caMrCk7ch0wEdnt MmlI5mfj5TZ1cr92wK9Ef5pYbcaMXNsb5+9hzm+zTPdyQEjKBW5khRsaaOxuvzdcgd9I4T bHxzD7XfBl44JvDdemIRR5wVKDjE2xBN5b5GK4Ejnu6I+Py6OknTBKV2KsQ20HdlH7iei9 vtTlX9Pz2CI7HT9tLxh5W2RLyRB3qDa/hH5UIpgnrN3IAhZhXMWBjhW8McJrZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676487465; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M+fUdq0PDXwS+rTT6mo/7rmHZN86YpTM6hwj/DSlUNk=; b=ZzD2g/OlREy+JduLjpZr5k6NbNosAfs9XPQ10QOXnR6rav4uLPABrReXopeiiVPxXEBXYk dkzTG8k8VZdwETfhH07xwt2h92lBPYbtCtWHDyrVxpjvI/VaHoxA2mMjtzbD3qNa2ZgO+q wT/FDvMcI4xDxsuOWbqlB88fWIt0rMU54a4owbwci3pFTZ8ZIhp/UCwWWOxPnOIXB5njqU gOEQ6uesD6Jr5+inxIs2eCmaJwNhBM03S9E5VWfcoHI9cdoV6XJ9qi5Gk9J+pmosDu+eu+ IbsWl6V3CHjcJvhkgGD24p65omJDEB9xNXihy3Ib0OKYuIxbEi5x8tLwdc08uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676487465; a=rsa-sha256; cv=none; b=GuD29hBL7KXK/CRM6wrrbwDuoLbPRExpiT2HbN4U7luOn/0bsBCcYyC+DCgSNXC1KQX5tD bDR71WhpEuLu6C/r0bjyGSKveMiouS40cT2cGLBD31CMVLUi2w5kg/KWA8uwea2h+u3Weg FUmmyA4AkflS1nmEMcs4GindIzCscmad6v1ku7czIYLbiNWp4hKvrcvA10cKcBxee1s8Ka aNed6Uj4vP3WGQUgxelyAGtch4p2jWZTyIc+fN7CvbWrV36mSpl1e7BcT1pjLap2J8mgab QlPnIN3XX9eI2PFO6q1o1sG9JoBgIgSt+Fc33La7uwCMlkQinM7BvrQ+nALvyg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PH6lX61z6zZmr; Wed, 15 Feb 2023 18:57:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31FIvi7b088712; Wed, 15 Feb 2023 18:57:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31FIviE9088711; Wed, 15 Feb 2023 18:57:44 GMT (envelope-from git) Date: Wed, 15 Feb 2023 18:57:44 GMT Message-Id: <202302151857.31FIviE9088711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 40734fc57ec0 - main - aio: Fix a test and set race in aio_biowakeup. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 40734fc57ec0158690e9f03284229553b050b8ea Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=40734fc57ec0158690e9f03284229553b050b8ea commit 40734fc57ec0158690e9f03284229553b050b8ea Author: Keith Reynolds AuthorDate: 2023-02-15 18:56:39 +0000 Commit: John Baldwin CommitDate: 2023-02-15 18:56:39 +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 --- 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 43e54e1ad9bf..34671f67191f 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -2493,10 +2493,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