Whamcloud - gitweb
LU-1842 quota: lfs quota commands
authorNiu Yawei <niu@whamcloud.com>
Tue, 18 Sep 2012 07:01:27 +0000 (03:01 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Sep 2012 04:08:08 +0000 (00:08 -0400)
- Removed 'lfs quotachown' & 'lfs quotainv';
- For 'lfs quotacheck', 'lfs quotaon' & 'lfs quotaoff', print
  proper message when -EOPNOTSUPP returned from 2.4 server;
- Updated man page for lfs quota commands;
- Removed quotainv from test_15 of s-q;

Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I89e6d1e981640ab0f62e10bc5a91946c78644cc3
Reviewed-on: http://review.whamcloud.com/4022
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/doc/lfs.1
lustre/doc/llapi_quotactl.3
lustre/tests/sanity-quota.sh
lustre/utils/lfs.c

index 4e703e8..dac6685 100644 (file)
@@ -48,14 +48,10 @@ lfs \- Lustre utility to create a file with specific striping pattern, find the
 .br
 .B lfs quotacheck [-ug] <filesystem>
 .br
 .br
 .B lfs quotacheck [-ug] <filesystem>
 .br
-.B lfs quotachown [-i] <filesystem>
-.br
 .B lfs quotaon [-ugf] <filesystem>
 .br
 .B lfs quotaoff [-ug] <filesystem>
 .br
 .B lfs quotaon [-ugf] <filesystem>
 .br
 .B lfs quotaoff [-ug] <filesystem>
 .br
-.B lfs quotainv [-ug] [-f] <filesystem>
-.br
 .B lfs setquota <-u|--user|-g|--group> <uname|uid|gname|gid>
              \fB[--block-softlimit <block-softlimit>]
              \fB[--block-hardlimit <block-hardlimit>]
 .B lfs setquota <-u|--user|-g|--group> <uname|uid|gname|gid>
              \fB[--block-softlimit <block-softlimit>]
              \fB[--block-hardlimit <block-hardlimit>]
@@ -211,20 +207,14 @@ To display disk usage and limits, either for the full filesystem, or for objects
 .B quota -t <-u|-g> <filesystem>
 To display block and inode grace times for user (-u) or group (-g) quotas
 .TP
 .B quota -t <-u|-g> <filesystem>
 To display block and inode grace times for user (-u) or group (-g) quotas
 .TP
-.B quotachown
-To change files' owner and group on OSTs of the specified filesystem
-.TP
-.B quotacheck [-ugf] <filesystem>
-To scan the specified filesystem for disk usage, and create or update quota files. Options specify quota for users (-u) groups (-g) and force (-f)
-.TP
-.B quotaon [-ugf] <filesystem>
-To turn filesystem quotas on. Options specify quota for users (-u) groups (-g) and force (-f)
+.B quotacheck [-ugf] <filesystem> (deprecated as of 2.4.0)
+To scan the specified filesystem for disk usage, and create or update quota files. Options specify quota for users (-u) groups (-g) and force (-f). Not useful anymore with servers >= 2.4.0 since space accounting is always turned on.
 .TP
 .TP
-.B quotaoff [-ugf] <filesystem>
-To turn filesystem quotas off.  Options specify quota for users (-u) groups (-g) and force (-f)
+.B quotaon [-ugf] <filesystem> (deprecated as of 2.4.0)
+To turn filesystem quotas on. Options specify quota for users (-u) groups (-g) and force (-f). Not used anymore in lustre 2.4.0 where quota enforcement must be enabled via conf_param (e.g. lctl conf_param ${FSNAME}.quota.<ost|mdt>=<u|g|ug>)
 .TP
 .TP
-.B quotainv [-ug] [-f] <filesystem>
-Clear quota files (administrative quota files if used without -f, operational quota files otherwise), all of their quota entries, for (-u) users or (-g) groups; after quotainv one must use quotacheck before using quotas. DO NOT USE THIS COMMAND UNLESS YOU REALLY KNOW WHAT IT DOES. IT IS MAINLY FOR INTERNAL PURPOSES.
+.B quotaoff [-ugf] <filesystem> (deprecated as of 2.4.0)
+To turn filesystem quotas off.  Options specify quota for users (-u) groups (-g) and force (-f). Not used anymore in lustre 2.4.0 where quota enforcement can be turned off (for inode or block) by running the following command on the MGS: lctl conf_param ${FSNAME}.quota.<ost|mdt>=""
 .TP
 .B setquota  <-u|-g> <uname>|<uid>|<gname>|<gid> [--block-softlimit <block-softlimit>] [--block-hardlimit <block-hardlimit>] [--inode-softlimit <inode-softlimit>] [--inode-hardlimit <inode-hardlimit>] <filesystem>
 To set filesystem quotas for users or groups. Limits can be specified with -b, -k, -m, -g, -t, -p suffixes which specify units of 1, 2^10, 2^20, 2^30, 2^40 and 2^50 accordingly. Block limits unit is kilobyte (1024) by default and block limits are always kilobyte-grained (even if specified in bytes), see EXAMPLES
 .TP
 .B setquota  <-u|-g> <uname>|<uid>|<gname>|<gid> [--block-softlimit <block-softlimit>] [--block-hardlimit <block-hardlimit>] [--inode-softlimit <inode-softlimit>] [--inode-hardlimit <inode-hardlimit>] <filesystem>
 To set filesystem quotas for users or groups. Limits can be specified with -b, -k, -m, -g, -t, -p suffixes which specify units of 1, 2^10, 2^20, 2^30, 2^40 and 2^50 accordingly. Block limits unit is kilobyte (1024) by default and block limits are always kilobyte-grained (even if specified in bytes), see EXAMPLES
index dc15a78..15f0050 100644 (file)
@@ -64,7 +64,7 @@ or
 .IR qc_id .
 .TP 15
 .SB LUSTRE_Q_QUOTAON
 .IR qc_id .
 .TP 15
 .SB LUSTRE_Q_QUOTAON
-Turn on quotas for a Lustre filesystem.
+Turn on quotas for a Lustre filesystem. Deprecated as of 2.4.0.
 .I qc_type
 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
 The quota files must exist; they are normally created with the
 .I qc_type
 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
 The quota files must exist; they are normally created with the
@@ -74,7 +74,7 @@ call.
 This call is restricted to the super-user.
 .TP
 .SB LUSTRE_Q_QUOTAOFF
 This call is restricted to the super-user.
 .TP
 .SB LUSTRE_Q_QUOTAOFF
-Turn off quotas for a Lustre filesystem.
+Turn off quotas for a Lustre filesystem. Deprecated as of 2.4.0.
 .I qc_type
 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
 
 .I qc_type
 is USRQUOTA, GRPQUOTA or UGQUOTA (both user and group quotas).
 
index 43e81de..24c6882 100644 (file)
@@ -1254,9 +1254,6 @@ test_15(){
                         error "fail to set version for ost$j"
         done
 
                         error "fail to set version for ost$j"
         done
 
-        echo "invalidating quota files"
-        $LFS quotainv -ug $DIR
-        $LFS quotainv -ugf $DIR
         $LFS quotacheck -ug $DIR
 }
 run_test_with_stat 15 "set block quota more than 4T ==="
         $LFS quotacheck -ug $DIR
 }
 run_test_with_stat 15 "set block quota more than 4T ==="
