Whamcloud - gitweb
LU-10794 lfs: make quota work for grace time 06/31606/3
authorWang Shilong <wshilong@ddn.com>
Fri, 9 Mar 2018 05:25:07 +0000 (13:25 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 12 Mar 2018 14:17:30 +0000 (14:17 +0000)
Following commit:
LU-10011 utils: refactor lfs quota codes

Introduce a regression which will make 'lfs quota -t'
will output nothing, fix this bug and also add
a test case in sanity-quota.sh in case it is broken
in the future again.

Test-Parameters: trivial testlist=sanity-quota
Change-Id: I2063552505cf07464d9924f66c29fc2504bc56ce
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/31606
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-quota.sh
lustre/utils/lfs.c

index 239b1b7..9a507cd 100755 (executable)
@@ -3026,6 +3026,25 @@ test_55() {
 }
 run_test 55 "Chgrp should be affected by group quota"
 
+test_56 () {
+       setup_quota_test || error "setup quota failed with $?"
+
+       set_ost_qtype $QTYPE || error "enable ost quota failed"
+       quota_init
+
+       $LFS setquota -t -u -b 10 -i 10 $DIR ||
+               erro "failed to set grace time for usr quota"
+       grace_time=$($LFS quota -t -u $DIR | grep "Block grace time:" |
+                    awk '{print $4 $8}')
+       if [ "x$grace_time" != "x10s;10s" ]; then
+               $LFS quota -t -u $DIR
+               error "expected grace time: 10s;10s, got:$grace_time"
+       fi
+
+       cleanup_quota_test
+}
+run_test 56 "lfs quota -t should work well"
+
 quota_fini()
 {
        do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"
index 1219665..79ed30f 100644 (file)
@@ -6112,6 +6112,7 @@ quota_type:
                        if (rc1 && !rc)
                                rc = rc1;
                }
+               return rc;
        /* lfs quota -u username /path/to/lustre/mount */
        } else if (qctl.qc_cmd == LUSTRE_Q_GETQUOTA) {
                /* options should be followed by u/g-name and mntpoint */
@@ -6145,15 +6146,15 @@ quota_type:
                                return CMD_HELP;
                        }
                }
-               mnt = argv[optind];
-               rc = get_print_quota(mnt, name, &qctl, verbose, quiet,
-                                    human_readable);
        } else if (optind + 1 != argc || qctl.qc_type == ALLQUOTA) {
                fprintf(stderr, "%s quota: missing quota info argument(s)\n",
                        progname);
                return CMD_HELP;
        }
 
+       mnt = argv[optind];
+       rc = get_print_quota(mnt, name, &qctl, verbose, quiet,
+                            human_readable);
        return rc;
 }
 #endif /* HAVE_SYS_QUOTA_H! */