diff options
author | deischen <deischen@FreeBSD.org> | 2008-01-31 19:38:26 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2008-01-31 19:38:26 +0000 |
commit | 9dcd92a86766c881bd5611e2c540271ec24be046 (patch) | |
tree | 26ca10b7782a555004c6d7f16b3e74d980b41395 /lib/libkse/sys | |
parent | f942f574256ae0ffd96bacbb5e7559b3a71b79cf (diff) | |
download | FreeBSD-src-9dcd92a86766c881bd5611e2c540271ec24be046.zip FreeBSD-src-9dcd92a86766c881bd5611e2c540271ec24be046.tar.gz |
When reinitializing a lockuser, don't assume that the lock is in
use. If it is in use, use the watched request, otherwise use the
lockuser's own request. Only allocate a lockuser request if both
requests are null.
PR: 119920
Tested by (6.x): Landon Fuller <landonf -at- bikemonkey -dot- org>
Diffstat (limited to 'lib/libkse/sys')
-rw-r--r-- | lib/libkse/sys/lock.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/libkse/sys/lock.c b/lib/libkse/sys/lock.c index 77e4e42..3620f31 100644 --- a/lib/libkse/sys/lock.c +++ b/lib/libkse/sys/lock.c @@ -118,14 +118,22 @@ _lockuser_reinit(struct lockuser *lu, void *priv) { if (lu == NULL) return (-1); - /* - * All lockusers keep their watch request and drop their - * own (lu_myreq) request. Their own request is either - * some other lockuser's watch request or is the head of - * the lock. - */ - lu->lu_myreq = lu->lu_watchreq; + if (lu->lu_watchreq != NULL) { + /* + * In this case the lock is active. All lockusers + * keep their watch request and drop their own + * (lu_myreq) request. Their own request is either + * some other lockuser's watch request or is the + * head of the lock. + */ + lu->lu_myreq = lu->lu_watchreq; + lu->lu_watchreq = NULL; + } if (lu->lu_myreq == NULL) + /* + * Oops, something isn't quite right. Try to + * allocate one. + */ return (_lockuser_init(lu, priv)); else { lu->lu_myreq->lr_locked = 1; |