Merge tag 'gfs2-v6.6-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / fs / gfs2 / quota.c
index 5cbbc1a..95dae78 100644 (file)
@@ -470,6 +470,17 @@ static int qd_check_sync(struct gfs2_sbd *sdp, struct gfs2_quota_data *qd,
            (sync_gen && (qd->qd_sync_gen >= *sync_gen)))
                return 0;
 
+       /*
+        * If qd_change is 0 it means a pending quota change was negated.
+        * We should not sync it, but we still have a qd reference and slot
+        * reference taken by gfs2_quota_change -> do_qc that need to be put.
+        */
+       if (!qd->qd_change && test_and_clear_bit(QDF_CHANGE, &qd->qd_flags)) {
+               slot_put(qd);
+               qd_put(qd);
+               return 0;
+       }
+
        if (!lockref_get_not_dead(&qd->qd_lockref))
                return 0;
 
@@ -912,7 +923,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
 {
        struct gfs2_sbd *sdp = (*qda)->qd_sbd;
        struct gfs2_inode *ip = GFS2_I(sdp->sd_quota_inode);
-       struct gfs2_alloc_parms ap = { .aflags = 0, };
+       struct gfs2_alloc_parms ap = {};
        unsigned int data_blocks, ind_blocks;
        struct gfs2_holder *ghs, i_gh;
        unsigned int qx, x;
@@ -1086,8 +1097,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
        u32 x;
        int error;
 
-       if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON &&
-           sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET)
+       if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
                return 0;
 
        error = gfs2_quota_hold(ip, uid, gid);
@@ -1194,17 +1204,16 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
 
 #define MAX_LINE 256
 
-static int print_message(struct gfs2_quota_data *qd, char *type)
+static void print_message(struct gfs2_quota_data *qd, char *type)
 {
        struct gfs2_sbd *sdp = qd->qd_sbd;
 
-       if (sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET)
+       if (sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET) {
                fs_info(sdp, "quota %s for %s %u\n",
                        type,
                        (qd->qd_id.type == USRQUOTA) ? "user" : "group",
                        from_kqid(&init_user_ns, qd->qd_id));
-
-       return 0;
+       }
 }
 
 /**
@@ -1274,7 +1283,8 @@ int gfs2_quota_check(struct gfs2_inode *ip, kuid_t uid, kgid_t gid,
                                         * HZ)) {
                        quota_send_warning(qd->qd_id,
                                           sdp->sd_vfs->s_dev, QUOTA_NL_BSOFTWARN);
-                       error = print_message(qd, "warning");
+                       print_message(qd, "warning");
+                       error = 0;
                        qd->qd_last_warn = jiffies;
                }
        }
@@ -1288,8 +1298,7 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
        u32 x;
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
 
-       if ((sdp->sd_args.ar_quota != GFS2_QUOTA_ON &&
-           sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET) ||
+       if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF ||
            gfs2_assert_warn(sdp, change))
                return;
        if (ip->i_diskflags & GFS2_DIF_SYSTEM)
@@ -1746,7 +1755,7 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid,
        if (gfs2_is_stuffed(ip))
                alloc_required = 1;
        if (alloc_required) {
-               struct gfs2_alloc_parms ap = { .aflags = 0, };
+               struct gfs2_alloc_parms ap = {};
                gfs2_write_calc_reserv(ip, sizeof(struct gfs2_quota),
                                       &data_blocks, &ind_blocks);
                blocks = 1 + data_blocks + ind_blocks;