Whamcloud - gitweb
LU-2654 ldlm: ldlm_resource_dump should be called with resource locked
authorOleg Drokin <green@whamcloud.com>
Sat, 2 Feb 2013 04:08:59 +0000 (23:08 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 3 Feb 2013 06:55:15 +0000 (01:55 -0500)
Fix ldlm_resource_complain to lock resource before calling
ldlm_resource_dump

Change-Id: I9dfbe84bd63de3093c99e7379daeca30d02fc875
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/5254
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_resource.c

index 494661e..2174271 100644 (file)
@@ -797,6 +797,7 @@ static int ldlm_resource_complain(cfs_hash_t *hs, cfs_hash_bd_t *bd,
 {
         struct ldlm_resource  *res = cfs_hash_object(hs, hnode);
 
+       lock_res(res);
         CERROR("Namespace %s resource refcount nonzero "
                "(%d) after lock cleanup; forcing "
                "cleanup.\n",
@@ -810,6 +811,7 @@ static int ldlm_resource_complain(cfs_hash_t *hs, cfs_hash_bd_t *bd,
                cfs_atomic_read(&res->lr_refcount) - 1);
 
        ldlm_resource_dump(D_ERROR, res);
+       unlock_res(res);
         return 0;
 }