Commit 476f575c authored by Nathaniel Clark's avatar Nathaniel Clark Committed by Greg Kroah-Hartman

staging: lustre: lov: Ensure correct operation for large object sizes

If a backing filesystem (ZFS) returns that it supports very large
(LLONG_MAX) object sizes, that should be correctly supported.  This
fixes the check for unitialized stripe_maxbytes in
lsm_unpackmd_common(), so that ZFS can return LLONG_MAX and it will be
okay. This issue is excersized by writing to or past the 2TB boundry
of a singly stripped file.
Signed-off-by: default avatarNathaniel Clark <nathaniel.l.clark@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7890
Reviewed-on: http://review.whamcloud.com/19066Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fc153de1
...@@ -150,9 +150,10 @@ static int lsm_unpackmd_common(struct lov_obd *lov, ...@@ -150,9 +150,10 @@ static int lsm_unpackmd_common(struct lov_obd *lov,
struct lov_mds_md *lmm, struct lov_mds_md *lmm,
struct lov_ost_data_v1 *objects) struct lov_ost_data_v1 *objects)
{ {
loff_t stripe_maxbytes = LLONG_MAX; loff_t min_stripe_maxbytes = 0;
unsigned int stripe_count; unsigned int stripe_count;
struct lov_oinfo *loi; struct lov_oinfo *loi;
loff_t lov_bytes;
unsigned int i; unsigned int i;
/* /*
...@@ -168,8 +169,6 @@ static int lsm_unpackmd_common(struct lov_obd *lov, ...@@ -168,8 +169,6 @@ static int lsm_unpackmd_common(struct lov_obd *lov,
stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count; stripe_count = lsm_is_released(lsm) ? 0 : lsm->lsm_stripe_count;
for (i = 0; i < stripe_count; i++) { for (i = 0; i < stripe_count; i++) {
loff_t tgt_bytes;
loi = lsm->lsm_oinfo[i]; loi = lsm->lsm_oinfo[i];
ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi); ostid_le_to_cpu(&objects[i].l_ost_oi, &loi->loi_oi);
loi->loi_ost_idx = le32_to_cpu(objects[i].l_ost_idx); loi->loi_ost_idx = le32_to_cpu(objects[i].l_ost_idx);
...@@ -194,17 +193,21 @@ static int lsm_unpackmd_common(struct lov_obd *lov, ...@@ -194,17 +193,21 @@ static int lsm_unpackmd_common(struct lov_obd *lov,
continue; continue;
} }
tgt_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]); lov_bytes = lov_tgt_maxbytes(lov->lov_tgts[loi->loi_ost_idx]);
stripe_maxbytes = min_t(loff_t, stripe_maxbytes, tgt_bytes); if (min_stripe_maxbytes == 0 || lov_bytes < min_stripe_maxbytes)
min_stripe_maxbytes = lov_bytes;
} }
if (stripe_maxbytes == LLONG_MAX) if (min_stripe_maxbytes == 0)
stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; min_stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES;
stripe_count = lsm->lsm_stripe_count ?: lov->desc.ld_tgt_count;
lov_bytes = min_stripe_maxbytes * stripe_count;
if (!lsm->lsm_stripe_count) if (lov_bytes < min_stripe_maxbytes) /* handle overflow */
lsm->lsm_maxbytes = stripe_maxbytes * lov->desc.ld_tgt_count; lsm->lsm_maxbytes = MAX_LFS_FILESIZE;
else else
lsm->lsm_maxbytes = stripe_maxbytes * lsm->lsm_stripe_count; lsm->lsm_maxbytes = lov_bytes;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment