Whamcloud - gitweb
landing b_cmobd_merge on HEAD
[fs/lustre-release.git] / lustre / osc / osc_create.c
index 50b4d12..ed8ae35 100644 (file)
@@ -124,8 +124,10 @@ static int oscc_internal_create(struct osc_creator *oscc)
 
         spin_lock(&oscc->oscc_lock);
         body->oa.o_id = oscc->oscc_last_id + oscc->oscc_grow_count;
-        body->oa.o_valid |= OBD_MD_FLID;
-        CDEBUG(D_HA, "preallocating through id "LPU64" (last used "LPU64")\n",
+        body->oa.o_gr = oscc->oscc_gr;
+        LASSERT(body->oa.o_gr > 0);
+        body->oa.o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
+        CDEBUG(D_INFO, "preallocating through id "LPU64" (last used "LPU64")\n",
                body->oa.o_id, oscc->oscc_next_id);
         spin_unlock(&oscc->oscc_lock);
 
@@ -212,8 +214,13 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
         ENTRY;
         LASSERT(oa);
         LASSERT(ea);
+        LASSERT(oa->o_valid & OBD_MD_FLGROUP);
+        LASSERT(oa->o_gr > 0);
 
-        if ((oa->o_valid & OBD_MD_FLGROUP) && (oa->o_gr != 0))
+        LASSERT(oscc->oscc_gr == 0 || oscc->oscc_gr == oa->o_gr);
+        oscc->oscc_gr = oa->o_gr;
+
+        if (oa->o_gr == FILTER_GROUP_LLOG || oa->o_gr == FILTER_GROUP_ECHO)
                 RETURN(osc_real_create(exp, oa, ea, oti));
 
         if ((oa->o_valid & OBD_MD_FLFLAGS) &&
@@ -249,7 +256,11 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
                 oscc->oscc_last_id = oa->o_id;
                 wake_up(&oscc->oscc_waitq);
                 spin_unlock(&oscc->oscc_lock);
-
+                
+                /*recover happen in mds_setup, before cobd_setup, so
+                 *reset oscc_gr = 0 here, it sould be no harm to CMD
+                 */ 
+                oscc->oscc_gr = 0;
                 CDEBUG(D_HA, "%p: oscc recovery finished\n", oscc);
 
                RETURN(rc);
@@ -281,7 +292,9 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
                 if (oscc->oscc_last_id >= oscc->oscc_next_id) {
                         memcpy(oa, &oscc->oscc_oa, sizeof(*oa));
                         oa->o_id = oscc->oscc_next_id;
+                        oa->o_gr = oscc->oscc_gr;
                         lsm->lsm_object_id = oscc->oscc_next_id;
+                        lsm->lsm_object_gr = oscc->oscc_gr;
                         *ea = lsm;
                         oscc->oscc_next_id++;
                         try_again = 0;
@@ -297,9 +310,8 @@ int osc_create(struct obd_export *exp, struct obdo *oa,
         }
 
         if (rc == 0)
-                CDEBUG(D_HA, "%s: returning objid "LPU64"\n", 
-                       oscc->oscc_obd->u.cli.cl_import->imp_target_uuid.uuid, 
-                       lsm->lsm_object_id);
+                CDEBUG(D_INFO, "returning objid "LPU64"/"LPU64"\n",
+                                lsm->lsm_object_id, lsm->lsm_object_gr);
         else if (*ea == NULL)
                 obd_free_memmd(exp, &lsm);
         RETURN(rc);