Download raw body.
rwlocks don't need to provide RW_SLEEPFAIL anymore
nothing uses it. the few things that did use it were too tricky, so i'm
not keen to leave it around for people to cause confusion with in the
future.
ok?
Index: share/man/man9/rwlock.9
===================================================================
RCS file: /cvs/src/share/man/man9/rwlock.9,v
diff -u -p -r1.27 rwlock.9
--- share/man/man9/rwlock.9 29 Jan 2025 15:10:35 -0000 1.27
+++ share/man/man9/rwlock.9 17 May 2025 07:38:35 -0000
@@ -149,10 +149,6 @@ When waiting for a lock, allow signals t
Do not wait for busy locks, fail with
.Dv EBUSY
instead.
-.It Dv RW_SLEEPFAIL
-Wait for busy locks, but do not obtain them, fail with
-.Dv EAGAIN
-instead.
.It Dv RW_DUPOK
Prevents
.Xr witness 4 ,
Index: sys/sys/rwlock.h
===================================================================
RCS file: /cvs/src/sys/sys/rwlock.h,v
diff -u -p -r1.32 rwlock.h
--- sys/sys/rwlock.h 29 Jan 2025 15:10:09 -0000 1.32
+++ sys/sys/rwlock.h 17 May 2025 07:38:35 -0000
@@ -114,7 +114,6 @@ struct rwlock {
#define RW_OPMASK 0x0007UL
#define RW_INTR 0x0010UL /* interruptible sleep */
-#define RW_SLEEPFAIL 0x0020UL /* fail if we slept for the lock */
#define RW_NOSLEEP 0x0040UL /* don't wait for the lock */
#define RW_RECURSEFAIL 0x0080UL /* Fail on recursion for RRW locks. */
#define RW_DUPOK 0x0100UL /* Permit duplicate lock */
Index: sys/kern/kern_rwlock.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_rwlock.c,v
diff -u -p -r1.55 kern_rwlock.c
--- sys/kern/kern_rwlock.c 29 Jan 2025 15:10:09 -0000 1.55
+++ sys/kern/kern_rwlock.c 17 May 2025 07:38:35 -0000
@@ -302,11 +302,6 @@ rw_do_enter_write(struct rwlock *rwl, in
rw_dec(&rwl->rwl_waiters);
return (error);
}
- if (ISSET(flags, RW_SLEEPFAIL)) {
- rw_dec(&rwl->rwl_waiters);
- rw_exited(rwl);
- return (EAGAIN);
- }
owner = rw_cas(&rwl->rwl_owner, 0, self);
} while (owner != 0);
@@ -392,11 +387,9 @@ rw_do_enter_read(struct rwlock *rwl, int
db_enter();
}
#endif
- if (ISSET(flags, RW_INTR) && (error != 0))
- goto fail;
- if (ISSET(flags, RW_SLEEPFAIL)) {
- error = EAGAIN;
- goto fail;
+ if (ISSET(flags, RW_INTR) && (error != 0)) {
+ rw_dec(&rwl->rwl_readers);
+ return (error);
}
} while (!rw_read_incr(rwl, 0));
rw_dec(&rwl->rwl_readers);
@@ -406,9 +399,6 @@ locked:
WITNESS_LOCK(&rwl->rwl_lock_obj, lop_flags);
return (0);
-fail:
- rw_dec(&rwl->rwl_readers);
- return (error);
}
static int
rwlocks don't need to provide RW_SLEEPFAIL anymore