Skip to content

Commit a97f4a6

Browse files
bvanasscheteigland
authored andcommitted
dlm: Avoid that dlm_release_lockspace() incorrectly returns -EBUSY
When dlm_release_lockspace(ls, 1) is invoked on a busy system immediately after the last dlm_unlock() AST has finished it can occur that lkb_idr_is_local() is invoked for the unlocked LKB since removal from ls_lkbidr only occurs after the AST has returned. If that happens dlm_release_lockspace(ls, 1) will return -EBUSY instead of releasing the lockspace. Fix this race condition by changing lkb_idr_is_local() such that it only returns true for LKB's that have not yet been unlocked. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent 34ec4de commit a97f4a6

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎fs/dlm/lockspace.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,7 @@ static int lkb_idr_is_local(int id, void *p, void *data)
706706
{
707707
struct dlm_lkb *lkb = p;
708708

709-
if (!lkb->lkb_nodeid)
710-
return 1;
711-
return 0;
709+
return lkb->lkb_nodeid == 0 && lkb->lkb_grmode != DLM_LOCK_IV;
712710
}
713711

714712
static int lkb_idr_is_any(int id, void *p, void *data)

0 commit comments

Comments
 (0)