ceph: Hold caps_list_lock when adjusting caps_{use, total}_count

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Yan, Zheng 2012-11-03 10:32:37 +08:00 committed by Sage Weil
parent 9e15b77d9a
commit 4d1d0534f5
1 changed files with 2 additions and 0 deletions

View File

@ -236,8 +236,10 @@ static struct ceph_cap *get_cap(struct ceph_mds_client *mdsc,
if (!ctx) { if (!ctx) {
cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS); cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS);
if (cap) { if (cap) {
spin_lock(&mdsc->caps_list_lock);
mdsc->caps_use_count++; mdsc->caps_use_count++;
mdsc->caps_total_count++; mdsc->caps_total_count++;
spin_unlock(&mdsc->caps_list_lock);
} }
return cap; return cap;
} }