Page MenuHomeFreeBSD

D46465.diff
No OneTemporary

D46465.diff

diff --git a/sys/kern/kern_rangelock.c b/sys/kern/kern_rangelock.c
--- a/sys/kern/kern_rangelock.c
+++ b/sys/kern/kern_rangelock.c
@@ -82,6 +82,24 @@
#define RL_RET_CHEAT_RLOCKED 0x1100
#define RL_RET_CHEAT_WLOCKED 0x2200
+static void
+rangelock_cheat_drain(struct rangelock *lock)
+{
+ uintptr_t v;
+
+ DROP_GIANT();
+ for (;;) {
+ v = (uintptr_t)atomic_load_ptr(&lock->head);
+ if ((v & RL_CHEAT_DRAINING) == 0)
+ break;
+ sleepq_add(&lock->head, NULL, "ranged1", 0, 0);
+ sleepq_wait(&lock->head, PRI_USER);
+ sleepq_lock(&lock->head);
+ }
+ sleepq_release(&lock->head);
+ PICKUP_GIANT();
+}
+
static bool
rangelock_cheat_lock(struct rangelock *lock, int locktype, bool trylock,
void **cookie)
@@ -99,17 +117,7 @@
}
sleepq_lock(&lock->head);
drain1:
- DROP_GIANT();
- for (;;) {
- v = (uintptr_t)atomic_load_ptr(&lock->head);
- if ((v & RL_CHEAT_DRAINING) == 0)
- break;
- sleepq_add(&lock->head, NULL, "ranged1", 0, 0);
- sleepq_wait(&lock->head, PRI_USER);
- sleepq_lock(&lock->head);
- }
- sleepq_release(&lock->head);
- PICKUP_GIANT();
+ rangelock_cheat_drain(lock);
return (false);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 12, 10:44 AM (21 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15768609
Default Alt Text
D46465.diff (1 KB)

Event Timeline