When blocking on an F_FLOCK style lock request which is upgrading a
shared lock to exclusive, drop the shared lock before deadlock detection. MFC after: 2 days
This commit is contained in:
parent
a902aa50c3
commit
b95b50cdbb
@ -1369,6 +1369,18 @@ lf_setlock(struct lockf *state, struct lockf_entry *lock, struct vnode *vp,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* For flock type locks, we must first remove
|
||||
* any shared locks that we hold before we sleep
|
||||
* waiting for an exclusive lock.
|
||||
*/
|
||||
if ((lock->lf_flags & F_FLOCK) &&
|
||||
lock->lf_type == F_WRLCK) {
|
||||
lock->lf_type = F_UNLCK;
|
||||
lf_activate_lock(state, lock);
|
||||
lock->lf_type = F_WRLCK;
|
||||
}
|
||||
|
||||
/*
|
||||
* We are blocked. Create edges to each blocking lock,
|
||||
* checking for deadlock using the owner graph. For
|
||||
@ -1388,17 +1400,6 @@ lf_setlock(struct lockf *state, struct lockf_entry *lock, struct vnode *vp,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* For flock type locks, we must first remove
|
||||
* any shared locks that we hold before we sleep
|
||||
* waiting for an exclusive lock.
|
||||
*/
|
||||
if ((lock->lf_flags & F_FLOCK) &&
|
||||
lock->lf_type == F_WRLCK) {
|
||||
lock->lf_type = F_UNLCK;
|
||||
lf_activate_lock(state, lock);
|
||||
lock->lf_type = F_WRLCK;
|
||||
}
|
||||
/*
|
||||
* We have added edges to everything that blocks
|
||||
* us. Sleep until they all go away.
|
||||
|
Loading…
x
Reference in New Issue
Block a user