Whamcloud - gitweb
LU-4861 osc: a deadlock problem in osc completion ast 53/10953/4
authorJinshan Xiong <jinshan.xiong@intel.com>
Wed, 4 Jun 2014 00:34:21 +0000 (17:34 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Aug 2014 15:36:46 +0000 (11:36 -0400)
commit168bce0ec86ed4e3ba163fdbb82f1786ff2c1e43
tree6c0a7a9a1a56a96f3e47b9b0063925bcea0b8b44
parenteb5b05513130fbf5fc412fc59a2fb9e4985263b9
LU-4861 osc: a deadlock problem in osc completion ast

In osc_ldlm_completion_ast(), it tries to hold mutex of cl_lock
and update the lock even it's known that the lock is not granted,
this can introduce a deadlock case if the process is matching a
dlm lock with the calling stack:
  osc_lock_enqueue()
    -> osc_enqueue_base()
      -> ldlm_lock_match()
        -> osc_ldlm_completion_ast()
          -> cl_lock_mutex_get()
The enqueuing lock and the lock for completion_ast() are different
lock. This is a deadlock case because we're holding a lock's mutex
and then request the other.

It's not necessary to acquire the lock in completion_ast() if it's
known that the lock has not been granted.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ia8c0a4cb1e48c9f7fd921052174ce4d8d07713b1
Reviewed-on: http://review.whamcloud.com/10581
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osc/osc_lock.c