From: Yang Sheng Date: Wed, 19 Feb 2020 11:08:33 +0000 (+0800) Subject: LU-13260 lov: fix size check when stripe is zero X-Git-Tag: 2.13.53~42 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F23%2F37623%2F3;p=fs%2Flustre-release.git LU-13260 lov: fix size check when stripe is zero Set correct max size while stripe is zero. Fixes: f3f6515562 (LU-8998 lov: add composite layout unpacking) Signed-off-by: Yang Sheng Change-Id: I9b76283fcc65f58e3be6adf49f035236687ac85c Reviewed-on: https://review.whamcloud.com/37623 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Emoly Liu Reviewed-by: Oleg Drokin --- diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 55c5b80..3f73c71 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -224,8 +224,12 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, /* with Data-on-MDT set maxbytes to stripe size */ if (lsme_is_dom(lsme)) { - lov_bytes = lsme->lsme_stripe_size; - goto out_dom; + if (maxbytes) { + lov_bytes = lsme->lsme_stripe_size; + goto out_dom1; + } else { + goto out_dom2; + } } for (i = 0; i < stripe_count; i++) { @@ -266,19 +270,21 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, min_stripe_maxbytes = lov_bytes; } - if (min_stripe_maxbytes == 0) - min_stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; + if (maxbytes) { + if (min_stripe_maxbytes == 0) + min_stripe_maxbytes = LUSTRE_EXT3_STRIPE_MAXBYTES; - if (stripe_count == 0) - lov_bytes = min_stripe_maxbytes; - else if (min_stripe_maxbytes <= LLONG_MAX / stripe_count) - lov_bytes = min_stripe_maxbytes * stripe_count; - else - lov_bytes = MAX_LFS_FILESIZE; + if (stripe_count == 0) + stripe_count = lov->desc.ld_tgt_count; -out_dom: - if (maxbytes) + if (min_stripe_maxbytes <= LLONG_MAX / stripe_count) + lov_bytes = min_stripe_maxbytes * stripe_count; + else + lov_bytes = MAX_LFS_FILESIZE; +out_dom1: *maxbytes = min_t(loff_t, lov_bytes, MAX_LFS_FILESIZE); + } +out_dom2: return lsme;