Commit b884014a authored by Chengguang Xu's avatar Chengguang Xu Committed by Ilya Dryomov

ceph: adding protection for showing cap reservation info

Adding spinlock protection during getting cap reservation
ralated fields so that the numbers match below BUG_ON condition
in the code.

BUG_ON(mdsc->caps_total_count != mdsc->caps_use_count +
				 mdsc->caps_reserve_count +
				 mdsc->caps_avail_count);
Signed-off-by: default avatarChengguang Xu <cgxu519@icloud.com>
Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent f2f87877
...@@ -341,6 +341,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, ...@@ -341,6 +341,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc,
{ {
struct ceph_mds_client *mdsc = fsc->mdsc; struct ceph_mds_client *mdsc = fsc->mdsc;
spin_lock(&mdsc->caps_list_lock);
if (total) if (total)
*total = mdsc->caps_total_count; *total = mdsc->caps_total_count;
if (avail) if (avail)
...@@ -351,6 +353,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, ...@@ -351,6 +353,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc,
*reserved = mdsc->caps_reserve_count; *reserved = mdsc->caps_reserve_count;
if (min) if (min)
*min = mdsc->caps_min_count; *min = mdsc->caps_min_count;
spin_unlock(&mdsc->caps_list_lock);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment