Whamcloud - gitweb
LU-14337 lov: return stripe_count=1 instead of 0 for DoM files 65/41265/2
authorEmoly Liu <emoly@whamcloud.com>
Tue, 19 Jan 2021 04:06:06 +0000 (12:06 +0800)
committerOleg Drokin <green@whamcloud.com>
Mon, 25 Jan 2021 19:19:18 +0000 (19:19 +0000)
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.

Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: I43c5e01bdee834f9a05a669a3e6f3d5cd926cb87
Reviewed-on: https://review.whamcloud.com/41265
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lov/lov_pack.c

index 77127d5..528f067 100644 (file)
@@ -469,6 +469,14 @@ int lov_getstripe(const struct lu_env *env, struct lov_object *obj,
                lmm = lmmk;
                lmm_size = lmmk_size;
        }
                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
        /**
         * User specified limited buffer size, usually the buffer is
         * from ll_lov_setstripe(), and the buffer can only hold basic