Change gfs2_quota_cleanup() to move the quota data objects to dispose of
on a dispose list and call gfs2_qd_dispose() on that list, like
gfs2_qd_shrink_scan() does, instead of disposing of the quota data
objects directly.

This may look a bit pointless by itself, but it will make more sense in
combination with a fix that follows.

Signed-off-by: Andreas Gruenbacher <agrue...@redhat.com>
---
 fs/gfs2/quota.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index f58072efafc9..976bf1097706 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1459,35 +1459,17 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
 
 void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
 {
-       struct list_head *head = &sdp->sd_quota_list;
        struct gfs2_quota_data *qd;
+       LIST_HEAD(dispose);
 
        spin_lock(&qd_lock);
-       while (!list_empty(head)) {
-               qd = list_last_entry(head, struct gfs2_quota_data, qd_list);
-
-               list_del(&qd->qd_list);
-
-               /* Also remove if this qd exists in the reclaim list */
+       list_for_each_entry(qd, &sdp->sd_quota_list, qd_list) {
                list_lru_del(&gfs2_qd_lru, &qd->qd_lru);
-               atomic_dec(&sdp->sd_quota_count);
-               spin_unlock(&qd_lock);
-
-               spin_lock_bucket(qd->qd_hash);
-               hlist_bl_del_rcu(&qd->qd_hlist);
-               spin_unlock_bucket(qd->qd_hash);
-
-               gfs2_assert_warn(sdp, !qd->qd_change);
-               gfs2_assert_warn(sdp, !qd->qd_slot_count);
-               gfs2_assert_warn(sdp, !qd->qd_bh_count);
-
-               gfs2_glock_put(qd->qd_gl);
-               call_rcu(&qd->qd_rcu, gfs2_qd_dealloc);
-
-               spin_lock(&qd_lock);
+               list_add(&qd->qd_lru, &dispose);
        }
        spin_unlock(&qd_lock);
 
+       gfs2_qd_dispose(&dispose);
        gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count));
 
        kvfree(sdp->sd_quota_bitmap);
-- 
2.40.1

Reply via email to