From nobody Wed Aug 21 15:21:45 2024 X-Original-To: dev-commits-src-main@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 4Wpqn55xH3z5V2ll; Wed, 21 Aug 2024 15:21: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wpqn556Lhz4PQb; Wed, 21 Aug 2024 15:21:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724253705; 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=jpm0RI4+l9SbmBbep6YBVwItOcV/NZrjpXfIL4G2hFs=; b=X8AwhCkgPIDco7YtNxO13/1UAGGeQo7z84O9JoiPdxYFjqlZyiVbVcKc6Qg7qhrqXGRyvs iKNVVPErYBZpEbSn2OWJ0zOxu8gLlcg8ZEezltXkYh9E7SrNwkroXXdIgWehda4PSEE1kZ V7wy6f+RHd1K26+E124mroQt8CRV0SPe3KpKEYVo4BcmdRDjyHF8/zImuwjdARrw+9VTp/ rkmN0ZNcUt8jfUFLnulVs6W8yLwzgDOyjSFr36yVuLsJCtZzd2+o81ZvAL2l5ukrBfpkW4 n9YZEBPXXVuX/BNyKrkvv1i9qwwuH05dmRjogXbkNIwVdYIFKs71Sks4RwlbKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724253705; a=rsa-sha256; cv=none; b=wuQrxyd7coCmngovPAmNND+jQifXJRyoirhOQuHopNFa6HxCyImm304dEg15NbVeqg/TXh nE/e0PBPlEX1reEZe4Z7wkkg/rO6zSve2q3lftmAt1X0yeFXMKemFuk/d6uJFPW//tTlfs XQTiqc2OEl/o6NY4t8RjJZGVJkDAlGTD+L1TzxWs/ipCXs2ZeVNWKfBxG4LDToxvlv/I+v pxDrL9UbI2UpqZMccU8Z3GdMDArDLNmE8KetpMhzyV0vPfL2kpqHwuAFAELa++BpyBPZnH KHvOWVSy90x9uT4LIaCmdPrZER48TFdAtEm6W6SkT4WCIq9fpZlVW6HY4ashKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724253705; 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=jpm0RI4+l9SbmBbep6YBVwItOcV/NZrjpXfIL4G2hFs=; b=xua8h+WYnGWnAujhsWKSqauI4twgdWGgsc802QKknzhihYEkMjNqikzVQWkv0Kqjm98O0M /04iBNjRtYHmRIAAyquxrGHDbgO/wtFsHP4FS7mtteyYzYsdkyePxvsNKuuqRnJs2KeTmf s3gr8XnDd/mcrsomLWwwi5ExjeMlP5vc5TjZCVso3Fa3IC81UdZ5hAmseT6kFEgQsI3M1n FE9xXa4mqYlqqaAqYXzCAMshFaFpuV8hZUPqDFyUfXc8lzrSmOr2PYiSOlhig4GkZFp55Z RX5f6IGLe1GSUOlYhlRQ+/9sS4v0gKTwG0UfXfEu6UQy41ZSlk+Z3vtlIV5LMQ== 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 4Wpqn54l3Rzq6N; Wed, 21 Aug 2024 15:21:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47LFLjau067392; Wed, 21 Aug 2024 15:21:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47LFLjoa067389; Wed, 21 Aug 2024 15:21:45 GMT (envelope-from git) Date: Wed, 21 Aug 2024 15:21:45 GMT Message-Id: <202408211521.47LFLjoa067389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: c4d8b2462e77 - main - rangelocks: recheck that entry is not marked after sleepq is locked in rl_w_validate() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c4d8b2462e771e409d29df5545cbfb8465673818 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c4d8b2462e771e409d29df5545cbfb8465673818 commit c4d8b2462e771e409d29df5545cbfb8465673818 Author: Konstantin Belousov AuthorDate: 2024-08-20 12:59:35 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-21 15:19:57 +0000 rangelocks: recheck that entry is not marked after sleepq is locked in rl_w_validate() otherwise we might loose the wakeup. Reported and tested by: markj Sponsored by: The FreeBSD Foundation --- sys/kern/kern_rangelock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c index d9042f364737..ef9d0104af72 100644 --- a/sys/kern/kern_rangelock.c +++ b/sys/kern/kern_rangelock.c @@ -609,6 +609,12 @@ again: continue; } sleepq_lock(&lock->sleepers); + /* Reload after sleepq is locked */ + next = rl_q_load(&cur->rl_q_next); + if (rl_e_is_marked(next)) { + sleepq_release(&lock->sleepers); + goto again; + } rangelock_unlock_int(lock, e); if (trylock) { sleepq_release(&lock->sleepers);