From: Jinshan Xiong Date: Sun, 27 Apr 2014 17:07:03 +0000 (-0400) Subject: staging/lustre/clio: Solve a race in cl_lock_put X-Git-Tag: omap-for-v3.16/fixes-against-rc1~39^2~36^2~1127 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d67c821d96c8cfaa2ae05f346f1b2a07f0c15ec;p=pandora-kernel.git staging/lustre/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. Signed-off-by: Jinshan Xiong Reviewed-on: http://review.whamcloud.com/9881 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4558 Reviewed-by: Bobi Jam Reviewed-by: Lai Siyao Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed