From: yangsheng Date: Wed, 29 Apr 2009 06:33:52 +0000 (+0000) Subject: Branch b_release_1_8_0 X-Git-Tag: 1.8.0~3 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a769c7edc26a1a83d1b731093f65b36ecec58618;p=fs%2Flustre-release.git Branch b_release_1_8_0 b=19276 i=johann, shadow, nathan Fixed swab issue for PPC platform. --- diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index 4903b56..9b8dcf8 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -424,7 +424,8 @@ int lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp, rc = copy_from_user(&lumv3, lump, sizeof(struct lov_user_md_v1)); if (rc) RETURN(-EFAULT); - if (lumv1->lmm_magic == LOV_USER_MAGIC_V3) { + if ((lumv1->lmm_magic == LOV_USER_MAGIC_V3) || + (lumv1->lmm_magic == LOV_USER_MAGIC_V3_SWABBED)) { rc = copy_from_user(&lumv3, lump, sizeof(lumv3)); if (rc) RETURN(-EFAULT); @@ -639,6 +640,12 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm, if (copy_to_user(lump, lmmk, lmm_size)) rc = -EFAULT; + /* Restore the LE endian to ensure obd_free_diskmd works well */ + if (cpu_to_le32(LOV_MAGIC) != LOV_MAGIC) { + lmmk->lmm_stripe_count = lum.lmm_stripe_count; + lustre_swab_lov_mds_md(lmmk); + } + obd_free_diskmd(exp, &lmmk); RETURN(rc); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index e1a8832..d1de404 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -2354,17 +2354,18 @@ void lustre_swab_lov_mds_md(struct lov_mds_md *lmm) int lustre_swab_lov_user_md_objects(struct lov_user_md *lum) { - int i, stripe_count = lum->lmm_stripe_count; + int i; + __u16 stripe_count = lum->lmm_stripe_count; struct lov_user_ost_data *lod; ENTRY; switch (lum->lmm_magic) { case LOV_USER_MAGIC_V1_SWABBED: - __swab32s(&stripe_count); + __swab16s(&stripe_count); case LOV_USER_MAGIC_V1: lod = lum->lmm_objects; break; case LOV_USER_MAGIC_V3_SWABBED: - __swab32s(&stripe_count); + __swab16s(&stripe_count); case LOV_USER_MAGIC_V3: lod = ((struct lov_user_md_v3 *)lum)->lmm_objects; break;