OST_STATFS = 13,
OST_SYNC = 16,
OST_SET_INFO = 17,
- OST_QUOTACHECK = 18,
+ OST_QUOTACHECK = 18, /* not used since 2.4 */
OST_QUOTACTL = 19,
OST_QUOTA_ADJUST_QUNIT = 20, /* not used since 2.4 */
OST_LAST_OPC
MDS_SYNC = 44,
MDS_DONE_WRITING = 45, /* obsolete since 2.8.0 */
MDS_SET_INFO = 46,
- MDS_QUOTACHECK = 47,
+ MDS_QUOTACHECK = 47, /* not used since 2.4 */
MDS_QUOTACTL = 48,
MDS_GETXATTR = 49,
MDS_SETXATTR = 50, /* obsolete, now it's MDS_REINT op */
typedef enum {
OBD_PING = 400,
OBD_LOG_CANCEL,
- OBD_QC_CALLBACK,
+ OBD_QC_CALLBACK, /* not used since 2.4 */
OBD_IDX_READ,
OBD_LAST_OPC
} obd_cmd_t;
#define Q_FINVALIDATE 0x800104 /* deprecated as of 2.4 */
/* these must be explicitly translated into linux Q_* in ll_dir_ioctl */
-#define LUSTRE_Q_QUOTAON 0x800002 /* turn quotas on */
-#define LUSTRE_Q_QUOTAOFF 0x800003 /* turn quotas off */
+#define LUSTRE_Q_QUOTAON 0x800002 /* deprecated as of 2.4 */
+#define LUSTRE_Q_QUOTAOFF 0x800003 /* deprecated as of 2.4 */
#define LUSTRE_Q_GETINFO 0x800005 /* get information about quota files */
#define LUSTRE_Q_SETINFO 0x800006 /* set information about quota files */
#define LUSTRE_Q_GETQUOTA 0x800007 /* get user quota structure */
#define LUSTRE_Q_SETQUOTA 0x800008 /* set user quota structure */
/* lustre-specific control commands */
-#define LUSTRE_Q_INVALIDATE 0x80000b /* invalidate quota data */
-#define LUSTRE_Q_FINVALIDATE 0x80000c /* invalidate filter quota data */
+#define LUSTRE_Q_INVALIDATE 0x80000b /* deprecated as of 2.4 */
+#define LUSTRE_Q_FINVALIDATE 0x80000c /* deprecated as of 2.4 */
#define UGQUOTA 2 /* set both USRQUOTA and GRPQUOTA */
-struct if_quotacheck {
- char obd_type[16];
- struct obd_uuid obd_uuid;
-};
-
#define IDENTITY_DOWNCALL_MAGIC 0x6d6dd629
/* permission */
#define HAVE_LLAPI_IS_LUSTRE_MNT
extern int llapi_is_lustre_mnt(struct mntent *mnt);
extern int llapi_quotachown(char *path, int flag);
-extern int llapi_quotacheck(char *mnt, int check_type);
-extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
extern int llapi_target_iterate(int type_num, char **obd_type, void *args,
llapi_cb_t cb);
/* OBD_IOC_LOV_GETSTRIPE 155 LL_IOC_LOV_GETSTRIPE */
/* OBD_IOC_LOV_SETEA 156 LL_IOC_LOV_SETEA */
/* lustre/lustre_user.h 157-159 */
-#define OBD_IOC_QUOTACHECK _IOW ('f', 160, int)
-#define OBD_IOC_POLL_QUOTACHECK _IOR ('f', 161, struct if_quotacheck *)
+/* OBD_IOC_QUOTACHECK _IOW ('f', 160, int) */
+/* OBD_IOC_POLL_QUOTACHECK _IOR ('f', 161, struct if_quotacheck *) */
#define OBD_IOC_QUOTACTL _IOWR('f', 162, struct if_quotactl)
/* lustre/lustre_user.h 163-176 */
#define OBD_IOC_CHANGELOG_REG _IOW ('f', 177, struct obd_ioctl_data)
extern struct req_format RQF_MDS_REINT_RENAME;
extern struct req_format RQF_MDS_REINT_SETATTR;
extern struct req_format RQF_MDS_REINT_SETXATTR;
-extern struct req_format RQF_MDS_QUOTACHECK;
extern struct req_format RQF_MDS_QUOTACTL;
-extern struct req_format RQF_QC_CALLBACK;
extern struct req_format RQF_QUOTA_DQACQ;
extern struct req_format RQF_MDS_SWAP_LAYOUTS;
/* MDS hsm formats */
/* OST req_format */
extern struct req_format RQF_OST_CONNECT;
extern struct req_format RQF_OST_DISCONNECT;
-extern struct req_format RQF_OST_QUOTACHECK;
extern struct req_format RQF_OST_QUOTACTL;
extern struct req_format RQF_OST_GETATTR;
extern struct req_format RQF_OST_SETATTR;
/* also protected by the poorly named _loi_list_lock lock above */
struct osc_async_rc cl_ar;
- /* used by quotacheck when the servers are older than 2.4 */
- int cl_qchk_stat; /* quotacheck stat of the peer */
-#define CL_NOT_QUOTACHECKED 1 /* client->cl_qchk_stat init value */
-#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 7, 53, 0)
-#warning "please consider removing quotacheck compatibility code"
-#endif
-
/* sequence manager */
struct lu_client_seq *cl_seq;
struct obd_uuid *(*o_get_uuid) (struct obd_export *exp);
/* quota methods */
- int (*o_quotacheck)(struct obd_device *, struct obd_export *,
- struct obd_quotactl *);
int (*o_quotactl)(struct obd_device *, struct obd_export *,
struct obd_quotactl *);
return rc1 ? rc1 : rc2;
}
-static inline int obd_quotacheck(struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- int rc;
- ENTRY;
-
- EXP_CHECK_DT_OP(exp, quotacheck);
- EXP_COUNTER_INCREMENT(exp, quotacheck);
-
- rc = OBP(exp->exp_obd, quotacheck)(exp->exp_obd, exp, oqctl);
- RETURN(rc);
-}
-
static inline int obd_quotactl(struct obd_export *exp,
struct obd_quotactl *oqctl)
{
#define OBD_FAIL_MDS_STATFS_LCW_SLEEP 0x12a
#define OBD_FAIL_MDS_OPEN_CREATE 0x12b
#define OBD_FAIL_MDS_OST_SETATTR 0x12c
-#define OBD_FAIL_MDS_QUOTACHECK_NET 0x12d
+/* OBD_FAIL_MDS_QUOTACHECK_NET 0x12d obsolete since 2.4 */
#define OBD_FAIL_MDS_QUOTACTL_NET 0x12e
#define OBD_FAIL_MDS_CLIENT_ADD 0x12f
#define OBD_FAIL_MDS_GETXATTR_NET 0x130
#define OBD_FAIL_OST_ENOSPC 0x215
#define OBD_FAIL_OST_EROFS 0x216
#define OBD_FAIL_OST_ENOENT 0x217
-#define OBD_FAIL_OST_QUOTACHECK_NET 0x218
+/* OBD_FAIL_OST_QUOTACHECK_NET 0x218 obsolete since 2.4 */
#define OBD_FAIL_OST_QUOTACTL_NET 0x219
#define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a
#define OBD_FAIL_OST_CHECKSUM_SEND 0x21b
#define OBD_FAIL_OBD_PING_NET 0x600
#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
#define OBD_FAIL_OBD_LOGD_NET 0x602
-#define OBD_FAIL_OBD_QC_CALLBACK_NET 0x603
+/* OBD_FAIL_OBD_QC_CALLBACK_NET 0x603 obsolete since 2.4 */
#define OBD_FAIL_OBD_DQACQ 0x604
#define OBD_FAIL_OBD_LLOG_SETUP 0x605
#define OBD_FAIL_OBD_LOG_CANCEL_REP 0x606
GOTO(err_import, rc = -ENOMEM);
}
- cli->cl_qchk_stat = CL_NOT_QUOTACHECKED;
-
RETURN(rc);
err_import:
CWARN("Send reply failed, maybe cause bug 21636.\n");
}
-static int ldlm_handle_qc_callback(struct ptlrpc_request *req)
-{
- struct obd_quotactl *oqctl;
- struct client_obd *cli = &req->rq_export->exp_obd->u.cli;
-
- oqctl = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
- if (oqctl == NULL) {
- CERROR("Can't unpack obd_quotactl\n");
- RETURN(-EPROTO);
- }
-
- oqctl->qc_stat = ptlrpc_status_ntoh(oqctl->qc_stat);
-
- cli->cl_qchk_stat = oqctl->qc_stat;
- return 0;
-}
-
/* TODO: handle requests in a similar way as MDT: see mdt_handle_common() */
static int ldlm_callback_handler(struct ptlrpc_request *req)
{
rc = llog_origin_handle_close(req);
ldlm_callback_reply(req, rc);
RETURN(0);
- case OBD_QC_CALLBACK:
- req_capsule_set(&req->rq_pill, &RQF_QC_CALLBACK);
- if (OBD_FAIL_CHECK(OBD_FAIL_OBD_QC_CALLBACK_NET))
- RETURN(0);
- rc = ldlm_handle_qc_callback(req);
- ldlm_callback_reply(req, rc);
- RETURN(0);
default:
CERROR("unknown opcode %u\n",
lustre_msg_get_opc(req->rq_reqmsg));
ENTRY;
switch (cmd) {
- case LUSTRE_Q_INVALIDATE:
- case LUSTRE_Q_FINVALIDATE:
- case Q_QUOTAON:
- case Q_QUOTAOFF:
case Q_SETQUOTA:
case Q_SETINFO:
if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
QCTL_COPY(oqctl, qctl);
rc = obd_quotactl(sbi->ll_md_exp, oqctl);
if (rc) {
- if (rc != -EALREADY && cmd == Q_QUOTAON) {
- oqctl->qc_cmd = Q_QUOTAOFF;
- obd_quotactl(sbi->ll_md_exp, oqctl);
- }
OBD_FREE_PTR(oqctl);
RETURN(rc);
}
ll_putname(filename);
return rc;
}
- case OBD_IOC_QUOTACHECK: {
- struct obd_quotactl *oqctl;
- int error = 0;
-
- if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
- sbi->ll_flags & LL_SBI_RMT_CLIENT)
- RETURN(-EPERM);
-
- OBD_ALLOC_PTR(oqctl);
- if (!oqctl)
- RETURN(-ENOMEM);
- oqctl->qc_type = arg;
- rc = obd_quotacheck(sbi->ll_md_exp, oqctl);
- if (rc < 0) {
- CDEBUG(D_INFO, "md_quotacheck failed: rc %d\n", rc);
- error = rc;
- }
-
- rc = obd_quotacheck(sbi->ll_dt_exp, oqctl);
- if (rc < 0)
- CDEBUG(D_INFO, "obd_quotacheck failed: rc %d\n", rc);
-
- OBD_FREE_PTR(oqctl);
- return error ?: rc;
- }
- case OBD_IOC_POLL_QUOTACHECK: {
- struct if_quotacheck *check;
-
- if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
- sbi->ll_flags & LL_SBI_RMT_CLIENT)
- RETURN(-EPERM);
-
- OBD_ALLOC_PTR(check);
- if (!check)
- RETURN(-ENOMEM);
-
- rc = obd_iocontrol(cmd, sbi->ll_md_exp, 0, (void *)check,
- NULL);
- if (rc) {
- CDEBUG(D_QUOTA, "mdc ioctl %d failed: %d\n", cmd, rc);
- if (copy_to_user((void __user *)arg, check,
- sizeof(*check)))
- CDEBUG(D_QUOTA, "copy_to_user failed\n");
- GOTO(out_poll, rc);
- }
-
- rc = obd_iocontrol(cmd, sbi->ll_dt_exp, 0, (void *)check,
- NULL);
- if (rc) {
- CDEBUG(D_QUOTA, "osc ioctl %d failed: %d\n", cmd, rc);
- if (copy_to_user((void __user *)arg, check,
- sizeof(*check)))
- CDEBUG(D_QUOTA, "copy_to_user failed\n");
- GOTO(out_poll, rc);
- }
- out_poll:
- OBD_FREE_PTR(check);
- RETURN(rc);
- }
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0)
- case LL_IOC_QUOTACTL_18: {
- /* copy the old 1.x quota struct for internal use, then copy
- * back into old format struct. For 1.8 compatibility. */
- struct if_quotactl_18 *qctl_18;
- struct if_quotactl *qctl_20;
-
- OBD_ALLOC_PTR(qctl_18);
- if (!qctl_18)
- RETURN(-ENOMEM);
-
- OBD_ALLOC_PTR(qctl_20);
- if (!qctl_20)
- GOTO(out_quotactl_18, rc = -ENOMEM);
-
- if (copy_from_user(qctl_18, (void __user *)arg,
- sizeof(*qctl_18)))
- GOTO(out_quotactl_20, rc = -ENOMEM);
-
- QCTL_COPY(qctl_20, qctl_18);
- qctl_20->qc_idx = 0;
-
- /* XXX: dqb_valid was borrowed as a flag to mark that
- * only mds quota is wanted */
- if (qctl_18->qc_cmd == Q_GETQUOTA &&
- qctl_18->qc_dqblk.dqb_valid) {
- qctl_20->qc_valid = QC_MDTIDX;
- qctl_20->qc_dqblk.dqb_valid = 0;
- } else if (qctl_18->obd_uuid.uuid[0] != '\0') {
- qctl_20->qc_valid = QC_UUID;
- qctl_20->obd_uuid = qctl_18->obd_uuid;
- } else {
- qctl_20->qc_valid = QC_GENERAL;
- }
-
- rc = quotactl_ioctl(sbi, qctl_20);
-
- if (rc == 0) {
- QCTL_COPY(qctl_18, qctl_20);
- qctl_18->obd_uuid = qctl_20->obd_uuid;
-
- if (copy_to_user((void __user *)arg, qctl_18,
- sizeof(*qctl_18)))
- rc = -EFAULT;
- }
-
- out_quotactl_20:
- OBD_FREE_PTR(qctl_20);
- out_quotactl_18:
- OBD_FREE_PTR(qctl_18);
- RETURN(rc);
- }
-#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0) */
case OBD_IOC_QUOTACTL: {
struct if_quotactl *qctl;
spin_unlock(&dentry->d_lock);
}
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0)
-/* Compatibility for old (1.8) compiled userspace quota code */
-struct if_quotactl_18 {
- __u32 qc_cmd;
- __u32 qc_type;
- __u32 qc_id;
- __u32 qc_stat;
- struct obd_dqinfo qc_dqinfo;
- struct obd_dqblk qc_dqblk;
- char obd_type[16];
- struct obd_uuid obd_uuid;
-};
-#define LL_IOC_QUOTACTL_18 _IOWR('f', 162, struct if_quotactl_18 *)
-/* End compatibility for old (1.8) compiled userspace quota code */
-#endif /* LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0) */
-
int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf);
int ll_layout_refresh(struct inode *inode, __u32 *gen);
int ll_layout_restore(struct inode *inode, loff_t start, __u64 length);
mdc_obd = class_exp2obd(tgt->ltd_exp);
mdc_obd->obd_force = obddev->obd_force;
err = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg);
- if (err == -ENODATA && cmd == OBD_IOC_POLL_QUOTACHECK) {
- RETURN(err);
- } else if (err) {
+ if (err) {
if (tgt->ltd_active) {
CERROR("error: iocontrol MDC %s on MDT"
" idx %d cmd %x: err = %d\n",
RETURN(rc);
}
-int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct obd_device *obd = class_exp2obd(exp);
- struct lmv_obd *lmv = &obd->u.lmv;
- struct lmv_tgt_desc *tgt;
- __u32 i;
- int rc = 0;
- ENTRY;
-
- for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
- int err;
- tgt = lmv->tgts[i];
- if (tgt == NULL || tgt->ltd_exp == NULL || !tgt->ltd_active) {
- CERROR("lmv idx %d inactive\n", i);
- RETURN(-EIO);
- }
-
- err = obd_quotacheck(tgt->ltd_exp, oqctl);
- if (err && !rc)
- rc = err;
- }
-
- RETURN(rc);
-}
-
static int lmv_merge_attr(struct obd_export *exp,
const struct lmv_stripe_md *lsm,
struct cl_attr *attr,
.o_notify = lmv_notify,
.o_get_uuid = lmv_get_uuid,
.o_iocontrol = lmv_iocontrol,
- .o_quotacheck = lmv_quotacheck,
.o_quotactl = lmv_quotactl
};
osc_obd->obd_force = obddev->obd_force;
err = obd_iocontrol(cmd, lov->lov_tgts[i]->ltd_exp,
len, karg, uarg);
- if (err == -ENODATA && cmd == OBD_IOC_POLL_QUOTACHECK) {
- RETURN(err);
- } else if (err) {
+ if (err) {
if (lov->lov_tgts[i]->ltd_active) {
CDEBUG(err == -ENOTTY ?
D_IOCTL : D_WARNING,
int i, rc = 0;
ENTRY;
- if (oqctl->qc_cmd != LUSTRE_Q_QUOTAON &&
- oqctl->qc_cmd != LUSTRE_Q_QUOTAOFF &&
- oqctl->qc_cmd != Q_GETOQUOTA &&
- oqctl->qc_cmd != Q_INITQUOTA &&
- oqctl->qc_cmd != LUSTRE_Q_SETQUOTA &&
- oqctl->qc_cmd != Q_FINVALIDATE) {
+ if (oqctl->qc_cmd != Q_GETOQUOTA &&
+ oqctl->qc_cmd != LUSTRE_Q_SETQUOTA) {
CERROR("%s: bad quota opc %x for lov obd\n",
obd->obd_name, oqctl->qc_cmd);
RETURN(-EFAULT);
RETURN(rc);
}
-static int lov_quotacheck(struct obd_device *obd, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct lov_obd *lov = &obd->u.lov;
- int i, rc = 0;
- ENTRY;
-
- obd_getref(obd);
-
- for (i = 0; i < lov->desc.ld_tgt_count; i++) {
- if (!lov->lov_tgts[i])
- continue;
-
- /* Skip quota check on the administratively disabled OSTs. */
- if (!lov->lov_tgts[i]->ltd_activate) {
- CWARN("lov idx %d was administratively disabled, "
- "skip quotacheck on it.\n", i);
- continue;
- }
-
- if (!lov->lov_tgts[i]->ltd_active) {
- CERROR("lov idx %d inactive\n", i);
- rc = -EIO;
- goto out;
- }
- }
-
- for (i = 0; i < lov->desc.ld_tgt_count; i++) {
- int err;
-
- if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_activate)
- continue;
-
- err = obd_quotacheck(lov->lov_tgts[i]->ltd_exp, oqctl);
- if (err && !rc)
- rc = err;
- }
-
-out:
- obd_putref(obd);
-
- RETURN(rc);
-}
-
static struct obd_ops lov_obd_ops = {
.o_owner = THIS_MODULE,
.o_setup = lov_setup,
.o_getref = lov_getref,
.o_putref = lov_putref,
.o_quotactl = lov_quotactl,
- .o_quotacheck = lov_quotacheck,
};
struct kmem_cache *lov_oinfo_slab;
static int mdc_ioc_hsm_ct_start(struct obd_export *exp,
struct lustre_kernelcomm *lk);
-static int mdc_quotacheck(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct client_obd *cli = &exp->exp_obd->u.cli;
- struct ptlrpc_request *req;
- struct obd_quotactl *body;
- int rc;
- ENTRY;
-
- req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
- &RQF_MDS_QUOTACHECK, LUSTRE_MDS_VERSION,
- MDS_QUOTACHECK);
- if (req == NULL)
- RETURN(-ENOMEM);
-
- body = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
- *body = *oqctl;
-
- ptlrpc_request_set_replen(req);
-
- /* the next poll will find -ENODATA, that means quotacheck is
- * going on */
- cli->cl_qchk_stat = -ENODATA;
- rc = ptlrpc_queue_wait(req);
- if (rc)
- cli->cl_qchk_stat = rc;
- ptlrpc_req_finished(req);
- RETURN(rc);
-}
-
-static int mdc_quota_poll_check(struct obd_export *exp,
- struct if_quotacheck *qchk)
-{
- struct client_obd *cli = &exp->exp_obd->u.cli;
- int rc;
- ENTRY;
-
- qchk->obd_uuid = cli->cl_target_uuid;
- memcpy(qchk->obd_type, LUSTRE_MDS_NAME, strlen(LUSTRE_MDS_NAME));
-
- rc = cli->cl_qchk_stat;
- /* the client is not the previous one */
- if (rc == CL_NOT_QUOTACHECKED)
- rc = -EINTR;
- RETURN(rc);
-}
-
static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp,
struct obd_quotactl *oqctl)
{
case IOC_OSC_SET_ACTIVE:
rc = ptlrpc_set_import_active(imp, data->ioc_offset);
GOTO(out, rc);
- case OBD_IOC_POLL_QUOTACHECK:
- rc = mdc_quota_poll_check(exp, (struct if_quotacheck *)karg);
- GOTO(out, rc);
case OBD_IOC_PING_TARGET:
rc = ptlrpc_obd_ping(obd);
GOTO(out, rc);
.o_process_config = mdc_process_config,
.o_get_uuid = mdc_get_uuid,
.o_quotactl = mdc_quotactl,
- .o_quotacheck = mdc_quotacheck
};
static struct md_ops mdc_md_ops = {
RETURN(err_serious(rc));
switch (oqctl->qc_cmd) {
- case Q_QUOTACHECK:
- case LUSTRE_Q_INVALIDATE:
- case LUSTRE_Q_FINVALIDATE:
- case Q_QUOTAON:
- case Q_QUOTAOFF:
- case Q_INITQUOTA:
- /* deprecated, not used any more */
- RETURN(-EOPNOTSUPP);
/* master quotactl */
case Q_SETINFO:
case Q_SETQUOTA:
LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, health_check);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, get_uuid);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotacheck);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, quotactl);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, ping);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, pool_new);
if (repoqc == NULL)
RETURN(err_serious(-ENOMEM));
- /* report success for quota on/off for interoperability with current MDT
- * stack */
- if (oqctl->qc_cmd == Q_QUOTAON || oqctl->qc_cmd == Q_QUOTAOFF)
- RETURN(0);
-
*repoqc = *oqctl;
id = repoqc->qc_id;
int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[]);
int osc_quotactl(struct obd_device *unused, struct obd_export *exp,
struct obd_quotactl *oqctl);
-int osc_quotacheck(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl);
-int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk);
void osc_inc_unstable_pages(struct ptlrpc_request *req);
void osc_dec_unstable_pages(struct ptlrpc_request *req);
bool osc_over_unstable_soft_limit(struct client_obd *cli);
RETURN(rc);
}
-
-int osc_quotacheck(struct obd_device *unused, struct obd_export *exp,
- struct obd_quotactl *oqctl)
-{
- struct client_obd *cli = &exp->exp_obd->u.cli;
- struct ptlrpc_request *req;
- struct obd_quotactl *body;
- int rc;
- ENTRY;
-
- req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
- &RQF_OST_QUOTACHECK, LUSTRE_OST_VERSION,
- OST_QUOTACHECK);
- if (req == NULL)
- RETURN(-ENOMEM);
-
- body = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
- *body = *oqctl;
-
- ptlrpc_request_set_replen(req);
-
- /* the next poll will find -ENODATA, that means quotacheck is
- * going on */
- cli->cl_qchk_stat = -ENODATA;
- rc = ptlrpc_queue_wait(req);
- if (rc)
- cli->cl_qchk_stat = rc;
- ptlrpc_req_finished(req);
- RETURN(rc);
-}
-
-int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk)
-{
- struct client_obd *cli = &exp->exp_obd->u.cli;
- int rc;
- ENTRY;
-
- qchk->obd_uuid = cli->cl_target_uuid;
- memcpy(qchk->obd_type, LUSTRE_OST_NAME, strlen(LUSTRE_OST_NAME));
-
- rc = cli->cl_qchk_stat;
- /* the client is not the previous one */
- if (rc == CL_NOT_QUOTACHECKED)
- rc = -EINTR;
- RETURN(rc);
-}
err = ptlrpc_set_import_active(obd->u.cli.cl_import,
data->ioc_offset);
GOTO(out, err);
- case OBD_IOC_POLL_QUOTACHECK:
- err = osc_quota_poll_check(exp, (struct if_quotacheck *)karg);
- GOTO(out, err);
case OBD_IOC_PING_TARGET:
err = ptlrpc_obd_ping(obd);
GOTO(out, err);
.o_import_event = osc_import_event,
.o_process_config = osc_process_config,
.o_quotactl = osc_quotactl,
- .o_quotacheck = osc_quotacheck,
};
static int __init osc_init(void)
&RQF_MDS_REINT_RENAME,
&RQF_MDS_REINT_SETATTR,
&RQF_MDS_REINT_SETXATTR,
- &RQF_MDS_QUOTACHECK,
&RQF_MDS_QUOTACTL,
&RQF_MDS_HSM_PROGRESS,
&RQF_MDS_HSM_CT_REGISTER,
&RQF_MDS_HSM_REQUEST,
&RQF_MDS_SWAP_LAYOUTS,
&RQF_OUT_UPDATE,
- &RQF_QC_CALLBACK,
&RQF_OST_CONNECT,
&RQF_OST_DISCONNECT,
- &RQF_OST_QUOTACHECK,
&RQF_OST_QUOTACTL,
&RQF_OST_GETATTR,
&RQF_OST_SETATTR,
DEFINE_REQ_FMT0("OBD_LOG_CANCEL", log_cancel_client, empty);
EXPORT_SYMBOL(RQF_LOG_CANCEL);
-struct req_format RQF_MDS_QUOTACHECK =
- DEFINE_REQ_FMT0("MDS_QUOTACHECK", quotactl_only, empty);
-EXPORT_SYMBOL(RQF_MDS_QUOTACHECK);
-
-struct req_format RQF_OST_QUOTACHECK =
- DEFINE_REQ_FMT0("OST_QUOTACHECK", quotactl_only, empty);
-EXPORT_SYMBOL(RQF_OST_QUOTACHECK);
-
struct req_format RQF_MDS_QUOTACTL =
DEFINE_REQ_FMT0("MDS_QUOTACTL", quotactl_only, quotactl_only);
EXPORT_SYMBOL(RQF_MDS_QUOTACTL);
DEFINE_REQ_FMT0("OST_QUOTACTL", quotactl_only, quotactl_only);
EXPORT_SYMBOL(RQF_OST_QUOTACTL);
-struct req_format RQF_QC_CALLBACK =
- DEFINE_REQ_FMT0("QC_CALLBACK", quotactl_only, empty);
-EXPORT_SYMBOL(RQF_QC_CALLBACK);
-
struct req_format RQF_QUOTA_DQACQ =
DEFINE_REQ_FMT0("QUOTA_DQACQ", quota_body_only, quota_body_only);
EXPORT_SYMBOL(RQF_QUOTA_DQACQ);
dqb->dqb_valid & QIF_BFLAGS);
break;
- case Q_QUOTAON:
- case Q_QUOTAOFF: /* quota is always turned on on the master */
- RETURN(0);
-
- case LUSTRE_Q_INVALIDATE: /* not supported any more */
- RETURN(-ENOTSUPP);
-
default:
CERROR("%s: unsupported quotactl command: %d\n",
qmt->qmt_svname, oqctl->qc_cmd);
return err_serious(-EOPNOTSUPP);
}
-int tgt_obd_qc_callback(struct tgt_session_info *tsi)
-{
- return err_serious(-EOPNOTSUPP);
-}
-
int tgt_sendpage(struct tgt_session_info *tsi, struct lu_rdpg *rdpg, int nob)
{
struct tgt_thread_info *tti = tgt_th_info(tsi->tsi_env);
struct tgt_handler tgt_obd_handlers[] = {
TGT_OBD_HDL (0, OBD_PING, tgt_obd_ping),
TGT_OBD_HDL_VAR(0, OBD_LOG_CANCEL, tgt_obd_log_cancel),
-TGT_OBD_HDL_VAR(0, OBD_QC_CALLBACK, tgt_obd_qc_callback),
TGT_OBD_HDL (0, OBD_IDX_READ, tgt_obd_idx_read)
};
EXPORT_SYMBOL(tgt_obd_handlers);
static int lfs_getname(int argc, char **argv);
static int lfs_check(int argc, char **argv);
#ifdef HAVE_SYS_QUOTA_H
-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);
#endif
"[for specified path only]\n"
"Usage: getname [-h]|[path ...] "},
#ifdef HAVE_SYS_QUOTA_H
- {"quotacheck", lfs_quotacheck, 0,
- "Scan the specified filesystem for disk usage, and create,\n"
- "or update quota files. Deprecated as of 2.4.0.\n"
- "usage: quotacheck [ -ug ] <filesystem>"},
- {"quotaon", lfs_quotaon, 0, "Turn filesystem"
- " quotas on. Deprecated as of 2.4.0.\n"
- "usage: quotaon [ -ugf ] <filesystem>"},
- {"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"
}
#ifdef HAVE_SYS_QUOTA_H
-static int lfs_quotacheck(int argc, char **argv)
-{
- int c, check_type = 0;
- char *mnt;
- struct if_quotacheck qchk;
- struct if_quotactl qctl;
- char *obd_type = (char *)qchk.obd_type;
- int rc;
-
- memset(&qchk, 0, sizeof(qchk));
-
- while ((c = getopt(argc, argv, "gu")) != -1) {
- switch (c) {
- case 'u':
- check_type |= 0x01;
- break;
- case 'g':
- check_type |= 0x02;
- break;
- default:
- fprintf(stderr, "error: %s: option '-%c' "
- "unrecognized\n", argv[0], c);
- return CMD_HELP;
- }
- }
-
- if (check_type)
- check_type--;
- else /* do quotacheck for both user & group quota by default */
- check_type = 0x02;
-
- if (argc == optind)
- return CMD_HELP;
-
- mnt = argv[optind];
-
- rc = llapi_quotacheck(mnt, check_type);
- 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;
- }
-
- rc = llapi_poll_quotacheck(mnt, &qchk);
- if (rc) {
- if (*obd_type)
- fprintf(stderr, "%s %s ", obd_type,
- obd_uuid2str(&qchk.obd_uuid));
- fprintf(stderr, "quota check failed: %s\n", strerror(-rc));
- return rc;
- }
-
- memset(&qctl, 0, sizeof(qctl));
- qctl.qc_cmd = LUSTRE_Q_QUOTAON;
- qctl.qc_type = check_type;
- rc = llapi_quotactl(mnt, &qctl);
- if (rc && rc != -EALREADY) {
- if (*obd_type)
- fprintf(stderr, "%s %s ", (char *)qctl.obd_type,
- obd_uuid2str(&qctl.obd_uuid));
- fprintf(stderr, "%s turn on quota failed: %s\n",
- argv[0], strerror(-rc));
- return rc;
- }
-
- return 0;
-}
-
-static int lfs_quotaon(int argc, char **argv)
-{
- int c;
- char *mnt;
- struct if_quotactl qctl;
- char *obd_type = (char *)qctl.obd_type;
- int rc;
-
- memset(&qctl, 0, sizeof(qctl));
- qctl.qc_cmd = LUSTRE_Q_QUOTAON;
-
- 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_QUOTAOFF;
- 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, enable 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) {
- 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, "
- "make sure you have run quotacheck\n");
- } else {
- if (*obd_type)
- fprintf(stderr, "%s %s ", obd_type,
- obd_uuid2str(&qctl.obd_uuid));
- fprintf(stderr, "%s failed: %s\n", argv[0],
- strerror(-rc));
- }
- }
-
- return rc;
-}
-
-static int lfs_quotaoff(int argc, char **argv)
-{
- int c;
- char *mnt;
- struct if_quotactl qctl;
- char *obd_type = (char *)qctl.obd_type;
- int rc;
-
- memset(&qctl, 0, sizeof(qctl));
- qctl.qc_cmd = LUSTRE_Q_QUOTAOFF;
-
- while ((c = getopt(argc, argv, "gu")) != -1) {
- switch (c) {
- case 'u':
- qctl.qc_type |= 0x01;
- break;
- case 'g':
- qctl.qc_type |= 0x02;
- 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, disable 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) {
- 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)
- fprintf(stderr, "%s %s ", obd_type,
- obd_uuid2str(&qctl.obd_uuid));
- fprintf(stderr, "quotaoff failed: %s\n",
- strerror(-rc));
- }
- }
-
- return rc;
-}
-
#define ARG2INT(nr, str, msg) \
do { \
char *endp; \
strstr(mnt->mnt_fsname, ":/") != NULL);
}
-int llapi_quotacheck(char *mnt, int check_type)
-{
- DIR *root;
- int rc;
-
- root = opendir(mnt);
- if (!root) {
- rc = -errno;
- llapi_error(LLAPI_MSG_ERROR, rc, "open %s failed", mnt);
- return rc;
- }
-
- rc = ioctl(dirfd(root), OBD_IOC_QUOTACHECK, check_type);
- if (rc < 0)
- rc = -errno;
-
- closedir(root);
- return rc;
-}
-
-int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk)
-{
- DIR *root;
- int poll_intvl = 2;
- int rc;
-
- root = opendir(mnt);
- if (!root) {
- rc = -errno;
- llapi_error(LLAPI_MSG_ERROR, rc, "open %s failed", mnt);
- return rc;
- }
-
- while (1) {
- rc = ioctl(dirfd(root), OBD_IOC_POLL_QUOTACHECK, qchk);
- if (!rc)
- break;
- sleep(poll_intvl);
- if (poll_intvl < 30)
- poll_intvl *= 2;
- }
-
- closedir(root);
- return 0;
-}
-
int llapi_quotactl(char *mnt, struct if_quotactl *qctl)
{
DIR *root;