Whamcloud - gitweb
b=18043
[fs/lustre-release.git] / lustre / lov / lov_pack.c
index a39e92b..12c2d28 100644 (file)
@@ -418,8 +418,7 @@ static int __lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp,
         int rc;
         ENTRY;
 
-        rc = copy_from_user(&lumv3, lump, sizeof(struct lov_user_md_v1));
-        if (rc)
+        if (copy_from_user(&lumv3, lump, sizeof(struct lov_user_md_v1)))
                 RETURN(-EFAULT);
 
         lmm_magic = lumv1->lmm_magic;
@@ -428,12 +427,10 @@ static int __lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp,
                 lustre_swab_lov_user_md_v1(lumv1);
                 lmm_magic = LOV_USER_MAGIC_V1;
         } else if (lmm_magic == LOV_USER_MAGIC_V3) {
-                rc = copy_from_user(&lumv3, lump, sizeof(lumv3));
-                if (rc)
+                if (copy_from_user(&lumv3, lump, sizeof(lumv3)))
                         RETURN(-EFAULT);
         } else if (lmm_magic == __swab32(LOV_USER_MAGIC_V3)) {
-                rc = copy_from_user(&lumv3, lump, sizeof(lumv3));
-                if (rc)
+                if (copy_from_user(&lumv3, lump, sizeof(lumv3)))
                         RETURN(-EFAULT);
                 lustre_swab_lov_user_md_v3(&lumv3);
                 lmm_magic = LOV_USER_MAGIC_V3;
@@ -486,12 +483,17 @@ static int __lov_setstripe(struct obd_export *exp, struct lov_stripe_md **lsmp,
                     (typeof(lumv3.lmm_stripe_offset))(-1)) {
                         rc = lov_check_index_in_pool(lumv3.lmm_stripe_offset,
                                                      pool);
-                        if (rc < 0)
+                        if (rc < 0) {
+                                lh_put(lov->lov_pools_hash_body,
+                                       &pool->pool_hash);
                                 RETURN(-EINVAL);
+                        }
                 }
 
                 if (stripe_count > pool_tgt_count(pool))
                         stripe_count = pool_tgt_count(pool);
+
+                lh_put(lov->lov_pools_hash_body, &pool->pool_hash);
         }
 
         if ((__u64)lumv1->lmm_stripe_size * stripe_count > ~0UL) {
@@ -616,9 +618,7 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,
         /* we only need the header part from user space to get lmm_magic and
          * lmm_stripe_count, (the header part is common to v1 and v3) */
         lum_size = sizeof(struct lov_user_md_v1);
-        rc = copy_from_user(&lum, lump, lum_size);
-
-        if (rc)
+        if (copy_from_user(&lum, lump, lum_size))
                 rc = -EFAULT;
         else if ((lum.lmm_magic != LOV_USER_MAGIC) &&
                  (lum.lmm_magic != LOV_USER_MAGIC_V3))