index 851fb6f..2b60ec4 100644 (file)
@@ -88,13 +88,11 @@ static int lfs_df(int argc, char **argv);
 static int lfs_getname(int argc, char **argv);
 static int lfs_check(int argc, char **argv);
 #ifdef HAVE_SYS_QUOTA_H
 static int lfs_getname(int argc, char **argv);
 static int lfs_check(int argc, char **argv);
 #ifdef HAVE_SYS_QUOTA_H
-static int lfs_quotachown(int argc, char **argv);
 static int lfs_quotacheck(int argc, char **argv);
 static int lfs_quotaon(int argc, char **argv);
 static int lfs_quotaoff(int argc, char **argv);
 static int lfs_setquota(int argc, char **argv);
 static int lfs_quota(int argc, char **argv);
 static int lfs_quotacheck(int argc, char **argv);
 static int lfs_quotaon(int argc, char **argv);
 static int lfs_quotaoff(int argc, char **argv);
 static int lfs_setquota(int argc, char **argv);
 static int lfs_quota(int argc, char **argv);
-static int lfs_quotainv(int argc, char **argv);
 #endif
 static int lfs_flushctx(int argc, char **argv);
 static int lfs_join(int argc, char **argv);
 #endif
 static int lfs_flushctx(int argc, char **argv);
 static int lfs_join(int argc, char **argv);
@@ -175,23 +173,20 @@ command_t cmdlist[] = {
          "[for specified path only]\n"
          "Usage: getname [-h]|[path ...] "},
 #ifdef HAVE_SYS_QUOTA_H
          "[for specified path only]\n"
          "Usage: getname [-h]|[path ...] "},
 #ifdef HAVE_SYS_QUOTA_H
-        {"quotachown",lfs_quotachown, 0,
-         "Change files' owner or group on the specified filesystem.\n"
-         "usage: quotachown [-i] <filesystem>\n"
-         "\t-i: ignore error if file is not exist\n"},
         {"quotacheck", lfs_quotacheck, 0,
          "Scan the specified filesystem for disk usage, and create,\n"
         {"quotacheck", lfs_quotacheck, 0,
          "Scan the specified filesystem for disk usage, and create,\n"
-         "or update quota files.\n"
+         "or update quota files. Deprecated as of 2.4.0.\n"
          "usage: quotacheck [ -ug ] <filesystem>"},
          "usage: quotacheck [ -ug ] <filesystem>"},
