diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 171b2713d2e5..f7c0b0b73e97 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -112,7 +112,9 @@ static void gfs2_qd_dealloc(struct rcu_head *rcu) struct gfs2_sbd *sdp = qd->qd_sbd; kmem_cache_free(gfs2_quotad_cachep, qd); - if (atomic_dec_and_test(&sdp->sd_quota_count)) + if (!sdp) + return; + if (atomic_read(&sdp->sd_quota_count) == 0) wake_up(&sdp->sd_kill_wait); } @@ -122,6 +124,7 @@ static void gfs2_qd_dispose(struct gfs2_quota_data *qd) spin_lock(&qd_lock); list_del(&qd->qd_list); + atomic_dec(&sdp->sd_quota_count); spin_unlock(&qd_lock); spin_lock_bucket(qd->qd_hash); @@ -1501,9 +1504,8 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp) gfs2_qd_list_dispose(&dispose); - wait_event_timeout(sdp->sd_kill_wait, - (count = atomic_read(&sdp->sd_quota_count)) == 0, - HZ * 60); + wait_event(sdp->sd_kill_wait, + (count = atomic_read(&sdp->sd_quota_count)) == 0); if (count != 0) fs_err(sdp, "%d left-over quota data objects\n", count);