[dm-devel] [PATCH] libmultipath: fix max_sectors_kb on adding path

Etienne Aujames eaujames at ddn.com
Wed Aug 23 16:24:59 UTC 2023


From: Etienne AUJAMES <eaujames at ddn.com>

A user can change the value of max_sectors_kb on the multipath device
and its path devices.
So when a path is deleted and then re-added, its value will not be the
same as the multipath device. In that case the IOs could be mis-sized.

On reload, this patch re-apply max_sectors_kb value of the multipath
device on its path devices.

Signed-off-by: Etienne AUJAMES <eaujames at ddn.com>
---
 libmultipath/configure.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 4a1c28bb..639c0905 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -593,11 +593,12 @@ sysfs_set_max_sectors_kb(struct multipath *mpp,
int is_reload)
 	ssize_t len;
 	int i, j, ret, err = 0;
 	struct udev_device *udd;
-	int max_sectors_kb;
+	int max_sectors_kb = mpp->max_sectors_kb;
 
-	if (mpp->max_sectors_kb == MAX_SECTORS_KB_UNDEF)
+	/* by default, do not initialize max_sectors_kb on the device
*/
+	if (max_sectors_kb == MAX_SECTORS_KB_UNDEF && !is_reload)
 		return 0;
-	max_sectors_kb = mpp->max_sectors_kb;
+	/* on reload, re-apply the user tuning on all the path devices
*/
 	if (is_reload) {
 		if (!has_dm_info(mpp) &&
 		    dm_get_info(mpp->alias, &mpp->dmi) != 0) {


More information about the dm-devel mailing list