Message ID | 1519376978-198116-1-git-send-email-cgxu519@icloud.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> > 在 2018年2月23日,下午5:09,Chengguang Xu <cgxu519@icloud.com> 写道: > > 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: Chengguang Xu <cgxu519@icloud.com> > --- > fs/ceph/caps.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > index 6582c45..c85dae8 100644 > --- a/fs/ceph/caps.c > +++ b/fs/ceph/caps.c > @@ -341,6 +341,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, > { > struct ceph_mds_client *mdsc = fsc->mdsc; > > + spin_lock(&mdsc->caps_list_lock); > + > if (total) > *total = mdsc->caps_total_count; > if (avail) > @@ -351,6 +353,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, > *reserved = mdsc->caps_reserve_count; > if (min) > *min = mdsc->caps_min_count; > + > + spin_unlock(&mdsc->caps_list_lock); > } > > /* > -- > 1.8.3.1 > ping. Thanks, Chengguang. -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> On 23 Feb 2018, at 17:09, Chengguang Xu <cgxu519@icloud.com> wrote: > > 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: Chengguang Xu <cgxu519@icloud.com> > --- > fs/ceph/caps.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > index 6582c45..c85dae8 100644 > --- a/fs/ceph/caps.c > +++ b/fs/ceph/caps.c > @@ -341,6 +341,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, > { > struct ceph_mds_client *mdsc = fsc->mdsc; > > + spin_lock(&mdsc->caps_list_lock); > + > if (total) > *total = mdsc->caps_total_count; > if (avail) > @@ -351,6 +353,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, > *reserved = mdsc->caps_reserve_count; > if (min) > *min = mdsc->caps_min_count; > + > + spin_unlock(&mdsc->caps_list_lock); > } > > /* > -- > 1.8.3.1 > Applied. Thanks. Yan, Zheng -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 6582c45..c85dae8 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -341,6 +341,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, { struct ceph_mds_client *mdsc = fsc->mdsc; + spin_lock(&mdsc->caps_list_lock); + if (total) *total = mdsc->caps_total_count; if (avail) @@ -351,6 +353,8 @@ void ceph_reservation_status(struct ceph_fs_client *fsc, *reserved = mdsc->caps_reserve_count; if (min) *min = mdsc->caps_min_count; + + spin_unlock(&mdsc->caps_list_lock); } /*
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: Chengguang Xu <cgxu519@icloud.com> --- fs/ceph/caps.c | 4 ++++ 1 file changed, 4 insertions(+)