From: Tatsushi Takamura Date: Mon, 26 Aug 2019 01:27:10 +0000 (+0900) Subject: LU-12694 quota: display correct group quota information X-Git-Tag: 2.12.58~15 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=5c033757a9a36b83bf891715e683ed06a4bded8e LU-12694 quota: display correct group quota information 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 Change-Id: I5163c00fbc58ec1dd04c912e36abd01a7d2239ad Reviewed-on: https://review.whamcloud.com/35917 Reviewed-by: Andreas Dilger Reviewed-by: Shilong Wang Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index c057769..a65dacc 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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" diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 78d1ec7..28e80cd 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -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 = "";