+ obd_register_observer(mds->mds_md_obd, NULL);
+
+ if (flags & OBD_OPT_FORCE) {
+ struct obd_device *lmv_obd;
+ struct obd_ioctl_data ioc_data = { 0 };
+
+ lmv_obd = class_exp2obd(mds->mds_md_exp);
+ if (lmv_obd == NULL)
+ GOTO(out, rc = 0);
+
+ /*
+ * making disconnecting lmv stuff do not send anything
+ * to all remote MDSs from LMV. This is needed to
+ * prevent possible hanging with endless recovery, when
+ * MDS sends disconnect to already disconnected
+ * target. Probably this is wrong, but client does the
+ * same in --force mode and I do not see why can't we do
+ * it here. --umka.
+ */
+ lmv_obd->obd_no_recov = 1;
+ obd_iocontrol(IOC_OSC_SET_ACTIVE, mds->mds_md_exp,
+ sizeof(ioc_data), &ioc_data, NULL);
+ }
+
+ /*
+ * if obd_disconnect() fails (probably because the export was
+ * disconnected by class_disconnect_exports()) then we just need
+ * to drop our ref.
+ */
+ mds->mds_md_connected = 0;
+ rc = obd_disconnect(mds->mds_md_exp, flags);
+ if (rc)
+ class_export_put(mds->mds_md_exp);