Whamcloud - gitweb
Branch b1_8
authoryangsheng <yangsheng>
Wed, 29 Apr 2009 06:31:24 +0000 (06:31 +0000)
committeryangsheng <yangsheng>
Wed, 29 Apr 2009 06:31:24 +0000 (06:31 +0000)
b=19276

i=johann, shadow, nathan

Fixed the swab issue for PPC platform.

lustre/lov/lov_pack.c
lustre/ptlrpc/pack_generic.c

index 7e07e34..fffd848 100644 (file)
@@ -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);
@@ -638,6 +639,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);
index bd26f7e..26d8104 100644 (file)
@@ -2354,17 +2354,18 @@ void lustre_swab_lov_user_md_join(struct lov_user_md_join *lumj)
 
 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;