X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Flfs.c;h=6d2ac85d4bb2a5df3f61e9b8d71ecc0377cbf19e;hp=5f6e2242e5ab37bb5e8844a5668bef2f3fe20c5d;hb=4cf8e6eabbd366d9d9b7cb64bb468312ba995e7b;hpb=a4f8b35cb2fdbf28a5c98c372506ad13ce84d4f1 diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 5f6e224..6d2ac85 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -1399,7 +1399,7 @@ static int lfs_quotacheck(int argc, char **argv) qctl.qc_cmd = LUSTRE_Q_QUOTAOFF; qctl.qc_type = check_type; rc = llapi_quotactl(mnt, &qctl); - if (rc) { + if (rc && errno != EALREADY) { fprintf(stderr, "quota off failed: %s\n", strerror(errno)); return rc; } @@ -1423,7 +1423,7 @@ static int lfs_quotacheck(int argc, char **argv) qctl.qc_cmd = LUSTRE_Q_QUOTAON; qctl.qc_type = check_type; rc = llapi_quotactl(mnt, &qctl); - if (rc) { + if (rc && errno != EALREADY) { if (*obd_type) fprintf(stderr, "%s %s ", (char *)qctl.obd_type, obd_uuid2str(&qctl.obd_uuid)); @@ -1477,14 +1477,21 @@ static int lfs_quotaon(int argc, char **argv) rc = llapi_quotactl(mnt, &qctl); if (rc) { - if (*obd_type) - fprintf(stderr, "%s %s ", obd_type, - obd_uuid2str(&qctl.obd_uuid)); - fprintf(stderr, "%s failed: %s\n", argv[0], strerror(errno)); - return rc; + if (errno == EALREADY) { + fprintf(stderr, "\n%s quotas are enabled already.\n", + qctl.qc_type == 0x02 ? "user/group" : + (qctl.qc_type == 0x00 ? "user" : "group")); + rc = 0; + } else { + if (*obd_type) + fprintf(stderr, "%s %s ", obd_type, + obd_uuid2str(&qctl.obd_uuid)); + fprintf(stderr, "%s failed: %s\n", argv[0], + strerror(errno)); + } } - return 0; + return rc; } static int lfs_quotaoff(int argc, char **argv) @@ -1525,20 +1532,22 @@ static int lfs_quotaoff(int argc, char **argv) mnt = argv[optind]; rc = llapi_quotactl(mnt, &qctl); - if (rc == -1 && errno == ESRCH) { - fprintf(stderr, "\n%s quotas are not enabled.\n", - qctl.qc_type == 0x00 ? "user" : "group"); - return 0; - } if (rc) { - if (*obd_type) - fprintf(stderr, "%s %s ", obd_type, - obd_uuid2str(&qctl.obd_uuid)); - fprintf(stderr, "quotaoff failed: %s\n", strerror(errno)); - return rc; + if (errno == EALREADY) { + fprintf(stderr, "\n%s quotas are disabled already.\n", + qctl.qc_type == 0x02 ? "user/group" : + (qctl.qc_type == 0x00 ? "user" : "group")); + rc = 0; + } else { + if (*obd_type) + fprintf(stderr, "%s %s ", obd_type, + obd_uuid2str(&qctl.obd_uuid)); + fprintf(stderr, "quotaoff failed: %s\n", + strerror(errno)); + } } - return 0; + return rc; } static int lfs_quotainv(int argc, char **argv) @@ -2184,7 +2193,7 @@ ug_output: mnt = argv[optind]; rc1 = llapi_quotactl(mnt, &qctl); - if (rc1 == -1 && errno == ESRCH) { + if (rc1 == -1 && errno == EALREADY) { fprintf(stderr, "\n%s quotas are not enabled.\n", qctl.qc_type == USRQUOTA ? "user" : "group"); goto out;