Whamcloud - gitweb
LU-4624 llite: Avoid statahead thread start/stop deadlocks 58/9358/4
authorChristopher J. Morrone <morrone2@llnl.gov>
Fri, 21 Feb 2014 22:46:47 +0000 (14:46 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 21 Mar 2014 14:03:39 +0000 (14:03 +0000)
commit373d937086e5cede6fc1a3b3f859622c0173c1de
treeaa78e0abc3d3fb336522afe9ab32be078350b551
parent708d85a652a77f85153790e6cca1b7a2b91947cf
LU-4624 llite: Avoid statahead thread start/stop deadlocks

The statahead and statahead agl threads blindly set their
thread state to SVC_RUNNING without checking the state first.  If, for
instance, another thread sets the state to SVC_STOPPING that
stop signal will now have been lost.  Deadlock ensues.

We also partly improve the sai reference counting, because a race exists
where the ll_stop_statahead thread can drop the default reference, and
the statahead thread can exit and drop its reference as well.  With no
references on the sai, the final put will poison and free the buffer.  The
original do_statahead_enter() function may then continue to access
the buffer after it is freed because it did not take a reference of its
own.  We add a local reference to address that.

Change-Id: I531f17966d49ba1e6ebd99abe9cb8b128eeac4f9
Signed-off-by: Christopher J. Morrone <morrone2@llnl.gov>
Reviewed-on: http://review.whamcloud.com/9358
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/statahead.c