Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / lov / lov_ea.c
index 05b9ea5..3c4ac5b 100755 (executable)
@@ -51,18 +51,18 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes,
                                  int stripe_count)
 {
 
-        if (stripe_count == 0) {
+        if (stripe_count == 0 || stripe_count > LOV_V1_INSANE_STRIPE_COUNT) {
                 CERROR("bad stripe count %d\n", stripe_count);
                 lov_dump_lmm_v1(D_WARNING, lmm);
                 return -EINVAL;
         }
-
+        
         if (lmm->lmm_object_id == 0) {
                 CERROR("zero object id\n");
                 lov_dump_lmm_v1(D_WARNING, lmm);
                 return -EINVAL;
         }
-
+        
         if (lmm->lmm_pattern != cpu_to_le32(LOV_PATTERN_RAID0)) {
                 CERROR("bad striping pattern\n");
                 lov_dump_lmm_v1(D_WARNING, lmm);
@@ -70,7 +70,9 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes,
         }
 
         if (lmm->lmm_stripe_size == 0 ||
-            (__u64)le32_to_cpu(lmm->lmm_stripe_size)*stripe_count > 0xffffffff){
+            (stripe_count != -1 &&
+             (__u64)le32_to_cpu(lmm->lmm_stripe_size)*stripe_count >
+             0xffffffff)) {
                 CERROR("bad stripe size %u\n",
                        le32_to_cpu(lmm->lmm_stripe_size));
                 lov_dump_lmm_v1(D_WARNING, lmm);
@@ -95,7 +97,7 @@ struct lov_stripe_md *lsm_alloc_plain(int stripe_count, int *size)
                 return NULL;;
 
         for (i = 0; i < stripe_count; i++) {
-                OBD_SLAB_ALLOC(loi, lov_oinfo_slab, SLAB_NOFS, sizeof(*loi));
+                OBD_SLAB_ALLOC(loi, lov_oinfo_slab, CFS_ALLOC_IO, sizeof(*loi));
                 if (loi == NULL)
                         goto err;
                 lsm->lsm_oinfo[i] = loi;
@@ -435,7 +437,7 @@ static int lovea_unpack_array(struct llog_handle *handle,
                         LPU64":"LPU64"\n", cursor, loi_index, med->med_start,
                         med->med_len);
 
-        for (i = 0; i < lmm->lmm_stripe_count; i ++) {
+        for (i = 0; i < le32_to_cpu(lmm->lmm_stripe_count); i ++, loi_index++) {
                 /* XXX LOV STACKING call down to osc_unpackmd() */
                 loi = lsm->lsm_oinfo[loi_index];
                 loi->loi_id = le64_to_cpu(lmm->lmm_objects[i].l_object_id);