Whamcloud - gitweb
LU-1187 tests: Fixes in test-framework for DNE
[fs/lustre-release.git] / lustre / osp / osp_object.c
index a0489f1..d94b5b9 100644 (file)
@@ -93,7 +93,12 @@ static int osp_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
         *
         * 2) send synchronous truncate RPC with just assigned id
         */
-       LASSERT(attr);
+
+       /* there are few places in MDD code still passing NULL
+        * XXX: to be fixed soon */
+       if (attr == NULL)
+               RETURN(0);
+
        if (attr->la_valid & LA_SIZE && attr->la_size > 0) {
                LASSERT(!dt_object_exists(dt));
                osp_object_assign_id(env, d, o);
@@ -166,13 +171,22 @@ static int osp_declare_object_create(const struct lu_env *env,
 
        ENTRY;
 
+       /* should happen to non-0 OSP only so that at least one object
+        * has been already declared in the scenario and LOD should
+        * cleanup that */
+       if (OBD_FAIL_CHECK(OBD_FAIL_MDS_OSC_CREATE_FAIL) && d->opd_index == 1)
+               RETURN(-ENOSPC);
+
        LASSERT(d->opd_last_used_file);
        fid = lu_object_fid(&dt->do_lu);
 
        /*
         * There can be gaps in precreated ids and record to unlink llog
+        * XXX: we do not handle gaps yet, implemented before solution
+        *      was found to be racy, so we disabled that. there is no
+        *      point in making useless but expensive llog declaration.
         */
-       rc = osp_sync_declare_add(env, o, MDS_UNLINK64_REC, th);
+       /* rc = osp_sync_declare_add(env, o, MDS_UNLINK64_REC, th); */
 
        if (unlikely(!fid_is_zero(fid))) {
                /* replay case: caller knows fid */
@@ -274,6 +288,9 @@ static int osp_object_create(const struct lu_env *env, struct dt_object *dt,
        rc = dt_record_write(env, d->opd_last_used_file, &osi->osi_lb,
                             &osi->osi_off, th);
 
+       CDEBUG(D_HA, "%s: Wrote last used ID: "LPU64": %d\n",
+              d->opd_obd->obd_name, le64_to_cpu(d->opd_last_used_id), rc);
+
        RETURN(rc);
 }