Whamcloud - gitweb
LU-8637 obdclass: LWP callback hold export reference 24/22724/2
authorFan Yong <fan.yong@intel.com>
Fri, 15 Jul 2016 05:33:01 +0000 (13:33 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 5 Oct 2016 03:51:25 +0000 (03:51 +0000)
commitacf46c8846d6c3893a52f5caba1eabea67c1bdba
tree65d207d7f0b186d8aec101a399aad772967f9d3f
parent88421ddcd666e9662aec4b8af1dd7f3001b53a2a
LU-8637 obdclass: LWP callback hold export reference

The lwp_notify_main thread itself needs to hold the 'exp'
reference to prevent 'exp' being freed during LWP callback.

On the other hand, there is race condition between the
lustre_register_lwp_item() and lustre_notify_lwp_list():

When lustre_register_lwp_item() (call it as thread1) adds
'lwp_register_item' into the 'lwp_register_list', the
"*lri_exp" is NULL. After that, the thread1 releases the
'lwp_register_list_lock', then the LWP notify thread (call
it as thread2) assigns the "lri::lri_exp" via the
'lustre_notify_lwp_list()' by race. That will cause thread1
to trigger the 'lri::lri_cb_func'. At the same time, thread2
will also trigger the 'lri::lri_cb_func'. Then the callback
are called repeatedly.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I9eb5407931149a818b620a393fdc70fec0d0d099
Reviewed-on: http://review.whamcloud.com/22724
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/obd_mount_server.c
lustre/osp/lwp_dev.c