-        {"quotaon", lfs_quotaon, 0, "Turn filesystem quotas on.\n"
+        {"quotaon", lfs_quotaon, 0, "Turn filesystem"
+         " quotas on. Deprecated as of 2.4.0.\n"
          "usage: quotaon [ -ugf ] <filesystem>"},
          "usage: quotaon [ -ugf ] <filesystem>"},
-        {"quotaoff", lfs_quotaoff, 0, "Turn filesystem quotas off.\n"
+        {"quotaoff", lfs_quotaoff, 0, "Turn filesystem"
+         " quotas off. Deprecated as of 2.4.0.\n"
          "usage: quotaoff [ -ug ] <filesystem>"},
         {"setquota", lfs_setquota, 0, "Set filesystem quotas.\n"
          "usage: setquota <-u|-g> <uname>|<uid>|<gname>|<gid>\n"
          "                -b <block-softlimit> -B <block-hardlimit>\n"
          "                -i <inode-softlimit> -I <inode-hardlimit> <filesystem>\n"
          "usage: quotaoff [ -ug ] <filesystem>"},
         {"setquota", lfs_setquota, 0, "Set filesystem quotas.\n"
          "usage: setquota <-u|-g> <uname>|<uid>|<gname>|<gid>\n"
          "                -b <block-softlimit> -B <block-hardlimit>\n"
          "                -i <inode-softlimit> -I <inode-hardlimit> <filesystem>\n"
-         "       setquota -t <-u|-g> <block-grace> <inode-grace> <filesystem>\n"
          "       setquota <-u|--user|-g|--group> <uname>|<uid>|<gname>|<gid>\n"
          "                [--block-softlimit <block-softlimit>]\n"
          "                [--block-hardlimit <block-hardlimit>]\n"
          "       setquota <-u|--user|-g|--group> <uname>|<uid>|<gname>|<gid>\n"
          "                [--block-softlimit <block-softlimit>]\n"
          "                [--block-hardlimit <block-hardlimit>]\n"
@@ -208,8 +203,6 @@ command_t cmdlist[] = {
          "usage: quota [-q] [-v] [-o <obd_uuid>|-i <mdt_idx>|-I <ost_idx>]\n"
          "             [<-u|-g> <uname>|<uid>|<gname>|<gid>] <filesystem>\n"
          "       quota [-o <obd_uuid>|-i <mdt_idx>|-I <ost_idx>] -t <-u|-g> <filesystem>"},
          "usage: quota [-q] [-v] [-o <obd_uuid>|-i <mdt_idx>|-I <ost_idx>]\n"
          "             [<-u|-g> <uname>|<uid>|<gname>|<gid>] <filesystem>\n"
          "       quota [-o <obd_uuid>|-i <mdt_idx>|-I <ost_idx>] -t <-u|-g> <filesystem>"},
-        {"quotainv", lfs_quotainv, 0, "Invalidate quota data.\n"
-         "usage: quotainv [-u|-g] <filesystem>"},
 #endif
         {"flushctx", lfs_flushctx, 0, "Flush security context for current user.\n"
          "usage: flushctx [-k] [mountpoint...]"},
 #endif
         {"flushctx", lfs_flushctx, 0, "Flush security context for current user.\n"
          "usage: flushctx [-k] [mountpoint...]"},
@@ -1446,32 +1439,6 @@ static int lfs_join(int argc, char **argv)
 }
 
 #ifdef HAVE_SYS_QUOTA_H
 }
 
 #ifdef HAVE_SYS_QUOTA_H
