Whamcloud - gitweb
LU-4558 clio: Solve a race in cl_lock_put 87/9887/3
authorJinshan Xiong <jinshan.xiong@intel.com>
Thu, 3 Apr 2014 00:35:45 +0000 (17:35 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 22 Apr 2014 02:03:15 +0000 (02:03 +0000)
commitdeb1e8aa6836ad073d53bf3e4dd29a2cb5696f2e
tree5c2375556c3e07b26b7dd3883d4352c45d34da1e
parentecfc109714f69ccd97f26b5d30e8d1a42d9b98ad
LU-4558 clio: Solve a race in cl_lock_put

It's not atomic to check the last reference and state of cl_lock
in cl_lock_put(). This can cause a problem that an using lock is
freed, if the process is preempted between atomic_dec_and_test()
and (lock->cll_state == CLS_FREEING).

This problem can be solved by holding a refcount by coh_locks. In
this case, it can be sure that if the lock refcount reaches zero,
nobody else can have any chance to use it again.

Lustre-commit: ec1a5d4f1f5b52ee5031ddc11a862c82996541f7
Lustre-change: http://review.whamcloud.com/9881

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I5e16396156e1c7b8b86f7aa74b7b4735bb774a0f
Reviewed-on: http://review.whamcloud.com/9887
Tested-by: Jenkins
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/cl_lock.c