Whamcloud - gitweb
b=20997 passthrough obd_force from lmv to mdc
[fs/lustre-release.git] / lustre / lov / lov_obd.c
index 919e698..c13ccaf 100644 (file)
@@ -476,29 +476,30 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
                 /* NULL watched means all osc's in the lov (only for syncs) */
                 /* sync event should be send lov idx as data */
                 struct lov_obd *lov = &obd->u.lov;
-                struct obd_device *tgt_obd;
-                int i;
+                int i, is_sync;
+
+                data = &i;
+                is_sync = (ev == OBD_NOTIFY_SYNC) ||
+                          (ev == OBD_NOTIFY_SYNC_NONBLOCK);
+
                 obd_getref(obd);
                 for (i = 0; i < lov->desc.ld_tgt_count; i++) {
+                        if (!lov->lov_tgts[i])
+                                continue;
+
                         /* don't send sync event if target not
                          * connected/activated */
-                        if (!lov->lov_tgts[i] ||
-                            !lov->lov_tgts[i]->ltd_active)
-                                 continue;
-
-                        if ((ev == OBD_NOTIFY_SYNC) ||
-                            (ev == OBD_NOTIFY_SYNC_NONBLOCK))
-                                data = &i;
-
-                        tgt_obd = class_exp2obd(lov->lov_tgts[i]->ltd_exp);
+                        if (is_sync &&  !lov->lov_tgts[i]->ltd_active)
+                                continue;
 
-                        rc = obd_notify_observer(obd, tgt_obd, ev, data);
+                        rc = obd_notify_observer(obd, lov->lov_tgts[i]->ltd_obd,
+                                                 ev, data);
                         if (rc) {
                                 CERROR("%s: notify %s of %s failed %d\n",
                                        obd->obd_name,
                                        obd->obd_observer->obd_name,
-                                       tgt_obd->obd_name, rc);
-                                break;
+                                       lov->lov_tgts[i]->ltd_obd->obd_name,
+                                       rc);
                         }
                 }
                 obd_putref(obd);
@@ -507,8 +508,8 @@ static int lov_notify(struct obd_device *obd, struct obd_device *watched,
         RETURN(rc);
 }
 
-int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
-                   __u32 index, int gen, int active)
+static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
+                          __u32 index, int gen, int active)
 {
         struct lov_obd *lov = &obd->u.lov;
         struct lov_tgt_desc *tgt;
@@ -586,7 +587,6 @@ int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
                 RETURN(rc);
         }
 
-        memset(tgt, 0, sizeof(*tgt));
         tgt->ltd_uuid = *uuidp;
         tgt->ltd_obd = tgt_obd;
         /* XXX - add a sanity check on the generation number. */
@@ -602,6 +602,8 @@ int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
         CDEBUG(D_CONFIG, "idx=%d ltd_gen=%d ld_tgt_count=%d\n",
                 index, tgt->ltd_gen, lov->desc.ld_tgt_count);
 
+        rc = obd_notify(obd, tgt_obd, OBD_NOTIFY_CREATE, &index);
+
         if (lov->lov_connects == 0) {
                 /* lov_connect hasn't been called yet. We'll do the
                    lov_connect_obd on this target when that fn first runs,
@@ -804,17 +806,19 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 
         lov->lov_pools_hash_body = cfs_hash_create("POOLS", HASH_POOLS_CUR_BITS,
                                                    HASH_POOLS_MAX_BITS,
-                                                   &pool_hash_operations, CFS_HASH_REHASH);
+                                                   HASH_POOLS_BKT_BITS, 0,
+                                                   CFS_HASH_MIN_THETA,
+                                                   CFS_HASH_MAX_THETA,
+                                                   &pool_hash_operations,
+                                                   CFS_HASH_DEFAULT);
         CFS_INIT_LIST_HEAD(&lov->lov_pool_list);
         lov->lov_pool_count = 0;
         rc = lov_ost_pool_init(&lov->lov_packed, 0);
         if (rc)
-                RETURN(rc);
+                GOTO(out_free_statfs, rc);
         rc = lov_ost_pool_init(&lov->lov_qos.lq_rr.lqr_pool, 0);
-        if (rc) {
-                lov_ost_pool_free(&lov->lov_packed);
-                RETURN(rc);
-        }
+        if (rc)
+                GOTO(out_free_lov_packed, rc);
 
         lprocfs_lov_init_vars(&lvars);
         lprocfs_obd_setup(obd, lvars.obd_vars);
@@ -833,6 +837,12 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                                     NULL, NULL);
 
         RETURN(0);
+
+out_free_lov_packed:
+        lov_ost_pool_free(&lov->lov_packed);
+out_free_statfs:
+        OBD_FREE_PTR(lov->lov_qos.lq_statfs_data);
+        return rc;
 }
 
 static int lov_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
@@ -2127,11 +2137,16 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
                 for (i = 0; i < count; i++) {
                         int err;
+                        struct obd_device *osc_obd;
 
                         /* OST was disconnected */
                         if (!lov->lov_tgts[i] || !lov->lov_tgts[i]->ltd_exp)
                                 continue;
 
+                        /* ll_umount_begin() sets force flag but for lov, not
+                         * osc. Let's pass it through */
+                        osc_obd = class_exp2obd(lov->lov_tgts[i]->ltd_exp);
+                        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) {