+ rc = obd_register_observer(mds->mds_lov_obd, obd);
+ if (rc) {
+ CERROR("MDS cannot register as observer of LOV %s (%d)\n",
+ lov_name, rc);
+ GOTO(err_exit, rc);
+ }
+
+ /* ask lov to generate OBD_NOTIFY_CREATE events for already registered
+ * targets */
+ obd_notify(mds->mds_lov_obd, NULL, OBD_NOTIFY_CREATE, NULL);
+
+ mds->mds_lov_obd->u.lov.lov_sp_me = LUSTRE_SP_MDT;
+
+ OBD_ALLOC(data, sizeof(*data));
+ if (data == NULL)
+ GOTO(err_exit, rc = -ENOMEM);
+
+ data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_INDEX |
+ OBD_CONNECT_REQPORTAL | OBD_CONNECT_QUOTA64 |
+ OBD_CONNECT_OSS_CAPA | OBD_CONNECT_FID |
+ OBD_CONNECT_BRW_SIZE | OBD_CONNECT_CKSUM |
+ OBD_CONNECT_CHANGE_QS | OBD_CONNECT_AT |
+ OBD_CONNECT_MDS | OBD_CONNECT_SKIP_ORPHAN |
+ OBD_CONNECT_SOM | OBD_CONNECT_FULL20 |
+ OBD_CONNECT_64BITHASH;
+#ifdef HAVE_LRU_RESIZE_SUPPORT
+ data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
+#endif
+ data->ocd_version = LUSTRE_VERSION_CODE;
+ data->ocd_group = mdt_to_obd_objseq(mds->mds_id);
+ /* send max bytes per rpc */
+ data->ocd_brw_size = PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT;
+ /* send the list of supported checksum types */
+ data->ocd_cksum_types = cksum_types_supported();
+ /* NB: lov_connect() needs to fill in .ocd_index for each OST */
+ rc = obd_connect(NULL, &mds->mds_lov_exp, mds->mds_lov_obd, &obd->obd_uuid, data, NULL);
+ OBD_FREE(data, sizeof(*data));
+ if (rc) {
+ CERROR("MDS cannot connect to LOV %s (%d)\n", lov_name, rc);
+ mds->mds_lov_obd = ERR_PTR(rc);
+ RETURN(rc);
+ }
+
+ /* I want to see a callback happen when the OBD moves to a
+ * "For General Use" state, and that's when we'll call
+ * set_nextid(). The class driver can help us here, because
+ * it can use the obd_recovering flag to determine when the
+ * the OBD is full available. */
+ /* MDD device will care about that
+ if (!obd->obd_recovering)
+ rc = mds_postrecov(obd);
+ */
+ RETURN(rc);
+
+err_exit:
+ mds->mds_lov_exp = NULL;
+ mds->mds_lov_obd = ERR_PTR(rc);
+ RETURN(rc);