Whamcloud - gitweb
LU-6846 osd: reset do_body_ops after creation
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_handler.c
index 41b79fd..8c2486c 100644 (file)
@@ -2283,9 +2283,11 @@ static int osd_object_create(const struct lu_env *env, struct dt_object *dt,
                RETURN(-EPERM);
 
        result = __osd_object_create(info, obj, attr, hint, dof, th);
-       if (result == 0)
+       if (result == 0) {
                result = __osd_oi_insert(env, obj, fid, th);
-
+               if (obj->oo_dt.do_body_ops == &osd_body_ops_new)
+                       obj->oo_dt.do_body_ops = &osd_body_ops;
+       }
        LASSERT(ergo(result == 0,
                dt_object_exists(dt) && !dt_object_remote(dt)));
 
@@ -2636,6 +2638,8 @@ static int osd_object_ea_create(const struct lu_env *env, struct dt_object *dt,
                                              fid, OI_CHECK_FLD) ?
                                LMAC_FID_ON_OST : 0, 0);
                }
+               if (obj->oo_dt.do_body_ops == &osd_body_ops_new)
+                       obj->oo_dt.do_body_ops = &osd_body_ops;
        }
 
        if (result == 0)