struct dentry *de, struct lustre_handle *lockh, char *tgt,
int tgtlen, void *data, int datalen);
int mdc_getlovinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
- uuid_t **uuids, struct ptlrpc_request **request);
+ struct ptlrpc_request **request);
int mdc_getstatus(struct lustre_handle *conn,
struct ll_fid *rootfid, __u64 *last_committed,
__u64 *last_xid, struct ptlrpc_request **);
{
struct ptlrpc_request *req;
struct lov_obd *lov = &obd->u.lov;
+ struct client_obd *mdc = &lov->mdcobd->u.cli;
+ struct lov_desc *desc = &lov->desc;
struct lustre_handle mdc_conn;
uuid_t *uuidarray;
int rc, rc2;
GOTO(out, rc = -EINVAL);
}
- rc = mdc_getlovinfo(obd, &mdc_conn, &uuidarray, &req);
+ rc = mdc_getlovinfo(obd, &mdc_conn, &req);
rc2 = obd_disconnect(&mdc_conn);
if (rc || rc2) {
CERROR("cannot get lov info or disconnect %d/%d\n", rc, rc2);
}
/* sanity... */
- if (strcmp(obd->obd_uuid, lov->desc.ld_uuid)) {
- CERROR("lov uuid %s not on mds device (%s)\n",
- obd->obd_uuid, lov->desc.ld_uuid);
+ if (req->rq_repmsg->bufcount < 2 ||
+ req->rq_repmsg->buflens[0] < sizeof(*desc)) {
+ CERROR("invalid descriptor returned\n");
GOTO(out, rc = -EINVAL);
}
- if (lov->desc.ld_tgt_count > 1000) {
- CERROR("configuration error: target count > 1000 (%d)\n",
- lov->desc.ld_tgt_count);
+
+ memcpy(desc, lustre_msg_buf(req->rq_repmsg, 0), sizeof(*desc));
+ lov_unpackdesc(desc);
+
+ if (req->rq_repmsg->buflens[1] < sizeof(*uuidarray)*desc->ld_tgt_count){
+ CERROR("invalid uuid array returned\n");
GOTO(out, rc = -EINVAL);
}
- if (req->rq_repmsg->bufcount < 2 || req->rq_repmsg->buflens[1] <
- sizeof(uuid_t) * lov->desc.ld_tgt_count) {
- CERROR("invalid uuid array returned\n");
+
+ mdc->cl_max_mdsize = sizeof(struct lov_mds_md) +
+ desc->ld_tgt_count * sizeof(struct lov_object_id);
+
+ if (memcmp(obd->obd_uuid, desc->ld_uuid, sizeof(desc->ld_uuid))) {
+ CERROR("lov uuid %s not on mds device (%s)\n",
+ obd->obd_uuid, desc->ld_uuid);
GOTO(out, rc = -EINVAL);
}
- lov->bufsize = sizeof(struct lov_tgt_desc) * lov->desc.ld_tgt_count;
+ if (desc->ld_tgt_count > 1000) {
+ CERROR("configuration error: target count > 1000 (%d)\n",
+ desc->ld_tgt_count);
+ GOTO(out, rc = -EINVAL);
+ }
+
+ lov->bufsize = sizeof(struct lov_tgt_desc) * desc->ld_tgt_count;
OBD_ALLOC(lov->tgts, lov->bufsize);
if (!lov->tgts) {
CERROR("Out of memory\n");
}
uuidarray = lustre_msg_buf(req->rq_repmsg, 1);
- for (i = 0 ; i < lov->desc.ld_tgt_count; i++)
- memcpy(lov->tgts[i].uuid, uuidarray[i], sizeof(uuid_t));
+ for (i = 0 ; i < desc->ld_tgt_count; i++)
+ memcpy(lov->tgts[i].uuid, uuidarray[i], sizeof(*uuidarray));
- for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
+ for (i = 0 ; i < desc->ld_tgt_count; i++) {
struct obd_device *tgt = class_uuid2obd(uuidarray[i]);
if (!tgt) {
CERROR("Target %s not attached\n", uuidarray[i]);
out_mem:
if (rc) {
- for (i = 0 ; i < lov->desc.ld_tgt_count; i++) {
+ for (i = 0 ; i < desc->ld_tgt_count; i++) {
rc2 = obd_disconnect(&lov->tgts[i].conn);
if (rc2)
CERROR("BAD: Target %s disconnect error %d\n",
}
int mdc_getlovinfo(struct obd_device *obd, struct lustre_handle *mdc_connh,
- uuid_t **uuids, struct ptlrpc_request **request)
+ struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
struct mds_status_req *streq;
- struct lov_obd *lov = &obd->u.lov;
- struct client_obd *mdc = &lov->mdcobd->u.cli;
- struct lov_desc *desc = &lov->desc;
int rc, size[2] = {sizeof(*streq)};
ENTRY;
*request = req;
streq = lustre_msg_buf(req->rq_reqmsg, 0);
streq->flags = HTON__u32(MDS_STATUS_LOV);
- streq->repbuf = HTON__u32(8000);
+ streq->repbuf = HTON__u32(8192);
/* prepare for reply */
req->rq_level = LUSTRE_CONN_CON;
- size[0] = sizeof(*desc);
- size[1] = 8000;
+ size[0] = 512;
+ size[1] = 8192;
req->rq_replen = lustre_msg_size(2, size);
rc = ptlrpc_queue_wait(req);
rc = ptlrpc_check_status(req, rc);
- if (!rc) {
- memcpy(desc, lustre_msg_buf(req->rq_repmsg, 0), sizeof(*desc));
- *uuids = lustre_msg_buf(req->rq_repmsg, 1);
- lov_unpackdesc(desc);
- mdc->cl_max_mdsize = sizeof(struct lov_mds_md) +
- desc->ld_tgt_count * sizeof(struct lov_object_id);
- }
-
- EXIT;
out:
- return rc;
+ RETURN(rc);
}