"Usage: getname [--help|-h] [--instance|-i] [--fsname|-n] [path ...]"},
#ifdef HAVE_SYS_QUOTA_H
{"setquota", lfs_setquota, 0, "Set filesystem quotas.\n"
- "usage: setquota [-t][-d] {-u|-U|-g|-G|-p|-P} {-b|-B|-i|-I LIMIT} [--pool POOL] FILESYSTEM"},
+ "usage: setquota [-t][-D] {-u|-U|-g|-G|-p|-P} {-b|-B|-i|-I LIMIT} [--pool POOL] FILESYSTEM\n"
+ " setquota {-u|-g|-p} --delete FILESYSTEM\n"},
{"quota", lfs_quota, 0, "Display disk usage and limits.\n"
"usage: quota [-q] [-v] [-h] [-o OBD_UUID|-i MDT_IDX|-I OST_IDX]\n"
" [{-u|-g|-p} UNAME|UID|GNAME|GID|PROJID]\n"
" set project ID and/or inherit flag for specified file(s) or directories\n"
" project -c [-d|-r [-p id] [-0]] <file|directory...>\n"
" check project ID and flags on file(s) or directories, print outliers\n"
- " project -C [-r] [-k] <file|directory...>\n"
+ " project -C [-d|-r] [-k] <file|directory...>\n"
" clear the project inherit flag and ID on the file or directory\n"
},
#endif
int i;
/* numeric hash type */
- if (hashtype && strlen(hashtype) == 1 &&
- (type_num > 0 && type_num < LMV_HASH_TYPE_MAX))
+ if (hashtype && lmv_is_known_hash_type(type_num))
return type_num;
/* string hash type */
- for (i = LMV_HASH_TYPE_ALL_CHARS; i < LMV_HASH_TYPE_MAX; i++)
+ for (i = LMV_HASH_TYPE_ALL_CHARS; i < ARRAY_SIZE(mdt_hash_name); i++)
if (strcmp(hashtype, mdt_hash_name[i]) == 0)
return i;
rc = -errno;
goto free_layout;
}
- rc = llapi_layout_sanity(layout, fname, false, true);
+ rc = llapi_layout_sanity(layout, false, true);
if (rc < 0) {
llapi_layout_sanity_perror(errno);
goto free_layout;
__u32 flag;
} mhflist[] = {
{"migrating", LMV_HASH_FLAG_MIGRATION},
+ {"bad_type", LMV_HASH_FLAG_BAD_TYPE},
{"badtype", LMV_HASH_FLAG_BAD_TYPE},
+ {"lost_lmv", LMV_HASH_FLAG_LOST_LMV},
{"lostlmv", LMV_HASH_FLAG_LOST_LMV},
};
return -ENODATA;
}
- rc = llapi_layout_sanity(layout, fname, false, true);
+ rc = llapi_layout_sanity(layout, false, true);
llapi_layout_free(layout);
}
}
- rc = llapi_layout_sanity(list->m_layout, fname, false, true);
+ rc = llapi_layout_sanity(list->m_layout, false, true);
if (rc) {
llapi_layout_sanity_perror(rc);
return rc;
return -EINVAL;
}
- rc = llapi_layout_sanity(layout, fname, false, true);
+ rc = llapi_layout_sanity(layout, false, true);
if (rc) {
llapi_layout_sanity_perror(rc);
goto free_layout;
data->lil_ids[1] = mirror_id;
rc = llapi_lease_set(fd, data);
if (rc <= 0) {
- if (rc == -EINVAL && purge) {
+ if ((rc == -EINVAL || rc == -EBUSY) && purge) {
/* could be old MDS which prohibit fd==fdv */
purge = false;
goto again;
}
enum {
+ LFS_SETQUOTA_DELETE = 1,
LFS_POOL_OPT = 3,
LFS_COMP_COUNT_OPT,
LFS_COMP_START_OPT,
case 'c':
errno = 0;
lsa.lsa_stripe_count = strtoul(optarg, &end, 0);
- if (errno != 0 || *end != '\0'||
+ if (errno != 0 || *end != '\0'|| optarg == end ||
lsa.lsa_stripe_count < -1 ||
lsa.lsa_stripe_count > LOV_MAX_STRIPE_COUNT) {
fprintf(stderr,
case 'i':
errno = 0;
lsa.lsa_stripe_off = strtol(optarg, &end, 0);
- if (errno != 0 || *end != '\0' ||
+ if (errno != 0 || *end != '\0' || optarg == end ||
lsa.lsa_stripe_off < -1 ||
lsa.lsa_stripe_off > LOV_V1_INSANE_STRIPE_COUNT) {
fprintf(stderr,
if (!(tp->st_op & ops))
continue;
- for (index = 0; ; index++) {
+ for (index = 0; index < LOV_ALL_STRIPES &&
+ (!lsb || lsb->sb_count < LL_STATFS_MAX); index++) {
memset(&stat_buf, 0, sizeof(struct obd_statfs));
memset(&uuid_buf, 0, sizeof(struct obd_uuid));
type = flags & MNTDF_LAZY ?
tp->st_op | LL_STATFS_NODELAY : tp->st_op;
rc2 = llapi_obd_fstatfs(fd, type, index,
- &stat_buf, &uuid_buf);
+ &stat_buf, &uuid_buf);
if (rc2 == -ENODEV)
break;
if (rc2 == -EAGAIN)
lsa.lsa_pattern = check_hashtype(optarg);
if (lsa.lsa_pattern == 0) {
fprintf(stderr,
- "%s %s: bad stripe hash type '%s'\n",
+ "%s %s: bad directory hash type '%s'\n",
progname, argv[0], optarg);
return CMD_HELP;
}
{ .val = 'B', .name = "block-hardlimit",
.has_arg = required_argument },
{ .val = 'd', .name = "default", .has_arg = no_argument },
+ { .val = LFS_SETQUOTA_DELETE,
+ .name = "delete", .has_arg = no_argument },
{ .val = 'g', .name = "group", .has_arg = required_argument },
{ .val = 'G', .name = "default-grp", .has_arg = no_argument },
{ .val = 'h', .name = "help", .has_arg = no_argument },
* so it can be used as a marker that qc_type
* isn't reinitialized from command line
*/
-
- while ((c = getopt_long(argc, argv, "b:B:dg:Ghi:I:p:Pu:U",
+ while ((c = getopt_long(argc, argv, "b:B:dDg:Ghi:I:p:Pu:U",
long_opts, NULL)) != -1) {
switch (c) {
case 'U':
}
qctl->qc_type = qtype;
break;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
case 'd':
- qctl->qc_cmd = LUSTRE_Q_SETDEFAULT;
+#if LUSTRE_VERSION_CODE > OBD_OCD_VERSION(2, 15, 53, 0)
+ fprintf(stderr, "'-d' deprecatd, use '-D' or '--default'\n");
+#endif
+ /* falltrrough */
+#endif
+ case 'D':
use_default = true;
+ qctl->qc_cmd = LUSTRE_Q_SETDEFAULT;
+ break;
+ case LFS_SETQUOTA_DELETE:
+ qctl->qc_cmd = LUSTRE_Q_DELETEQID;
break;
case 'b':
ARG2ULL(dqb->dqb_bsoftlimit, optarg, 1024);
goto out;
}
- if (!use_default && limit_mask == 0) {
+ if (!use_default && qctl->qc_cmd != LUSTRE_Q_DELETEQID &&
+ limit_mask == 0) {
fprintf(stderr,
"%s setquota: at least one limit must be specified\n",
progname);
goto out;
}
- if (use_default && limit_mask != 0) {
+ if ((use_default || qctl->qc_cmd == LUSTRE_Q_DELETEQID) &&
+ limit_mask != 0) {
fprintf(stderr,
- "%s setquota: limits should not be specified when using default quota\n",
+ "%s setquota: limits should not be specified when using default quota or deleting quota ID\n",
progname);
rc = CMD_HELP;
goto out;
goto out;
}
+ if (qctl->qc_cmd == LUSTRE_Q_DELETEQID && qctl->qc_id == 0) {
+ fprintf(stderr,
+ "%s setquota: can not delete root user/group/project\n",
+ progname);
+ rc = CMD_HELP;
+ goto out;
+ }
+
if (optind != argc - 1) {
fprintf(stderr,
"%s setquota: filesystem not specified or unexpected argument '%s'\n",
goto out;
}
+ /* no target for this index yet */
+ if (rc == -ENODEV) {
+ rc = 0;
+ continue;
+ }
+
+ /* inactive target */
+ if (rc == -ENODATA) {
+ char name[UUID_MAX+8];
+
+ snprintf(name, sizeof(name), "%s[inact]",
+ obd_uuid2str(&qctl->obd_uuid));
+ memset(&qctl->qc_dqinfo, 0,
+ sizeof(qctl->qc_dqinfo));
+ memset(&qctl->qc_dqblk, 0,
+ sizeof(qctl->qc_dqblk));
+ print_quota(name, qctl, qctl->qc_valid, 0, h,
+ false);
+ rc = 0;
+ continue;
+ }
+
if (!rc1)
rc1 = rc;
fprintf(stderr, "quotactl %s%d failed.\n",
* Return: void.
*/
static inline
-void print_checksums(struct verify_chunk *chunk, unsigned long *crc)
+void print_checksums(struct verify_chunk *chunk, unsigned long *crc,
+ unsigned long long pos, unsigned long long len)
{
int i;
fprintf(stdout,
- "CRC-32 checksum value for chunk "DEXT":\n",
- PEXT(&chunk->chunk));
+ "CRC-32 checksum value for chunk "DEXT":\n", pos, pos + len);
for (i = 0; i < chunk->mirror_count; i++)
fprintf(stdout, "Mirror %u:\t%#lx\n",
chunk->mirror_id[i], crc[i]);
goto error;
}
- chunks[idx].mirror_id[i] = mirror_id;
- i++;
if (i >= ARRAY_SIZE(chunks[idx].mirror_id)) {
fprintf(stderr,
"%s: mirror_id array is too small.\n",
rc = -EINVAL;
goto error;
}
+ chunks[idx].mirror_id[i] = mirror_id;
+ i++;
next:
rc = llapi_layout_comp_use(layout,
}
if (verbose)
- print_checksums(chunk, crc_array);
+ print_checksums(chunk, crc_array, pos, buflen);
/* compare CRC-32 checksum values */
for (i = 1; i < chunk->mirror_count; i++) {