If there is a lock resource conflict on multiple nodes, the lock on
convert queue may not be granted forever.

EX.)
grant queue:
    node0 grmode NL / rqmode IV
    node1 grmode NL / rqmode IV

convert queue:
    node2 grmode NL / rqmode EX
    node3 grmode PR / rqmode EX

wait queue:
    node4 grmode IV / rqmode PR
    node5 grmode IV / rqmode PR

When the lock conversion (node PR -> NL) of node 0 is completed, the lock
of node 2 should be grantable. However, __can_be_granted() returns 0
because the grmode of the lock on node 3 in convert queue is PR.

When checking the lock at the head of convert queue, exclude
queue_conflict() targeting convert queue.

Signed-off-by: Tadashi Miyauchi <miyau...@toshiba-tops.co.jp>
Signed-off-by: Tsutomu Owa <tsutomu....@toshiba.co.jp>
---
 fs/dlm/lock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 35502d4..dcdd26d 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -2336,7 +2336,8 @@ static int _can_be_granted(struct dlm_rsb *r, struct 
dlm_lkb *lkb, int now,
         * locks
         */
 
-       if (queue_conflict(&r->res_convertqueue, lkb))
+       if (!first_in_list(lkb, &r->res_convertqueue) &&
+           queue_conflict(&r->res_convertqueue, lkb))
                return 0;
 
        /*
-- 
2.7.4




Reply via email to