Whamcloud - gitweb
LU-12694 quota: display correct group quota information 17/35917/3
authorTatsushi Takamura <takamr.tatsushi@jp.fujitsu.com>
Mon, 26 Aug 2019 01:27:10 +0000 (10:27 +0900)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Sep 2019 01:49:37 +0000 (01:49 +0000)
GETQUOTA is not executed when oqctl->qc_dqblk.dqb_curspace
not 0. So, qctl.qc_dqblk need to be cleared
to display correct.

Signed-off-by: Tatsushi Takamura <takamr.tatsushi@jp.fujitsu.com>
Change-Id: I5163c00fbc58ec1dd04c912e36abd01a7d2239ad
Reviewed-on: https://review.whamcloud.com/35917
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shilong Wang <wshilong@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh
lustre/utils/lfs.c

index c057769..a65dacc 100755 (executable)
@@ -3433,6 +3433,36 @@ test_64() {
 }
 run_test 64 "lfs project on symlink files should fail"
 
+test_65() {
+       local SIZE=10 #10M
+       local TESTFILE="$DIR/$tdir/$tfile-0"
+
+       setup_quota_test || error "setup quota failed with $?"
+       set_ost_qtype $QTYPE || error "enable ost quota failed"
+       quota_init
+
+       echo "Write..."
+       $RUNAS $DD of=$TESTFILE count=$SIZE ||
+               error "failed to write"
+       # flush cache, ensure noquota flag is set on client
+       cancel_lru_locks osc
+       sync; sync_all_data || true
+
+       local quota_u=$($LFS quota -u $TSTUSR $DIR)
+       local quota_g=$($LFS quota -g $TSTUSR $DIR)
+       local quota_all=$($RUNAS $LFS quota $DIR)
+
+       [ "$(echo "$quota_all" | head -n3)" != "$quota_u" ] &&
+               error "usr quota not match"
+       [ "$(echo "$quota_all" | tail -n3)" != "$quota_g" ] &&
+               error "grp quota not match"
+
+       rm -f $TESTFILE
+       # cleanup
+       cleanup_quota_test
+}
+run_test 65 "Check lfs quota result"
+
 quota_fini()
 {
        do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"
index 78d1ec7..28e80cd 100644 (file)
@@ -7174,17 +7174,19 @@ quota_type:
            optind == argc - 1 && !show_default) {
 
                qctl.qc_cmd = LUSTRE_Q_GETQUOTA;
-               qctl.qc_valid = valid;
                qctl.qc_idx = idx;
 
                for (qtype = USRQUOTA; qtype <= GRPQUOTA; qtype++) {
                        qctl.qc_type = qtype;
+                       qctl.qc_valid = valid;
                        if (qtype == USRQUOTA) {
                                qctl.qc_id = geteuid();
                                rc = uid2name(&name, qctl.qc_id);
                        } else {
                                qctl.qc_id = getegid();
                                rc = gid2name(&name, qctl.qc_id);
+                               memset(&qctl.qc_dqblk, 0,
+                                      sizeof(qctl.qc_dqblk));
                        }
                        if (rc)
                                name = "<unknown>";