--- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -1454,11 +1454,12 @@ 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; + struct gfs2_quota_data *qd, *n; spin_lock(&qd_lock); - while (!list_empty(head)) { - qd = list_last_entry(head, struct gfs2_quota_data, qd_list); + list_for_each_entry_safe(qd, n, head, qd_list) { + if (qd->qd_lockref.count > 0) + continue; list_del(&qd->qd_list);