summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorOlaf Faaland <[email protected]>2018-04-06 13:29:11 -0700
committerBrian Behlendorf <[email protected]>2018-04-06 13:29:11 -0700
commit0ba106e75c6cda806cb5d2003b918e658f2ff86c (patch)
tree642c406fb7d2786387959fa9c0eb5ce49b8abad7 /module
parent1bf9a552bb52785d5d838108574443e35682c85c (diff)
Fix divide-by-zero in mmp_delay_update()
vdev_count_leaves() in the denominator may return 0, caught by Coverity. Introduced by * 533ea04 Update mmp_delay on sync or skipped, failed write Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Olaf Faaland <[email protected]> Closes #7391
Diffstat (limited to 'module')
-rw-r--r--module/zfs/mmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
index e50e35665..4d3c7401e 100644
--- a/module/zfs/mmp.c
+++ b/module/zfs/mmp.c
@@ -327,7 +327,7 @@ mmp_delay_update(spa_t *spa, boolean_t write_completed)
*/
if (delay < mts->mmp_delay) {
hrtime_t min_delay = MSEC2NSEC(zfs_multihost_interval) /
- vdev_count_leaves(spa);
+ MAX(1, vdev_count_leaves(spa));
mts->mmp_delay = MAX(((delay + mts->mmp_delay * 127) / 128),
min_delay);
}