Whamcloud - gitweb
LU-7904 osd: honor LOC_F_NEW
[fs/lustre-release.git] / lustre / osd-zfs / osd_object.c
index 5c63388..fa9ec89 100644 (file)
@@ -417,6 +417,9 @@ static int osd_object_init(const struct lu_env *env, struct lu_object *l,
                RETURN(0);
        }
 
+       if (conf != NULL && conf->loc_flags & LOC_F_NEW)
+               GOTO(out, rc = 0);
+
        rc = osd_fid_lookup(env, osd, lu_object_fid(l), &oid);
        if (rc == 0) {
                LASSERT(obj->oo_db == NULL);
@@ -954,6 +957,15 @@ static int osd_attr_set(const struct lu_env *env, struct dt_object *dt,
        if (!S_ISREG(dt->do_lu.lo_header->loh_attr))
                valid &= ~(LA_SIZE | LA_BLOCKS);
 
+       if (valid & LA_CTIME && la->la_ctime == obj->oo_attr.la_ctime)
+               valid &= ~LA_CTIME;
+
+       if (valid & LA_MTIME && la->la_mtime == obj->oo_attr.la_mtime)
+               valid &= ~LA_MTIME;
+
+       if (valid & LA_ATIME && la->la_atime == obj->oo_attr.la_atime)
+               valid &= ~LA_ATIME;
+
        if (valid == 0)
                GOTO(out, rc = 0);
 
@@ -1577,12 +1589,9 @@ static int osd_object_create(const struct lu_env *env, struct dt_object *dt,
        LASSERT(osd_invariant(obj));
 
        rc = osd_init_lma(env, obj, fid, oh);
-       if (rc) {
+       if (rc != 0)
                CERROR("%s: can not set LMA on "DFID": rc = %d\n",
                       osd->od_svname, PFID(fid), rc);
-               /* ignore errors during LMA initialization */
-               rc = 0;
-       }
 
 out:
        up_write(&obj->oo_guard);