[lustre-devel] [PATCH 9/9] lustre: lov: return stripe_count=1 instead of 0 for DoM files
James Simmons
jsimmons at infradead.org
Mon Feb 8 16:54:27 PST 2021
From: Emoly Liu <emoly at whamcloud.com>
Return stripe_count=1 instead of 0 for DoM files to avoid
divide-by-zero for older userspace that calls this ioctl,
e.g. lustre ADIO driver.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14337
Lustre-commit: b538826f2bdb39b ("LU-14337 lov: return stripe_count=1 instead of 0 for DoM files")
Signed-off-by: Emoly Liu <emoly at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41265
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Mike Pershin <mpershin at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/lov/lov_pack.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/fs/lustre/lov/lov_pack.c b/fs/lustre/lov/lov_pack.c
index d200a62..ffe9687 100644
--- a/fs/lustre/lov/lov_pack.c
+++ b/fs/lustre/lov/lov_pack.c
@@ -456,6 +456,14 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj,
lmm = lmmk;
lmm_size = lmmk_size;
}
+
+ /**
+ * Return stripe_count=1 instead of 0 for DoM files to avoid
+ * divide-by-zero for older userspace that calls this ioctl,
+ * e.g. lustre ADIO driver.
+ */
+ if ((lum.lmm_stripe_count == 0) && (lum.lmm_pattern & LOV_PATTERN_MDT))
+ lum.lmm_stripe_count = 1;
/**
* User specified limited buffer size, usually the buffer is
* from ll_lov_setstripe(), and the buffer can only hold basic
--
1.8.3.1
More information about the lustre-devel
mailing list