diff options
| author | Daniel Eischen <deischen@FreeBSD.org> | 2008-01-31 19:38:26 +0000 |
|---|---|---|
| committer | Daniel Eischen <deischen@FreeBSD.org> | 2008-01-31 19:38:26 +0000 |
| commit | 3462c3c752d44364e7b90eebfcc5083f96c45172 (patch) | |
| tree | 26ca10b7782a555004c6d7f16b3e74d980b41395 /lib/libkse | |
| parent | 3a48ea9c490f5fe01af28f40b3853eea81111fe6 (diff) | |
Notes
Diffstat (limited to 'lib/libkse')
| -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 77e4e420023cd..3620f31f2dfcc 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; |