-static int lfs_quotachown(int argc, char **argv)
-{
-
-        int c,rc;
-        int flag = 0;
-
-        optind = 0;
-        while ((c = getopt(argc, argv, "i")) != -1) {
-                switch (c) {
-                case 'i':
-                        flag++;
-                        break;
-                default:
-                        fprintf(stderr, "error: %s: option '-%c' "
-                                        "unrecognized\n", argv[0], c);
-                        return CMD_HELP;
-                }
-        }
-        if (optind == argc)
-                return CMD_HELP;
-        rc = llapi_quotachown(argv[optind], flag);
-        if(rc)
-                fprintf(stderr,"error: change file owner/group failed.\n");
-        return rc;
-}
-
 static int lfs_quotacheck(int argc, char **argv)
 {
         int c, check_type = 0;
 static int lfs_quotacheck(int argc, char **argv)
 {
         int c, check_type = 0;
@@ -1510,7 +1477,14 @@ static int lfs_quotacheck(int argc, char **argv)
         mnt = argv[optind];
 
         rc = llapi_quotacheck(mnt, check_type);
         mnt = argv[optind];
 
         rc = llapi_quotacheck(mnt, check_type);
-        if (rc) {
+       if (rc == -EOPNOTSUPP) {
+               fprintf(stderr, "error: quotacheck not supported by the quota "
+                       "master.\nPlease note that quotacheck is deprecated as "
+                       "of lustre 2.4.0 since space accounting is always "
+                       "enabled.\nFilesystems not formatted with 2.4 utils or "
+                       "beyond can be upgraded with tunefs.lustre --quota.\n");
+               return rc;
+       } else if (rc) {
                 fprintf(stderr, "quotacheck failed: %s\n", strerror(-rc));
                 return rc;
         }
                 fprintf(stderr, "quotacheck failed: %s\n", strerror(-rc));
                 return rc;
         }
@@ -1582,7 +1556,16 @@ static int lfs_quotaon(int argc, char **argv)
 
         rc = llapi_quotactl(mnt, &qctl);
         if (rc) {
 
         rc = llapi_quotactl(mnt, &qctl);
         if (rc) {
-                if (rc == -EALREADY) {
+                if (rc == -EOPNOTSUPP) {
+                        fprintf(stderr, "error: quotaon not supported by the "
+                                "quota master.\nPlease note that quotaon/off is"
+                                " deprecated as of lustre 2.4.0.\nQuota "
+                                "enforcement should now be enabled on the MGS "
+                                "via:\nmgs# lctl conf_param ${FSNAME}.quota."
+                                "<ost|mdt>=<u|g|ug>\n(ost for block quota, mdt "
+                                "for inode quota, u for user and g for group"
+                                "\n");
+                } else if (rc == -EALREADY) {
                         rc = 0;
                 } else if (rc == -ENOENT) {
                         fprintf(stderr, "error: cannot find quota database, "
                         rc = 0;
                 } else if (rc == -ENOENT) {
                         fprintf(stderr, "error: cannot find quota database, "
@@ -1638,7 +1621,14 @@ static int lfs_quotaoff(int argc, char **argv)
 
         rc = llapi_quotactl(mnt, &qctl);
         if (rc) {
 
         rc = llapi_quotactl(mnt, &qctl);
         if (rc) {
-                if (rc == -EALREADY) {
+                if (rc == -EOPNOTSUPP) {
+                        fprintf(stderr, "error: quotaoff not supported by the "
+                                "quota master.\nPlease note that quotaon/off is"
+                                " deprecated as of lustre 2.4.0.\nQuota "
+                                "enforcement can be disabled on the MGS via:\n"
+                                "mgs# lctl conf_param ${FSNAME}.quota.<ost|mdt>"
+                                "=\"\"\n");
+                } else if (rc == -EALREADY) {
                         rc = 0;
                 } else {
                         if (*obd_type)
                         rc = 0;
                 } else {
                         if (*obd_type)
@@ -1652,54 +1642,6 @@ static int lfs_quotaoff(int argc, char **argv)
         return rc;
 }
 
         return rc;
 }
 
-static int lfs_quotainv(int argc, char **argv)
-{
-        int c;
-        char *mnt;
-        struct if_quotactl qctl;
-        int rc;
-
-        memset(&qctl, 0, sizeof(qctl));
-        qctl.qc_cmd = LUSTRE_Q_INVALIDATE;
-
-        optind = 0;
-        while ((c = getopt(argc, argv, "fgu")) != -1) {
-                switch (c) {
-                case 'u':
-                        qctl.qc_type |= 0x01;
-                        break;
-                case 'g':
-                        qctl.qc_type |= 0x02;
-                        break;
-                case 'f':
-                        qctl.qc_cmd = LUSTRE_Q_FINVALIDATE;
-                        break;
-                default:
-                        fprintf(stderr, "error: %s: option '-%c' "
-                                        "unrecognized\n", argv[0], c);
-                        return CMD_HELP;
-                }
-        }
-
-        if (qctl.qc_type)
-                qctl.qc_type--;
-        else /* by default, invalidate quota for both user & group */
-                qctl.qc_type = 0x02;
-
-        if (argc == optind)
-                return CMD_HELP;
-
-        mnt = argv[optind];
-
-        rc = llapi_quotactl(mnt, &qctl);
-        if (rc) {
-                fprintf(stderr, "quotainv failed: %s\n", strerror(-rc));
-                return rc;
-        }
-
-        return 0;
-}
-
 #define ARG2INT(nr, str, msg)                                           \
 do {                                                                    \
         char *endp;                                                     \
 #define ARG2INT(nr, str, msg)                                           \
 do {                                                                    \
         char *endp;                                                     \