struct ll_sb_info *sbi = ll_i2sbi(inode);
struct ldlm_extent extent;
struct lustre_handle *lockhs = NULL;
- int rc, flags = 0;
+ int rc, flags = 0, stripe_count;
if (sbi->ll_flags & LL_SBI_NOLCK) {
*lockhs_p = NULL;
RETURN(0);
}
- OBD_ALLOC(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
+ stripe_count = lsm->lsm_stripe_count;
+ if (!stripe_count)
+ stripe_count = 1;
+
+ OBD_ALLOC(lockhs, stripe_count * sizeof(*lockhs));
if (lockhs == NULL)
RETURN(-ENOMEM);
inode, sizeof(*inode), lockhs);
if (rc != ELDLM_OK) {
CERROR("lock enqueue: %d\n", rc);
- OBD_FREE(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
+ OBD_FREE(lockhs, stripe_count * sizeof(*lockhs));
} else
*lockhs_p = lockhs;
RETURN(rc);
struct lustre_handle *lockhs)
{
struct ll_sb_info *sbi = ll_i2sbi(inode);
- int rc;
+ int rc, stripe_count;
if (sbi->ll_flags & LL_SBI_NOLCK)
RETURN(0);
LBUG();
}
- OBD_FREE(lockhs, lsm->lsm_stripe_count * sizeof(*lockhs));
+ stripe_count = lsm->lsm_stripe_count;
+ if (!stripe_count)
+ stripe_count = 1;
+
+ OBD_FREE(lockhs, stripe_count * sizeof(*lockhs));
RETURN(rc);
}