When the cluster is upgraded from 1.8, client will not have LMV layer,
and the "ll_md_exp" is pointing to MDC directly, so the code which
assuming "ll_md_exp" as LMV need be revised:
- ll_dir_ioctl(LL_IOC_GETOBDCOUNT) should return 1 for MDC case;
- mdc_iocontrol() needs to handle the OBD_IOC_QUOTACTL as well when the
"ll_md_exp" is MDC;
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: I3659a5f8076125c9b2012826521c44540e65a75e
Reviewed-on: http://review.whamcloud.com/1236
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#define KEY_REGISTER_TARGET "register_target"
#define KEY_REVIMP_UPD "revimp_update"
#define KEY_SET_FS "set_fs"
#define KEY_REGISTER_TARGET "register_target"
#define KEY_REVIMP_UPD "revimp_update"
#define KEY_SET_FS "set_fs"
+#define KEY_TGT_COUNT "tgt_count"
/* KEY_SET_INFO in lustre_idl.h */
#define KEY_SPTLRPC_CONF "sptlrpc_conf"
#define KEY_CONNECT_FLAG "connect_flags"
/* KEY_SET_INFO in lustre_idl.h */
#define KEY_SPTLRPC_CONF "sptlrpc_conf"
#define KEY_CONNECT_FLAG "connect_flags"
}
#endif
case LL_IOC_GETOBDCOUNT: {
}
#endif
case LL_IOC_GETOBDCOUNT: {
+ int count, vallen;
+ struct obd_export *exp;
if (cfs_copy_from_user(&count, (int *)arg, sizeof(int)))
RETURN(-EFAULT);
if (cfs_copy_from_user(&count, (int *)arg, sizeof(int)))
RETURN(-EFAULT);
- if (!count) {
- /* get ost count */
- struct lov_obd *lov = &sbi->ll_dt_exp->exp_obd->u.lov;
- count = lov->desc.ld_tgt_count;
- } else {
- /* get mdt count */
- struct lmv_obd *lmv = &sbi->ll_md_exp->exp_obd->u.lmv;
- count = lmv->desc.ld_tgt_count;
+ /* get ost count when count is zero, get mdt count otherwise */
+ exp = count ? sbi->ll_md_exp : sbi->ll_dt_exp;
+ vallen = sizeof(count);
+ rc = obd_get_info(exp, sizeof(KEY_TGT_COUNT), KEY_TGT_COUNT,
+ &vallen, &count, NULL);
+ if (rc) {
+ CERROR("get target count failed: %d\n", rc);
+ RETURN(rc);
}
if (cfs_copy_to_user((int *)arg, &count, sizeof(int)))
}
if (cfs_copy_to_user((int *)arg, &count, sizeof(int)))
((struct obd_connect_data *)val)->ocd_connect_flags;
}
RETURN(rc);
((struct obd_connect_data *)val)->ocd_connect_flags;
}
RETURN(rc);
+ } else if (KEY_IS(KEY_TGT_COUNT)) {
+ *((int *)val) = lmv->desc.ld_tgt_count;
+ RETURN(0);
}
CDEBUG(D_IOCTL, "Invalid key\n");
}
CDEBUG(D_IOCTL, "Invalid key\n");
*((__u64*)val) = tgt->ltd_exp->exp_connect_flags;
GOTO(out, rc = 0);
*((__u64*)val) = tgt->ltd_exp->exp_connect_flags;
GOTO(out, rc = 0);
+ } else if (KEY_IS(KEY_TGT_COUNT)) {
+ *((int *)val) = lov->desc.ld_tgt_count;
+ GOTO(out, rc = 0);
rc = ptlrpc_obd_ping(obd);
GOTO(out, rc);
/*
rc = ptlrpc_obd_ping(obd);
GOTO(out, rc);
/*
- * Normally IOC_OBD_STATFS iocontrol is handled by LMV instead of MDC.
- * But when the cluster is upgraded from 1.8, there'd be no LMV layer
- * thus we might be called here. Eventually this code should be removed.
- * bz20731.
+ * Normally IOC_OBD_STATFS, OBD_IOC_QUOTACTL iocontrol are handled by
+ * LMV instead of MDC. But when the cluster is upgraded from 1.8,
+ * there'd be no LMV layer thus we might be called here. Eventually
+ * this code should be removed.
+ * bz20731, LU-592.
*/
case IOC_OBD_STATFS: {
struct obd_statfs stat_buf = {0};
*/
case IOC_OBD_STATFS: {
struct obd_statfs stat_buf = {0};
+ case OBD_IOC_QUOTACTL: {
+ struct if_quotactl *qctl = karg;
+ struct obd_quotactl *oqctl;
+
+ OBD_ALLOC_PTR(oqctl);
+ if (!oqctl)
+ RETURN(-ENOMEM);
+
+ QCTL_COPY(oqctl, qctl);
+ rc = obd_quotactl(exp, oqctl);
+ if (rc == 0) {
+ QCTL_COPY(qctl, oqctl);
+ qctl->qc_valid = QC_MDTIDX;
+ qctl->obd_uuid = obd->u.cli.cl_target_uuid;
+ }
+ OBD_FREE_PTR(oqctl);
+ break;
+ }
case LL_IOC_GET_CONNECT_FLAGS: {
if (cfs_copy_to_user(uarg, &exp->exp_connect_flags,
sizeof(__u64)))
case LL_IOC_GET_CONNECT_FLAGS: {
if (cfs_copy_to_user(uarg, &exp->exp_connect_flags,
sizeof(__u64)))
max_easize = val;
*max_easize = exp->exp_obd->u.cli.cl_max_mds_easize;
RETURN(0);
max_easize = val;
*max_easize = exp->exp_obd->u.cli.cl_max_mds_easize;
RETURN(0);
- }
- if (KEY_IS(KEY_CONN_DATA)) {
+ } else if (KEY_IS(KEY_CONN_DATA)) {
struct obd_import *imp = class_exp2cliimp(exp);
struct obd_connect_data *data = val;
struct obd_import *imp = class_exp2cliimp(exp);
struct obd_connect_data *data = val;
*data = imp->imp_connect_data;
RETURN(0);
*data = imp->imp_connect_data;
RETURN(0);
+ } else if (KEY_IS(KEY_TGT_COUNT)) {
+ *((int *)val) = 1;
+ RETURN(0);
}
rc = mdc_get_info_rpc(exp, keylen, key, *vallen, val);
}
rc = mdc_get_info_rpc(exp, keylen, key, *vallen, val);