git: e6651546c2dd - main - rangelock: Fix an off-by-one error

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 20:38:05 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6651546c2dd72e028b9422f1695c432dbf47d75

commit e6651546c2dd72e028b9422f1695c432dbf47d75
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-27 20:29:18 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-08-27 20:35:08 +0000

    rangelock: Fix an off-by-one error
    
    A rangelock entry covers the range [start, end), so entries e1 and e2
    with e1->end == e2->start do not overlap.
    
    PR:             281073
    Fixes:          5badbeeaf061 ("Re-implement rangelocks part 2")
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D46458
---
 sys/kern/kern_rangelock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c
index e3bb413ab1bb..14163dd1c782 100644
--- a/sys/kern/kern_rangelock.c
+++ b/sys/kern/kern_rangelock.c
@@ -544,7 +544,7 @@ again:
 	cur = rl_q_load(prev);
 	MPASS(!rl_e_is_marked(cur));	/* nobody can unlock e yet */
 	for (;;) {
-		if (cur == NULL || cur->rl_q_start > e->rl_q_end)
+		if (cur == NULL || cur->rl_q_start >= e->rl_q_end)
 			return (RL_LOCK_SUCCESS);
 		next = rl_q_load(&cur->rl_q_next);
 		if (rl_e_is_marked(next)) {