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>
This commit is contained in:
Daniel Eischen 2008-01-31 19:38:26 +00:00
parent 3a48ea9c49
commit 3462c3c752

View File

@ -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;