From 058b5f5cb18de2640c3a499bbf628236622b6a7f Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Fri, 30 Jun 2023 17:46:46 +0200 Subject: [PATCH] libmultipath: fix dev_loss_tmo even if not set in configuration If pp->dev_loss_tmo == DEV_LOSS_TMO_UNSET, sysfs_set_scsi_tmo() would not set it to min_dev_loss_tmo, causing the system dev_loss_tmo value (by default, 30s) to remain unchanged. Fix it. Fixes: 6ad77db ("libmultipath: Set the scsi timeout parameters by path") Signed-off-by: Martin Wilck Reviewed-by: Benjamin Marzinski --- libmultipath/discovery.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c index 2dcafe5d2..5626d48de 100644 --- a/libmultipath/discovery.c +++ b/libmultipath/discovery.c @@ -895,10 +895,11 @@ sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp) continue; } - if (pp->dev_loss != DEV_LOSS_TMO_UNSET && - pp->dev_loss < min_dev_loss) { - warn_dev_loss = true; + if (pp->dev_loss == DEV_LOSS_TMO_UNSET) pp->dev_loss = min_dev_loss; + else if (pp->dev_loss < min_dev_loss) { + pp->dev_loss = min_dev_loss; + warn_dev_loss = true; } if (pp->dev_loss != DEV_LOSS_TMO_UNSET && pp->fast_io_fail > 0 &&