Whamcloud - gitweb
LU-3539 osp: Fix a series of UPDATE_OBJ endianness bugs
[fs/lustre-release.git] / lustre / osp / osp_md_object.c
index a4299e7..e331bfa 100644 (file)
@@ -64,19 +64,16 @@ int osp_md_declare_object_create(const struct lu_env *env,
        osi->osi_obdo.o_valid = 0;
        obdo_from_la(&osi->osi_obdo, attr, attr->la_valid);
        lustre_set_wire_obdo(NULL, &osi->osi_obdo, &osi->osi_obdo);
-       obdo_cpu_to_le(&osi->osi_obdo, &osi->osi_obdo);
 
        bufs[0] = (char *)&osi->osi_obdo;
        buf_count = 1;
        fid1 = (struct lu_fid *)lu_object_fid(&dt->do_lu);
        if (hint != NULL && hint->dah_parent) {
                struct lu_fid *fid2;
-               struct lu_fid *tmp_fid = &osi->osi_fid;
 
                fid2 = (struct lu_fid *)lu_object_fid(&hint->dah_parent->do_lu);
-               fid_cpu_to_le(tmp_fid, fid2);
-               sizes[1] = sizeof(*tmp_fid);
-               bufs[1] = (char *)tmp_fid;
+               sizes[1] = sizeof(*fid2);
+               bufs[1] = (char *)fid2;
                buf_count++;
        }
 
@@ -248,7 +245,6 @@ int osp_md_declare_attr_set(const struct lu_env *env, struct dt_object *dt,
        obdo_from_la(&osi->osi_obdo, (struct lu_attr *)attr,
                     attr->la_valid);
        lustre_set_wire_obdo(NULL, &osi->osi_obdo, &osi->osi_obdo);
-       obdo_cpu_to_le(&osi->osi_obdo, &osi->osi_obdo);
 
        buf = (char *)&osi->osi_obdo;
        fid = (struct lu_fid *)lu_object_fid(&dt->do_lu);
@@ -376,7 +372,8 @@ static int osp_md_index_lookup(const struct lu_env *env, struct dt_object *dt,
        }
 
        fid = lbuf->lb_buf;
-       fid_le_to_cpu(fid, fid);
+       if (ptlrpc_rep_need_swab(req))
+               lustre_swab_lu_fid(fid);
        if (!fid_is_sane(fid)) {
                CERROR("%s: lookup "DFID" %s invalid fid "DFID"\n",
                       dt_dev->dd_lu_dev.ld_obd->obd_name,
@@ -603,8 +600,7 @@ static int osp_md_object_lock(const struct lu_env *env,
                              struct ldlm_enqueue_info *einfo,
                              ldlm_policy_data_t *policy)
 {
-       struct osp_thread_info  *info = osp_env_info(env);
-       struct ldlm_res_id      *res_id = &info->osi_resid;
+       struct ldlm_res_id      *res_id;
        struct dt_device        *dt_dev = lu2dt_dev(dt->do_lu.lo_dev);
        struct osp_device       *osp = dt2osp_dev(dt_dev);
        struct ptlrpc_request   *req;
@@ -612,7 +608,8 @@ static int osp_md_object_lock(const struct lu_env *env,
        __u64                   flags = 0;
        ldlm_mode_t             mode;
 
-       fid_build_reg_res_name(lu_object_fid(&dt->do_lu), res_id);
+       res_id = einfo->ei_res_id;
+       LASSERT(res_id != NULL);
 
        mode = ldlm_lock_match(osp->opd_obd->obd_namespace,
                               LDLM_FL_BLOCK_GRANTED, res_id,