Two multipath features.
Benjamin Marzinski
maintainercover Two multipath features.
This patchset implements two features that I had requests for. The first commit adds the ability for multipath to control the scsi max_retries sysfs setting. This is useful for instances where a path hangs when attempting IO, but the path checker completes successfully. It allows the multipath device to fail quicker. When it's used like this it needs to be paired with the shaky path detection options, since multipathd will restore the path on the next checker run.
The rest of the patches add the auto_resize option. This option allows users to control when multipathd will automatically resize a device, if it sees that all of its path devices have been resized. By default it is set to "never" and multipath behaves like it always has, where users need to manually resize multipath devices after all the paths have been resized.
Benjamin Marzinski (7):
libmultipath: Add max_retries config option
libmutipath: Retain device size if sysfs_get_size fails.
multipathd: check and update all paths when in cli_resize
multipathd: move post-reloading commands into resize_map()
multipathd: move resize_map() to multipathd/main.c
multipathd: Add auto_resize config option libmultipath.version: bump ABI version to 22.0.0
libmultipath/config.c | 5 ++ libmultipath/config.h | 6 +++ libmultipath/configure.c | 1 + libmultipath/defaults.h | 1 + libmultipath/dict.c | 82 +++++++++++++++++++++++++++++++ libmultipath/dict.h | 1 + libmultipath/discovery.c | 42 +++++++++++++++- libmultipath/hwtable.c | 1 + libmultipath/libmultipath.version | 2 +- libmultipath/propsel.c | 35 +++++++++++++ libmultipath/propsel.h | 2 + libmultipath/structs.h | 15 ++++++ libmultipath/sysfs.c | 1 - multipath/multipath.conf.5.in | 38 ++++++++++++++ multipathd/cli_handlers.c | 65 ++++++++---------------- multipathd/main.c | 53 +++++++++++++++++++- multipathd/main.h | 2 + 17 files changed, 304 insertions(+), 48 deletions(-)
Signature · 1 line
2.41.0
Benjamin Marzinski
maintainerPATCH 1/7 libmultipath: Add max_retries config option
This option lets multipath set a scsi disk's max_retries sysfs value. Setting this can be helpful for cases where the path checker succeeds, but IO commands hang and timeout. By default, the SCSI layer will retry IOs 5 times. Reducing this value will allow multipath to retry the IO down another path sooner.
--- libmultipath/config.c | 3 +++ libmultipath/config.h | 3 +++ libmultipath/dict.c | 34 ++++++++++++++++++++++++++++ libmultipath/discovery.c | 42 ++++++++++++++++++++++++++++++++++- libmultipath/propsel.c | 18 +++++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 7 ++++++ multipath/multipath.conf.5.in | 22 ++++++++++++++++++ 8 files changed, 129 insertions(+), 1 deletion(-)
libmultipath/config.c +3 -0
@@ -420,6 +420,7 @@ merge_pce(struct pcentry *dst, struct pcentry *src)merge_num (fast_io_fail);merge_num (dev_loss);merge_num (eh_deadline); +merge_num (max_retries); } static void
@@ -448,6 +449,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)merge_num (fast_io_fail);merge_num (dev_loss);merge_num (eh_deadline); +merge_num (max_retries);merge_num (user_friendly_names);merge_num (retain_hwhandler);merge_num (detect_prio);
@@ -615,6 +617,7 @@ store_hwe (vector hwtable, struct hwentry * dhwe) hwe->fast_io_fail = dhwe->fast_io_fail; hwe->dev_loss = dhwe->dev_loss; hwe->eh_deadline = dhwe->eh_deadline; + hwe->max_retries = dhwe->max_retries; hwe->user_friendly_names = dhwe->user_friendly_names; hwe->retain_hwhandler = dhwe->retain_hwhandler; hwe->detect_prio = dhwe->detect_prio;
libmultipath/config.h +3 -0
@@ -47,6 +47,7 @@ struct pcentry {int fast_io_fail;unsigned int dev_loss;int eh_deadline; +int max_retries; };struct hwentry {
@@ -72,6 +73,7 @@ struct hwentry {int fast_io_fail;unsigned int dev_loss;int eh_deadline; +int max_retries;int user_friendly_names;int retain_hwhandler;int detect_prio;
@@ -162,6 +164,7 @@ struct config {int fast_io_fail;unsigned int dev_loss;int eh_deadline; +int max_retries;int log_checker_err;int allow_queueing;int allow_usb_devices;
libmultipath/dict.c +34 -0
@@ -1152,6 +1152,36 @@ declare_hw_snprint(eh_deadline, print_undef_off_zero) declare_pc_handler(eh_deadline, set_undef_off_zero) declare_pc_snprint(eh_deadline, print_undef_off_zero) +static int +set_max_retries (vector strvec,void *ptr,const char *file,int line_nr) +{ +char * buff; +int *int_ptr = (int *)ptr; + + buff =set_value (strvec); +if (!buff) +return 1 ; + +if (strcmp (buff,"off" ) ==0 ) + *int_ptr =UOZ_OFF ; +else if (strcmp (buff,"0" ) ==0 ) + *int_ptr =UOZ_ZERO ; +else +do_set_int (strvec, int_ptr,1 ,5 , file, line_nr, buff); + +free (buff); +return 0 ; +} + +declare_def_handler(max_retries, set_max_retries) +declare_def_snprint(max_retries, print_undef_off_zero) +declare_ovr_handler(max_retries, set_max_retries) +declare_ovr_snprint(max_retries, print_undef_off_zero) +declare_hw_handler(max_retries, set_max_retries) +declare_hw_snprint(max_retries, print_undef_off_zero) +declare_pc_handler(max_retries, set_max_retries) +declare_pc_snprint(max_retries, print_undef_off_zero) +static int set_pgpolicy (vector strvec,void *ptr,const char *file,int line_nr) {
@@ -2079,6 +2109,7 @@ init_keywords(vector keywords)install_keyword ("fast_io_fail_tmo" , &def_fast_io_fail_handler, &snprint_def_fast_io_fail);install_keyword ("dev_loss_tmo" , &def_dev_loss_handler, &snprint_def_dev_loss);install_keyword ("eh_deadline" , &def_eh_deadline_handler, &snprint_def_eh_deadline); +install_keyword ("max_retries" , &def_max_retries_handler, &snprint_def_max_retries);install_keyword ("bindings_file" , &deprecated_bindings_file_handler, &snprint_deprecated);install_keyword ("wwids_file" , &deprecated_wwids_file_handler, &snprint_deprecated);install_keyword ("prkeys_file" , &deprecated_prkeys_file_handler, &snprint_deprecated);
@@ -2176,6 +2207,7 @@ init_keywords(vector keywords)install_keyword ("fast_io_fail_tmo" , &hw_fast_io_fail_handler, &snprint_hw_fast_io_fail);install_keyword ("dev_loss_tmo" , &hw_dev_loss_handler, &snprint_hw_dev_loss);install_keyword ("eh_deadline" , &hw_eh_deadline_handler, &snprint_hw_eh_deadline); +install_keyword ("max_retries" , &hw_max_retries_handler, &snprint_hw_max_retries);install_keyword ("user_friendly_names" , &hw_user_friendly_names_handler, &snprint_hw_user_friendly_names);install_keyword ("retain_attached_hw_handler" , &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler);install_keyword ("detect_prio" , &hw_detect_prio_handler, &snprint_hw_detect_prio);
@@ -2220,6 +2252,7 @@ init_keywords(vector keywords)install_keyword ("fast_io_fail_tmo" , &ovr_fast_io_fail_handler, &snprint_ovr_fast_io_fail);install_keyword ("dev_loss_tmo" , &ovr_dev_loss_handler, &snprint_ovr_dev_loss);install_keyword ("eh_deadline" , &ovr_eh_deadline_handler, &snprint_ovr_eh_deadline); +install_keyword ("max_retries" , &ovr_max_retries_handler, &snprint_ovr_max_retries);install_keyword ("user_friendly_names" , &ovr_user_friendly_names_handler, &snprint_ovr_user_friendly_names);install_keyword ("retain_attached_hw_handler" , &ovr_retain_hwhandler_handler, &snprint_ovr_retain_hwhandler);install_keyword ("detect_prio" , &ovr_detect_prio_handler, &snprint_ovr_detect_prio);
@@ -2248,6 +2281,7 @@ init_keywords(vector keywords)install_keyword ("fast_io_fail_tmo" , &pc_fast_io_fail_handler, &snprint_pc_fast_io_fail);install_keyword ("dev_loss_tmo" , &pc_dev_loss_handler, &snprint_pc_dev_loss);install_keyword ("eh_deadline" , &pc_eh_deadline_handler, &snprint_pc_eh_deadline); +install_keyword ("max_retries" , &pc_max_retries_handler, &snprint_pc_max_retries);install_sublevel_end ();install_keyword_root ("multipaths" , &multipaths_handler);
libmultipath/discovery.c +41 -1
63 lines not on this page · raw message
libmultipath/propsel.c +18 -0
@@ -960,6 +960,24 @@ out:return 0 ; } +int select_max_retries (struct config *conf,struct path *pp) +{ +const char *origin; +STRBUF_ON_STACK (buff); + +pp_set_ovr_pce (max_retries); +pp_set_hwe (max_retries); +pp_set_conf (max_retries); + pp->max_retries =MAX_RETRIES_UNSET ; +/* not changing sysfs in default cause, so don't print anything */ +return 0 ; +out: +print_undef_off_zero (&buff, pp->max_retries); +condlog (3 ,"%s: max_retries = %s %s" , pp->dev, +get_strbuf_str (&buff), origin); +return 0 ; +} +int select_flush_on_last_del (struct config *conf,struct multipath *mp) {const char *origin;
libmultipath/propsel.h +1 -0
@@ -21,6 +21,7 @@ int select_gid(struct config *conf, struct multipath *mp);int select_fast_io_fail (struct config *conf,struct path *pp);int select_dev_loss (struct config *conf,struct path *pp);int select_eh_deadline (struct config *conf,struct path *pp); +int select_max_retries (struct config *conf,struct path *pp);int select_reservation_key (struct config *conf,struct multipath *mp);int select_retain_hwhandler (struct config *conf,struct multipath * mp);int select_detect_prio (struct config *conf,struct path * pp);
libmultipath/structs.h +7 -0
@@ -295,6 +295,12 @@ enum eh_deadline_states { EH_DEADLINE_ZERO = UOZ_ZERO, }; +enum max_retries_states { +MAX_RETRIES_UNSET =UOZ_UNDEF , +MAX_RETRIES_OFF =UOZ_OFF , +MAX_RETRIES_ZERO =UOZ_ZERO , +}; +enum recheck_wwid_states {RECHECK_WWID_UNDEF =YNU_UNDEF ,RECHECK_WWID_OFF =YNU_NO ,
@@ -381,6 +387,7 @@ struct path {int fast_io_fail;unsigned int dev_loss;int eh_deadline; +int max_retries;bool is_checked;bool can_use_env_uid;unsigned int checker_timeout;
multipath/multipath.conf.5.in +22 -0
@@ -793,6 +793,22 @@ The default is: \fB<unset>\fR . . .TP +.B max_retries +Specify the maximum number of times the SCSI layer will retry IO commands +before returning failure. Setting this can be helpful for cases where the path +checker succeeds, but IO commands hang and timeout. By default, the SCSI layer +will retry IOs 5 times. Reducing this value will allow multipath to retry the IO +down another path sooner. \fBNote:\fR If it is necessary to set this value, it +is also recommended to set up shaky paths detection. See "Shaky paths detection" +below. Valid values are +\fB0\fR through \fB5\fR. +.RS +.TP +The default is: \fB<unset>\fR +.RE +. +. +.TP .B bindings_file (Deprecated) This option is not supported any more, and will be ignored. .RS
@@ -1687,6 +1703,8 @@ section: .TP .B eh_deadline .TP +.B max_retries +.TP .B flush_on_last_del .TP .B user_friendly_names
@@ -1773,6 +1791,8 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections: .TP .B eh_deadline .TP +.B max_retries +.TP .B user_friendly_names .TP .B retain_attached_hw_handler
@@ -1844,6 +1864,8 @@ from the \fIoverrides\fR, \fIdevices\fR, or \fIdefaults\fR section: .B dev_loss_tmo .TP .B eh_deadline +.TP +.B max_retries .PD . .
Signature · 1 line
2.41.0
Re: [PATCH 1/7] libmultipath: Add max_retries config option
Quoted 9 lines · Benjamin Marzinski
This option lets multipath set a scsi disk's
max_retriessysfs value. Setting this can be helpful for cases where the path checker succeeds,
but IO commands hang and timeout. By default, the SCSI layer will retry
IOs 5 times. Reducing this value will allow multipath to retry the IO down another path sooner.Signed-off-by Benjamin Marzinski <[email protected]>
2 nitpicks below. Please explain to me again why we recommend to activate shaky paths detection with this. What will go wrong if the user uses max_retries without shaky path detection?
Quoted 26 lines
---
libmultipath/config.c | 3 +++ libmultipath/config.h | 3 +++ libmultipath/dict.c | 34 ++++++++++++++++++++++++++++ libmultipath/discovery.c | 42
++++++++++++++++++++++++++++++++++-libmultipath/propsel.c | 18 +++++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 7 ++++++ multipath/multipath.conf.5.in | 22 ++++++++++++++++++ 8 files changed, 129 insertions(+), 1 deletion(-)libmultipath/dict.c +0
-0@@ -1152,6 +1152,36 @@ declare_hw_snprint(eh_deadline, print_undef_off_zero) declare_pc_handler(eh_deadline, set_undef_off_zero) declare_pc_snprint(eh_deadline, print_undef_off_zero)libmultipath/dict.c +2
-0+static int +set_max_retries(vector strvec, void *ptr, const char *file, int
line_nr)libmultipath/dict.c +2
-0+{ +char * buff;
libmultipath/dict.c declare_hw_snprint(eh_deadline, print_undef_off_zero) · line 1168
Quoted 10 lines
libmultipath/dict.c +10
-0+int *int_ptr = (int *)ptr; + + buff =set_value (strvec); +if (!buff) +return 1 ; + +if (strcmp (buff,"off" ) ==0 ) + *int_ptr =UOZ_OFF ; +else if (strcmp (buff,"0" ) ==0 ) + *int_ptr =UOZ_ZERO ;
Why not use MAX_RETRIES_OFF and MAX_RETRIES_ZERO here?
Quoted 20 lines
libmultipath/dict.c +2
-0+else + do_set_int(strvec, int_ptr, 1, 5, file, line_nr,buff);
libmultipath/dict.c +5
-0+ +free (buff); +return 0 ; +} +multipath/multipath.conf.5.in +0
-0@@ -793,6 +793,22 @@ The default is: \fB<unset>\fR.
.
.TP
+.Bmax_retries
+Specify the maximum number of times the SCSI layer will retry IO
Quoted 8 lines
commands
+before returning failure. Setting this can be helpful for cases where the path
+checker succeeds, but IO commands hang and timeout. By default, the SCSI layer
+will retry IOs 5 times. Reducing this value will allow multipath to retry the IO
+down another path sooner. \fBNote:\fR If it is necessary to set this
Maybe you should add "[retry IO commands] for some types of SCSI errors". Otherwise users might get their hopes too high. IIRC the main cases that matter here are DID_TRANSPORT_DISRUPTED and perhaps DID_BUS_BUSY (don't put that in the man page) ;-)
Quoted 9 lines
value, it
+is also recommended to set up shaky paths detection. See "Shaky paths detection"multipath/multipath.conf.5.in +6
-0+below. Valid values are +\fB0\fR through \fB5\fR. +.RS +.TP +The default is: \fB<unset>\fR +.RE
Benjamin Marzinski
maintainerRe: [PATCH 1/7] libmultipath: Add max_retries config option
Quoted 9 lines · Martin Wilck
Quoted 8 lines · Benjamin Marzinski
This option lets multipath set a scsi disk's
max_retriessysfs value. Setting this can be helpful for cases where the path checker succeeds,
but IO commands hang and timeout. By default, the SCSI layer will retry
IOs 5 times. Reducing this value will allow multipath to retry the IO down another path sooner.
Quoted 5 lines
Quoted 1 line
Signed-off-by Benjamin Marzinski <[email protected]>2 nitpicks below. Please explain to me again why we recommend to activate shaky paths detection with this. What will go wrong if the user uses
max_retrieswithout shaky path detection?
In the case were the path_checker keeps succeeding, but the IOs keep hanging, multipathd will just keep restoring this path over and over again. That's the sort of path ping-ponging that shaky path detection should be able to stop. I guess this is can speed up other cases for failover as well, so I can leave that off. Hopefully people know that if they are seeing ping-ponging, shaky path detection can help with it.
Quoted 31 lines
Quoted 31 lines
---
libmultipath/config.c | 3 +++ libmultipath/config.h | 3 +++ libmultipath/dict.c | 34 ++++++++++++++++++++++++++++ libmultipath/discovery.c | 42
++++++++++++++++++++++++++++++++++-libmultipath/propsel.c | 18 +++++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 7 ++++++ multipath/multipath.conf.5.in | 22 ++++++++++++++++++ 8 files changed, 129 insertions(+), 1 deletion(-)libmultipath/dict.c +0
-0@@ -1152,6 +1152,36 @@ declare_hw_snprint(eh_deadline, print_undef_off_zero) declare_pc_handler(eh_deadline, set_undef_off_zero) declare_pc_snprint(eh_deadline, print_undef_off_zero)libmultipath/dict.c +2
-0+static int +set_max_retries(vector strvec, void *ptr, const char *file, int
line_nr)libmultipath/dict.c +6
-0+{ +char * buff; +int *int_ptr = (int *)ptr; + + buff =set_value (strvec); +if (!buff)
Quoted 8 lines
libmultipath/dict.c declare_hw_snprint(eh_deadline, print_undef_off_zero) · line 1168
Quoted 6 lines
libmultipath/dict.c +6
-0+return 1 ; + +if (strcmp (buff,"off" ) ==0 ) + *int_ptr =UOZ_OFF ; +else if (strcmp (buff,"0" ) ==0 ) + *int_ptr =UOZ_ZERO ;Why not use
MAX_RETRIES_OFFandMAX_RETRIES_ZEROhere?
No good reason. I can change that.
Quoted 25 lines
Quoted 25 lines
libmultipath/dict.c +2
-0+else + do_set_int(strvec, int_ptr, 1, 5, file, line_nr,buff);
libmultipath/dict.c +5
-0+ +free (buff); +return 0 ; +} +multipath/multipath.conf.5.in +0
-0@@ -793,6 +793,22 @@ The default is: \fB<unset>\fR.
.
.TP
+.Bmax_retries
+Specify the maximum number of times the SCSI layer will retry IO commands
+before returning failure. Setting this can be helpful for cases where the path
+checker succeeds, but IO commands hang and timeout. By default, the SCSI layer
Quoted 8 lines
Quoted 3 lines
+will retry IOs 5 times. Reducing this value will allow multipath to retry the IO
+down another path sooner. \fBNote:\fR If it is necessary to set thisMaybe you should add "[retry IO commands] for some types of SCSI errors". Otherwise users might get their hopes too high. IIRC the main cases that matter here are
DID_TRANSPORT_DISRUPTEDand perhapsDID_BUS_BUSY(don't put that in the man page) ;-)
Sure.
-Ben
Quoted 13 lines
Quoted 11 lines
value, it
+is also recommended to set up shaky paths detection. See "Shaky paths detection"multipath/multipath.conf.5.in +6
-0+below. Valid values are +\fB0\fR through \fB5\fR. +.RS +.TP +The default is: \fB<unset>\fR +.RE
Re: [PATCH 1/7] libmultipath: Add max_retries config option
Hi Ben,
Quoted 12 lines · Benjamin Marzinski
Quoted 11 lines · Martin Wilck
Quoted 10 lines · Benjamin Marzinski
This option lets multipath set a scsi disk's
max_retriessysfs value.
Setting this can be helpful for cases where the path checker succeeds,
but IO commands hang and timeout. By default, the SCSI layer will retry
IOs 5 times. Reducing this value will allow multipath to retry the IO
down another path sooner.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Benjamin Marzinski <[email protected]>2 nitpicks below. Please explain to me again why we recommend to activate shaky paths detection with this. What will go wrong if the user uses
max_retrieswithout shaky path detection?
I've thought about this some more after my review. Similar to the auto- resize, do we need to make this parameter a hardware property? AFAICS it would be sufficient to have it as setting in the "defaults" section, which would make the patch much simpler.
Quoted 8 lines
In the case were the
path_checkerkeeps succeeding, but the IOs keep hanging, multipathd will just keep restoring this path over and over again. That's the sort of path ping-ponging that shaky path detection should be able to stop. I guess this is can speed up other cases for failover as well, so I can leave that off. Hopefully people know that
if they are seeing ping-ponging, shaky path detection can help with it.
This is a general argument for enabling shaky paths detection. But I don't see how it relates to max_retries. Decreasing max_retries should make it less likely that regular IOs are hanging while the path checker succeeds, whether or not shaky path detection is enabled. By decreasing max_retries, we force the kernel to treat regular IO more like passthrough IO. AFAIU that should decrease the difference of failure probability between the path checker and regular IO.
I have another question; as pointed out in my previous post about this patch, max_retries only affects the kernel's "maybe_retry" case, IOW mostly DID_TRANSPORT_DISRUPTED. This is a condition that can happen with shaky paths. But SCSI command timeouts are also likely, and for that case, reducing max_retries isn't going to help, as timed out commands won't be retried but passed to the error handler. DID_TRANSPORT_DISRUPTED errors will happen quickly most of the time. IOW, I don't quite understand how decreasing max_retries substantially decreases the time regular I/O would be hanging [1]. I associate hanging IO mostly with command timeouts. Am I missing something here?
Regards
Martin
[1] Note that SAM_STAT_BUSY is treated by the kernel with ADD_TO_MLQUEUE, which means max_retries is ignored.
Benjamin Marzinski
maintainerRe: [PATCH 1/7] libmultipath: Add max_retries config option
Quoted 22 lines · Martin Wilck
Hi Ben,
Quoted 12 lines · Benjamin Marzinski
Quoted 11 lines · Martin Wilck
Quoted 10 lines · Benjamin Marzinski
This option lets multipath set a scsi disk's
max_retriessysfs value.
Setting this can be helpful for cases where the path checker succeeds,
but IO commands hang and timeout. By default, the SCSI layer will retry
IOs 5 times. Reducing this value will allow multipath to retry the IO
down another path sooner.Quoted 6 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Benjamin Marzinski <[email protected]>2 nitpicks below. Please explain to me again why we recommend to activate shaky paths detection with this. What will go wrong if the user uses
max_retrieswithout shaky path detection?
Quoted 4 lines
I've thought about this some more after my review. Similar to the auto- resize, do we need to make this parameter a hardware property? AFAICS it would be sufficient to have it as setting in the "defaults" section, which would make the patch much simpler.
Sure.
Quoted 10 lines
Quoted 9 lines
In the case were the
path_checkerkeeps succeeding, but the IOs keep hanging, multipathd will just keep restoring this path over and over again. That's the sort of path ping-ponging that shaky path detection should be able to stop. I guess this is can speed up other cases for failover as well, so I can leave that off. Hopefully people know that
if they are seeing ping-ponging, shaky path detection can help with it.
Quoted 7 lines
This is a general argument for enabling shaky paths detection. But I don't see how it relates to
max_retries. Decreasingmax_retriesshould make it less likely that regular IOs are hanging while the path checker succeeds, whether or not shaky path detection is enabled. By decreasingmax_retries, we force the kernel to treat regular IO more like passthrough IO. AFAIU that should decrease the difference of failure probability between the path checker and regular IO.
I wasn't being clear. Changing this won't make ping-ponging more likely. It's just that if you are in the case where IO is hanging for extended periods of time and then failing, but the path checker is succeeding, and you want to an efficiently running system, changing max_retries will only get you halfway there, since it won't fix the ping-ponging. I agree that the ping-ponging is a seperate issue. My brain was sort of stuck in the specific customer issue that drove all this work, which did involve ping-ponging.
Quoted 10 lines
I have another question; as pointed out in my previous post about this patch,
max_retriesonly affects the kernel's "maybe_retry" case, IOW mostlyDID_TRANSPORT_DISRUPTED. This is a condition that can happen with shaky paths. But SCSI command timeouts are also likely, and for that case, reducingmax_retriesisn't going to help, as timed out commands won't be retried but passed to the error handler.DID_TRANSPORT_DISRUPTEDerrors will happen quickly most of the time. IOW, I don't quite understand how decreasingmax_retriessubstantially decreases the time regular I/O would be hanging [1]. I associate hanging IO mostly with command timeouts. Am I missing something here?
This work is all in response to a customer, who found that the only way to work around what turned out in the end to be an HBA issue, was to lower max_retries and turn on shaky path detection, to make multipath quickly ignore unusable paths. I admit that I didn't dig into why reducing max_retries sped things up. They just asked if it was possible to make multipath control this scsi config parameter like it does others, and it seemed like a reasonable request to me.
-Ben
Quoted 5 lines
Regards
Martin[1] Note that
SAM_STAT_BUSYis treated by the kernel withADD_TO_MLQUEUE, which meansmax_retriesis ignored.
Re: [PATCH 1/7] libmultipath: Add max_retries config option
Quoted 61 lines · Benjamin Marzinski
Quoted 14 lines · Martin Wilck
Quoted 5 lines
In the case were the
path_checkerkeeps succeeding, but the IOs keep
hanging, multipathd will just keep restoring this path over and over
again. That's the sort of path ping-ponging that shaky pathQuoted 8 lines
detection
should be able to stop. I guess this is can speed up other cases for
failover as well, so I can leave that off. Hopefully people know that
if they are seeing ping-ponging, shaky path detection can help with
it.Quoted 12 lines
This is a general argument for enabling shaky paths detection. But I
don't see how it relates tomax_retries. Decreasingmax_retriesshould
make it less likely that regular IOs are hanging while the path checker
succeeds, whether or not shaky path detection is enabled. By decreasingmax_retries, we force the kernel to treat regular IO more like passthrough IO. AFAIU that should decrease the difference of failure
probability between the path checker and regular IO.I wasn't being clear. Changing this won't make ping-ponging more likely.
It's just that if you are in the case where IO is hanging for extended
periods of time and then failing, but the path checker is succeeding, and you want to an efficiently running system, changingmax_retrieswill
only get you halfway there, since it won't fix the ping-ponging. I agree
that the ping-ponging is a seperate issue. My brain was sort of stuck in
the specific customer issue that drove all this work, which did involve
ping-ponging.Quoted 8 lines
I have another question; as pointed out in my previous post about this
patch,max_retriesonly affects the kernel's "maybe_retry" case, IOW
mostlyDID_TRANSPORT_DISRUPTED. This is a condition that can happen with shaky paths. But SCSI command timeouts are also likely, and for
that case, reducingmax_retriesisn't going to help, as timed outQuoted 8 lines
commands won't be retried but passed to the error handler.
DID_TRANSPORT_DISRUPTEDerrors will happen quickly most of the time.
IOW, I don't quite understand how decreasingmax_retriessubstantially
decreases the time regular I/O would be hanging [1]. I associate hanging IO mostly with command timeouts. Am I missing something here?
Quoted 9 lines
This work is all in response to a customer, who found that the only way
to work around what turned out in the end to be an HBA issue, was to lowermax_retriesand turn on shaky path detection, to make multipath quickly ignore unusable paths. I admit that I didn't dig into why reducingmax_retriessped things up. They just asked if it was possible
to make multipath control this scsi config parameter like it does others, and it seemed like a reasonable request to me.
Right. I didn't want to say it's not. I was just hoping that we could achieve a better understanding of the underlying issue.
Martin
Benjamin Marzinski
maintainerPATCH 2/7 libmutipath: Retain device size if sysfs_get_size fails.
In reply to Benjamin MarzinskiWhen paths are allocated their size is initialized to 0. If they've already set a size, and a future call to sysfs_get_size() fails during the parsing, assume that the size hasn't changed, instead of setting it to 0. All other failures in sysfs_get_size() already retain the existing size.
--- libmultipath/sysfs.c | 1 - 1 file changed, 1 deletion(-)
libmultipath/sysfs.c +0 -1
@@ -175,7 +175,6 @@ sysfs_get_size (struct path *pp, unsigned long long * size)if (r !=1 ) {condlog (3 ,"%s: Cannot parse size attribute" , pp->dev); - *size =0 ;return 1 ; }
Signature · 1 line
2.41.0
Re: [PATCH 2/7] libmutipath: Retain device size if sysfs_get_size fails.
Quoted 10 lines · Benjamin Marzinski
When paths are allocated their size is initialized to 0. If they've already set a size, and a future call to
sysfs_get_size()fails during
the parsing, assume that the size hasn't changed, instead of setting it
to 0. All other failures insysfs_get_size()already retain the existing
size.Signed-off-by Benjamin Marzinski <[email protected]>
Quoted 18 lines
---
libmultipath/sysfs.c | 1 -1 file changed, 1 deletion(-)libmultipath/sysfs.c +0
-0@@ -175,7 +175,6 @@ sysfs_get_size (struct path *pp, unsigned long long * size)
if (r != 1) {
condlog(3, "%s: Cannot parse size attribute", pp-Quoted 1 line
dev);
libmultipath/sysfs.c +0
-1- *size =0 ;return 1;
}
Benjamin Marzinski
maintainerPATCH 3/7 multipathd: check and update all paths when in cli_resize
In reply to Benjamin MarzinskiWhen resizing a multipath device, make sure that all the paths have been updated to the new size first.
--- multipathd/cli_handlers.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
multipathd/cli_handlers.c +17 -13
@@ -845,9 +845,11 @@ cli_resize(void *v, struct strbuf *reply, void *data)char * mapname =get_keyparam (v,KEY_MAP );struct multipath *mpp;int minor; -unsigned long long size; +unsigned long long size =0 ;struct pathgroup *pgp;struct path *pp; +unsigned int i, j; +bool mismatch = false; mapname =convert_dev (mapname,0 );condlog (2 ,"%s: resize map (operator)" , mapname);
@@ -867,21 +869,23 @@ cli_resize(void *v, struct strbuf *reply, void *data)return 1 ; } - pgp =VECTOR_SLOT (mpp->pg,0 ); - -if (!pgp){ -condlog (0 ,"%s: couldn't get path group. cannot resize" , - mapname); -return 1 ; + vector_foreach_slot(mpp->pg, pgp, i) { + vector_foreach_slot (pgp->paths, pp, j) { +if (sysfs_get_size (pp, &pp->size) !=0 ) +continue ; +if (!size) + size = pp->size; +else if (pp->size != size) + mismatch = true; + } } - pp =VECTOR_SLOT (pgp->paths,0 ); - -if (!pp){ -condlog (0 ,"%s: couldn't get path. cannot resize" , mapname); +if (!size) { +condlog (0 ,"%s: couldn't get size from sysfs. cannot resize" , + mapname);return 1 ; } -if (!pp->udev ||sysfs_get_size (pp, &size)) { -condlog (0 ,"%s: couldn't get size for sysfs. cannot resize" , +if (mismatch) { +condlog (0 ,"%s: path size not consistent. cannot resize" , mapname);return 1 ; }
Signature · 1 line
2.41.0
Re: [PATCH 3/7] multipathd: check and update all paths when in cli_resize
Quoted 36 lines · Benjamin Marzinski
When resizing a multipath device, make sure that all the paths have been updated to the new size first.
Signed-off-by Benjamin Marzinski <[email protected]>---
multipathd/cli_handlers.c | 30 +++++++++++++++++-------------1 file changed, 17 insertions(+), 13 deletions(-)multipathd/cli_handlers.c +3
-1@@ -845,9 +845,11 @@ cli_resize(void *v, struct strbuf *reply, void *data) char * mapname = get_keyparam(v, KEY_MAP); struct multipath *mpp; int minor; -unsigned long long size; +unsigned long long size =0 ; struct pathgroup *pgp; struct path *pp; +unsigned int i, j; +bool mismatch = false;
mapname =convert_dev(mapname, 0);condlog(2, "%s: resize map (operator)", mapname);multipathd/cli_handlers.c +0
-0@@ -867,21 +869,23 @@ cli_resize(void *v, struct strbuf *reply, void *data) return 1; }multipathd/cli_handlers.c +0
-4- pgp =VECTOR_SLOT (mpp->pg,0 ); - -if (!pgp){ - condlog(0, "%s: couldn't get path group. cannotresize",
multipathd/cli_handlers.c cli_resize(void *v, struct strbuf *reply, void *data) · line 877
Quoted 8 lines
multipathd/cli_handlers.c +6
-2- mapname); -return 1 ; + vector_foreach_slot(mpp->pg, pgp, i) { + vector_foreach_slot (pgp->paths, pp, j) { +if (sysfs_get_size (pp, &pp->size) !=0 ) +continue ; +if (!size) + size = pp->size;
In the previous patch, you assume that if sysfs_get_size() fails, the size is unchanged. The "continue" doesn't make much sense to me: you should make the same assumption here, i.e. set size = pp->size even in the failure case. Otherwise you might miss a size mismatch.
Altenatively, you could error out immediately if sysfs_get_size() fails for any path.
Martin
Quoted 24 lines
multipathd/cli_handlers.c +3
-0+else if (pp->size != size) + mismatch = true; + }}
multipathd/cli_handlers.c +0
-4- pp =VECTOR_SLOT (pgp->paths,0 ); - -if (!pp){ - condlog(0, "%s: couldn't get path. cannot resize",mapname);
multipathd/cli_handlers.c +2
-0+if (!size) { + condlog(0, "%s: couldn't get size from sysfs. cannotresize",
multipathd/cli_handlers.c +1
-0+ mapname);return 1;
}multipathd/cli_handlers.c +0
-2-if (!pp->udev ||sysfs_get_size (pp, &size)) { - condlog(0, "%s: couldn't get size for sysfs. cannotresize",
multipathd/cli_handlers.c +2
-0+if (mismatch) { + condlog(0, "%s: path size not consistent. cannotresize",
mapname);
return 1;
}
Benjamin Marzinski
maintainerRe: [PATCH 3/7] multipathd: check and update all paths when in cli_resize
Quoted 51 lines · Martin Wilck
Quoted 36 lines · Benjamin Marzinski
When resizing a multipath device, make sure that all the paths have been updated to the new size first.
Signed-off-by Benjamin Marzinski <[email protected]>---
multipathd/cli_handlers.c | 30 +++++++++++++++++-------------1 file changed, 17 insertions(+), 13 deletions(-)multipathd/cli_handlers.c +3
-1@@ -845,9 +845,11 @@ cli_resize(void *v, struct strbuf *reply, void *data) char * mapname = get_keyparam(v, KEY_MAP); struct multipath *mpp; int minor; -unsigned long long size; +unsigned long long size =0 ; struct pathgroup *pgp; struct path *pp; +unsigned int i, j; +bool mismatch = false;
mapname =convert_dev(mapname, 0);condlog(2, "%s: resize map (operator)", mapname);multipathd/cli_handlers.c +0
-0@@ -867,21 +869,23 @@ cli_resize(void *v, struct strbuf *reply, void *data) return 1; }multipathd/cli_handlers.c +0
-4- pgp =VECTOR_SLOT (mpp->pg,0 ); - -if (!pgp){ - condlog(0, "%s: couldn't get path group. cannotresize",
multipathd/cli_handlers.c cli_resize(void *v, struct strbuf *reply, void *data) · line 877
Quoted 8 lines
multipathd/cli_handlers.c +6
-2- mapname); -return 1 ; + vector_foreach_slot(mpp->pg, pgp, i) { + vector_foreach_slot (pgp->paths, pp, j) { +if (sysfs_get_size (pp, &pp->size) !=0 ) +continue ; +if (!size) + size = pp->size;In the previous patch, you assume that if
sysfs_get_size()fails, the size is unchanged. The "continue" doesn't make much sense to me: you should make the same assumption here, i.e. set size =pp->sizeeven in the failure case. Otherwise you might miss a size mismatch.
Quoted 2 lines
Altenatively, you could error out immediately if
sysfs_get_size()fails for any path.
I figured that paths for which we can't get a size shouldn't stop a resize if all the other paths have changed size, but I admit that isn't really consistent. I'll change it.
-Ben
Quoted 27 lines
Martin
Quoted 24 lines
multipathd/cli_handlers.c +3
-0+else if (pp->size != size) + mismatch = true; + }}
multipathd/cli_handlers.c +0
-4- pp =VECTOR_SLOT (pgp->paths,0 ); - -if (!pp){ - condlog(0, "%s: couldn't get path. cannot resize",mapname);
multipathd/cli_handlers.c +2
-0+if (!size) { + condlog(0, "%s: couldn't get size from sysfs. cannotresize",
multipathd/cli_handlers.c +1
-0+ mapname);return 1;
}multipathd/cli_handlers.c +0
-2-if (!pp->udev ||sysfs_get_size (pp, &size)) { - condlog(0, "%s: couldn't get size for sysfs. cannotresize",
multipathd/cli_handlers.c +2
-0+if (mismatch) { + condlog(0, "%s: path size not consistent. cannotresize",
mapname);
return 1;
}
Benjamin Marzinski
maintainerPATCH 4/7 multipathd: move post-reloading commands into resize_map()
In reply to Benjamin MarzinskiIn preparation for reusing resize_map() in other code, move all code necessary to resize the map to the resize_map() function. Also track if map was removed in the function.
--- multipathd/cli_handlers.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
multipathd/cli_handlers.c +9 -7
@@ -835,6 +835,10 @@ static int resize_map(struct multipath *mpp, unsigned long long size, mpp->size = orig_size;return 1 ; } +if (setup_multipath (vecs, mpp) !=0 ) +return 2 ; +sync_map_state (mpp); +return 0 ; }
@@ -848,7 +852,7 @@ cli_resize(void *v, struct strbuf *reply, void *data)unsigned long long size =0 ;struct pathgroup *pgp;struct path *pp; -unsigned int i, j; +unsigned int i, j, ret;bool mismatch = false; mapname =convert_dev (mapname,0 );
@@ -897,14 +901,12 @@ cli_resize(void *v, struct strbuf *reply, void *data)condlog (3 ,"%s old size is %llu, new size is %llu" , mapname, mpp->size, size); -if (resize_map (mpp, size, vecs) !=0 ) -return 1 ; + ret =resize_map (mpp, size, vecs); -if (setup_multipath (vecs, mpp) !=0 ) -return 1 ; -sync_map_state (mpp); +if (ret ==2 ) +condlog (0 ,"%s: map removed while trying to resize" , mapname); -return 0 ; +return (ret !=0 ); } static int
Signature · 1 line
2.41.0
Re: [PATCH 4/7] multipathd: move post-reloading commands into resize_map()
Quoted 6 lines · Benjamin Marzinski
In preparation for reusing
resize_map()in other code, move all code necessary to resize the map to theresize_map()function. Also track if
map was removed in the function.Signed-off-by Benjamin Marzinski <[email protected]>
Benjamin Marzinski
maintainerPATCH 5/7 multipathd: move resize_map() to multipathd/main.c
In reply to Benjamin MarzinskiNo functional changes.
--- multipathd/cli_handlers.c | 29 ----------------------------- multipathd/main.c | 29 +++++++++++++++++++++++++++++ multipathd/main.h | 2 ++ 3 files changed, 31 insertions(+), 29 deletions(-)
multipathd/cli_handlers.c +0 -29
@@ -813,35 +813,6 @@ cli_reload(void *v, struct strbuf *reply, void *data)return reload_and_sync_map (mpp, vecs); } -static int resize_map (struct multipath *mpp,unsigned long long size, -struct vectors * vecs) -{ - char *params __attribute__((cleanup(cleanup_charp))) = NULL; -unsigned long long orig_size = mpp->size; - - mpp->size = size; -update_mpp_paths (mpp, vecs->pathvec); -if (setup_map (mpp, ¶ms, vecs) !=0 ) { -condlog (0 ,"%s: failed to setup map for resize : %s" , - mpp->alias,strerror (errno)); - mpp->size = orig_size; -return 1 ; - } - mpp->action =ACT_RESIZE ; - mpp->force_udev_reload =1 ; -if (domap (mpp, params,1 ) ==DOMAP_FAIL ) { -condlog (0 ,"%s: failed to resize map : %s" , mpp->alias, -strerror (errno)); - mpp->size = orig_size; -return 1 ; - } -if (setup_multipath (vecs, mpp) !=0 ) -return 2 ; -sync_map_state (mpp); - -return 0 ; -} -static int cli_resize (void *v,struct strbuf *reply,void *data) {
multipathd/main.c +29 -0
@@ -1530,6 +1530,35 @@ needs_ro_update(struct multipath *mpp, int ro)return true; } +int resize_map (struct multipath *mpp,unsigned long long size, +struct vectors * vecs) +{ + char *params __attribute__((cleanup(cleanup_charp))) = NULL; +unsigned long long orig_size = mpp->size; + + mpp->size = size; +update_mpp_paths (mpp, vecs->pathvec); +if (setup_map (mpp, ¶ms, vecs) !=0 ) { +condlog (0 ,"%s: failed to setup map for resize : %s" , + mpp->alias,strerror (errno)); + mpp->size = orig_size; +return 1 ; + } + mpp->action =ACT_RESIZE ; + mpp->force_udev_reload =1 ; +if (domap (mpp, params,1 ) ==DOMAP_FAIL ) { +condlog (0 ,"%s: failed to resize map : %s" , mpp->alias, +strerror (errno)); + mpp->size = orig_size; +return 1 ; + } +if (setup_multipath (vecs, mpp) !=0 ) +return 2 ; +sync_map_state (mpp); + +return 0 ; +} +static int uev_update_path (struct uevent *uev,struct vectors * vecs) {
multipathd/main.h +2 -0
@@ -52,4 +52,6 @@ int reload_and_sync_map(struct multipath *mpp, struct vectors *vecs);void handle_path_wwid_change (struct path *pp,struct vectors *vecs);bool check_path_wwid_change (struct path *pp);int finish_path_init (struct path *pp,struct vectors * vecs); +int resize_map (struct multipath *mpp,unsigned long long size, +struct vectors *vecs);#endif /* MAIN_H */
Signature · 1 line
2.41.0
Re: [PATCH 5/7] multipathd: move resize_map() to multipathd/main.c
Quoted 3 lines · Benjamin Marzinski
No functional changes.
Signed-off-by Benjamin Marzinski <[email protected]>
Benjamin Marzinski
maintainerPATCH 6/7 multipathd: Add auto_resize config option
In reply to Benjamin MarzinskiThis option gives multipathd the ability to automatically resize a device when it detects that all of the path devices have changed. By default it is set to never, and multipathd will continue to work like it always has, where a users must manually resize a multipath device.
--- libmultipath/config.c | 2 ++ libmultipath/config.h | 3 +++ libmultipath/configure.c | 1 + libmultipath/defaults.h | 1 + libmultipath/dict.c | 48 +++++++++++++++++++++++++++++++++++ libmultipath/dict.h | 1 + libmultipath/hwtable.c | 1 + libmultipath/propsel.c | 17 +++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 8 ++++++ multipath/multipath.conf.5.in | 16 ++++++++++++ multipathd/main.c | 24 +++++++++++++++++- 12 files changed, 122 insertions(+), 1 deletion(-)
libmultipath/config.c +2 -0
@@ -464,6 +464,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)merge_num (ghost_delay);merge_num (all_tg_pt);merge_num (recheck_wwid); +merge_num (auto_resize);merge_num (vpd_vendor_id);merge_num (san_path_err_threshold);merge_num (san_path_err_forget_rate);
@@ -519,6 +520,7 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)merge_num (skip_kpartx);merge_num (max_sectors_kb);merge_num (ghost_delay); +merge_num (auto_resize);merge_num (uid);merge_num (gid);merge_num (mode);
libmultipath/config.h +3 -0
@@ -96,6 +96,7 @@ struct hwentry {int all_tg_pt;int vpd_vendor_id;int recheck_wwid; +int auto_resize;char * bl_product;vector pctable;
@@ -135,6 +136,7 @@ struct mpentry {int skip_kpartx;int max_sectors_kb;int ghost_delay; +int auto_resize;uid_t uid;gid_t gid;mode_t mode;
@@ -204,6 +206,7 @@ struct config {int skip_delegate;unsigned int sequence_nr;int recheck_wwid; +int auto_resize;char * selector;struct _vector uid_attrs;
libmultipath/configure.c +1 -0
@@ -355,6 +355,7 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)select_max_sectors_kb (conf, mpp);select_ghost_delay (conf, mpp);select_flush_on_last_del (conf, mpp); +select_auto_resize (conf, mpp);sysfs_set_scsi_tmo (conf, mpp); marginal_pathgroups = conf->marginal_pathgroups;
libmultipath/defaults.h +1 -0
@@ -56,6 +56,7 @@#define DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT 1#define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF#define DEFAULT_RECHECK_WWID RECHECK_WWID_OFF +#define DEFAULT_AUTO_RESIZE AUTO_RESIZE_NEVER/* Enable no foreign libraries by default */ #define DEFAULT_ENABLE_FOREIGN "NONE"
libmultipath/dict.c +48 -0
77 lines not on this page · raw message
libmultipath/dict.h +1 -0
@@ -17,4 +17,5 @@ int print_no_path_retry(struct strbuf *buff, long v);int print_undef_off_zero (struct strbuf *buff,long v);int print_dev_loss (struct strbuf *buff,unsigned long v);int print_off_int_undef (struct strbuf *buff,long v); +int print_auto_resize (struct strbuf *buff,long v);#endif /* _DICT_H */
libmultipath/hwtable.c +1 -0
@@ -75,6 +75,7 @@ .skip_kpartx = SKIP_KPARTX_OFF, .max_sectors_kb = MAX_SECTORS_KB_UNDEF, .ghost_delay = GHOST_DELAY_OFF, + .auto_resize = AUTO_RESIZE_NEVER, },#endif
libmultipath/propsel.c +17 -0
@@ -1423,6 +1423,23 @@ out:return 0 ; } +int select_auto_resize (struct config *conf,struct multipath * mp) +{ +const char *origin; +STRBUF_ON_STACK (buff); + +mp_set_mpe (auto_resize); +mp_set_ovr (auto_resize); +mp_set_hwe (auto_resize); +mp_set_conf (auto_resize); +mp_set_default (auto_resize,DEFAULT_AUTO_RESIZE ); +out: +if (print_auto_resize (&buff, mp->auto_resize) !=0 ) +condlog (3 ,"%s: auto_resize = %s %s" , mp->alias, +get_strbuf_str (&buff), origin); +return 0 ; +} +int select_find_multipaths_timeout (struct config *conf,struct path *pp) {const char *origin;
libmultipath/propsel.h +1 -0
@@ -38,6 +38,7 @@ int select_marginal_path_err_rate_threshold(struct config *conf, struct multipatint select_marginal_path_err_recheck_gap_time (struct config *conf,struct multipath *mp);int select_marginal_path_double_failed_time (struct config *conf,struct multipath *mp);int select_ghost_delay (struct config *conf,struct multipath * mp); +int select_auto_resize (struct config *conf,struct multipath * mp);void reconcile_features_with_options (const char *id,char **features,int * no_path_retry,int *retain_hwhandler);
libmultipath/structs.h +8 -0
@@ -179,6 +179,13 @@ enum queue_mode_states { QUEUE_MODE_RQ, }; +enum auto_resize_state { +AUTO_RESIZE_UNDEF =0 , +AUTO_RESIZE_NEVER , +AUTO_RESIZE_GROW_ONLY , +AUTO_RESIZE_GROW_SHRINK , +}; +#define PROTOCOL_UNSET -1enum scsi_protocol {
@@ -447,6 +454,7 @@ struct multipath {int ghost_delay;int ghost_delay_tick;int queue_mode; +int auto_resize;uid_t uid;gid_t gid;mode_t mode;
multipath/multipath.conf.5.in +16 -0
@@ -1333,6 +1333,22 @@ The default is: \fBno\fR . . .TP +.B auto_resize +Controls when multipathd will automatically resize a multipath device. If set +to \fInever\fR, multipath devices must always be manually resized by either +running \fBmultipathd resize map <name>\fR or \fRmultipath -r <name>\fR. If +set to \fIgrow_only\fR, when multipathd detects that all of a multipath +device's paths have increased in size, it will automatically grow the multipath +device to the new size. If set to \fIgrow_shrink\fR, multipathd will also +automatically shrink the device once it detects all of its paths have decreased +in size. +.RS +.TP +The default is: \fBnever\fR +.RE +. +. +.TP .B enable_foreign Enables or disables foreign libraries (see section .I FOREIGN MULTIPATH SUPPORT
multipathd/main.c +23 -1
@@ -1633,7 +1633,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) ro =uevent_get_disk_ro (uev);if (needs_ro_update (mpp, ro)) {condlog (2 ,"%s: update path write_protect to '%d' (uevent)" , uev->kernel, ro); -if (mpp->wait_for_udev) mpp->wait_for_udev =2 ;else {
@@ -1648,6 +1647,29 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) } } } +if (mpp->auto_resize !=AUTO_RESIZE_NEVER && + !mpp->wait_for_udev) { +struct pathgroup *pgp; +struct path *pp2; +unsigned int i, j; +unsigned long long orig_size = mpp->size; + +if (!pp->size || pp->size == mpp->size || + (pp->size < mpp->size && + mpp->auto_resize ==AUTO_RESIZE_GROW_ONLY )) + goto out; + + vector_foreach_slot(mpp->pg, pgp, i) + vector_foreach_slot (pgp->paths, pp2, j) +if (pp2->size && pp2->size != pp->size) + goto out; + retval =resize_map (mpp, pp->size, vecs); +if (retval ==2 ) +condlog (2 ,"%s: map removed during resize" , pp->dev); +else if (retval ==0 ) +condlog (2 ,"%s: resized map from %llu to %llu" , + mpp->alias, orig_size, pp->size); + } } out:lock_cleanup_pop (vecs->lock);
Signature · 1 line
2.41.0
Re: [PATCH 6/7] multipathd: Add auto_resize config option
Quoted 28 lines · Benjamin Marzinski
This option gives multipathd the ability to automatically resize a device when it detects that all of the path devices have changed. By default it is set to never, and multipathd will continue to work like it
always has, where a users must manually resize a multipath device.Signed-off-by Benjamin Marzinski <[email protected]>---
libmultipath/config.c | 2 ++
libmultipath/config.h | 3 +++
libmultipath/configure.c | 1 +
libmultipath/defaults.h | 1 +
libmultipath/dict.c | 48
+++++++++++++++++++++++++++++++++++
libmultipath/dict.h | 1 +libmultipath/hwtable.c | 1 + libmultipath/propsel.c | 17 +++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 8 ++++++ multipath/multipath.conf.5.in | 16 ++++++++++++ multipathd/main.c | 24 +++++++++++++++++- 12 files changed, 122 insertions(+), 1 deletion(-)libmultipath/config.c +0
-0
libmultipath/config.c merge_hwe (struct hwentry * dst, struct hwentry * · line 468
Quoted 5 lines
libmultipath/config.c +1
-0@@ -464,6 +464,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src) merge_num(ghost_delay); merge_num(all_tg_pt); merge_num(recheck_wwid); +merge_num (auto_resize);
Why make this a hardware-specific option? Isn't it sufficient to just set this in the defaults section? I can hardly imagine users wanting auto-resize for one array and not for another.
Other than that, looks good to me (one nit below).
Martin
Quoted 8 lines
multipath/multipath.conf.5.in +0
-0@@ -1333,6 +1333,22 @@ The default is: \fBno\fR.
.
Quoted 8 lines
.TP
+.Bauto_resize
+Controls when multipathd will automatically resize a multipath device. If set
+to \fInever\fR, multipath devices must always be manually resized by either
+running \fBmultipathd resize map <name>\fR or \fRmultipath -r <name>\fR. If
I suggest not mentioning "multipath -r" here.
Quoted 37 lines
+set to \fIgrow_only\fR, when multipathd detects that all of a multipath
+device's paths have increased in size, it will automatically grow the multipath
+device to the new size. If set to \fIgrow_shrink\fR, multipathd will also
+automatically shrink the device once it detects all of its paths have decreasedmultipath/multipath.conf.5.in +8
-0+in size. +.RS +.TP +The default is: \fBnever\fR +.RE +. +. +.TP.B
enable_foreign
Enables or disables foreign libraries (see section .I FOREIGN MULTIPATH SUPPORTmultipathd/main.c +0
-0@@ -1633,7 +1633,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) ro = uevent_get_disk_ro(uev); if (needs_ro_update(mpp, ro)) {
condlog(2, "%s: update path write_protect to '%d' (uevent)", uev->kernel, ro);
-
if (mpp->wait_for_udev)mpp->wait_for_udev= 2; else {multipathd/main.c +0
-0@@ -1648,6 +1647,29 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) } }
multipathd/main.c uev_update_path (struct uevent *uev, struct · line 1659
Quoted 10 lines
multipathd/main.c +9
-0} +if (mpp->auto_resize !=AUTO_RESIZE_NEVER && + !mpp->wait_for_udev) { +struct pathgroup *pgp; +struct path *pp2; +unsigned int i, j; +unsigned long long orig_size = mpp->size; + + if (!pp->size || pp->size == mpp->size || + (pp->size < mpp->size &&
There's a whitespace issue here (space indentation).
Quoted 23 lines
multipathd/main.c +6
-0+ mpp->auto_resize == AUTO_RESIZE_GROW_ONLY)) + goto out; + + vector_foreach_slot(mpp->pg, pgp, i) + vector_foreach_slot (pgp->paths, pp2, j) + if (pp2->size && pp2->size!=
pp->size)multipathd/main.c +4
-0+ goto out; + retval =resize_map (mpp, pp->size, vecs); +if (retval ==2 ) + condlog(2, "%s: map removed duringresize",
pp->dev);multipathd/main.c +2
-0+else if (retval ==0 ) + condlog(2, "%s: resized map from%llu to %llu",
multipathd/main.c +1
-0+ mpp->alias, orig_size, pp-Quoted 1 line
size);
multipathd/main.c +1
-0+ }}
out:
lock_cleanup_pop(vecs->lock);
Benjamin Marzinski
maintainerRe: [PATCH 6/7] multipathd: Add auto_resize config option
Quoted 39 lines · Martin Wilck
Quoted 28 lines · Benjamin Marzinski
This option gives multipathd the ability to automatically resize a device when it detects that all of the path devices have changed. By default it is set to never, and multipathd will continue to work like it
always has, where a users must manually resize a multipath device.Signed-off-by Benjamin Marzinski <[email protected]>---
libmultipath/config.c | 2 ++
libmultipath/config.h | 3 +++
libmultipath/configure.c | 1 +
libmultipath/defaults.h | 1 +
libmultipath/dict.c | 48
+++++++++++++++++++++++++++++++++++
libmultipath/dict.h | 1 +libmultipath/hwtable.c | 1 + libmultipath/propsel.c | 17 +++++++++++++ libmultipath/propsel.h | 1 + libmultipath/structs.h | 8 ++++++ multipath/multipath.conf.5.in | 16 ++++++++++++ multipathd/main.c | 24 +++++++++++++++++- 12 files changed, 122 insertions(+), 1 deletion(-)libmultipath/config.c +0
-0libmultipath/config.c merge_hwe (struct hwentry * dst, struct hwentry * · line 468
Quoted 5 lines
libmultipath/config.c +1
-0@@ -464,6 +464,7 @@ merge_hwe (struct hwentry * dst, struct hwentry * src) merge_num(ghost_delay); merge_num(all_tg_pt); merge_num(recheck_wwid); +merge_num (auto_resize);Why make this a hardware-specific option? Isn't it sufficient to just set this in the defaults section? I can hardly imagine users wanting auto-resize for one array and not for another.
Quoted 1 line
Other than that, looks good to me (one nit below).
Sure. I'll fix all these up.
-Ben
Quoted 95 lines
Martin
Quoted 8 lines
multipath/multipath.conf.5.in +0
-0@@ -1333,6 +1333,22 @@ The default is: \fBno\fR.
.Quoted 8 lines
.TP
+.Bauto_resize
+Controls when multipathd will automatically resize a multipath device. If set
+to \fInever\fR, multipath devices must always be manually resized by either
+running \fBmultipathd resize map <name>\fR or \fRmultipath -r <name>\fR. IfI suggest not mentioning "multipath -r" here.
Quoted 37 lines
+set to \fIgrow_only\fR, when multipathd detects that all of a multipath
+device's paths have increased in size, it will automatically grow the multipath
+device to the new size. If set to \fIgrow_shrink\fR, multipathd will also
+automatically shrink the device once it detects all of its paths have decreasedmultipath/multipath.conf.5.in +8
-0+in size. +.RS +.TP +The default is: \fBnever\fR +.RE +. +. +.TP.B
enable_foreign
Enables or disables foreign libraries (see section .I FOREIGN MULTIPATH SUPPORTmultipathd/main.c +0
-0@@ -1633,7 +1633,6 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) ro = uevent_get_disk_ro(uev); if (needs_ro_update(mpp, ro)) {
condlog(2, "%s: update path write_protect to '%d' (uevent)", uev->kernel, ro);
-
if (mpp->wait_for_udev)mpp->wait_for_udev= 2; else {multipathd/main.c +0
-0@@ -1648,6 +1647,29 @@ uev_update_path (struct uevent *uev, struct vectors * vecs) } }multipathd/main.c uev_update_path (struct uevent *uev, struct · line 1659
Quoted 10 lines
multipathd/main.c +9
-0} +if (mpp->auto_resize !=AUTO_RESIZE_NEVER && + !mpp->wait_for_udev) { +struct pathgroup *pgp; +struct path *pp2; +unsigned int i, j; +unsigned long long orig_size = mpp->size; + + if (!pp->size || pp->size == mpp->size || + (pp->size < mpp->size &&There's a whitespace issue here (space indentation).
Quoted 23 lines
multipathd/main.c +6
-0+ mpp->auto_resize == AUTO_RESIZE_GROW_ONLY)) + goto out; + + vector_foreach_slot(mpp->pg, pgp, i) + vector_foreach_slot (pgp->paths, pp2, j) + if (pp2->size && pp2->size!=
pp->size)multipathd/main.c +4
-0+ goto out; + retval =resize_map (mpp, pp->size, vecs); +if (retval ==2 ) + condlog(2, "%s: map removed duringresize",
pp->dev);multipathd/main.c +2
-0+else if (retval ==0 ) + condlog(2, "%s: resized map from%llu to %llu",
multipathd/main.c +1
-0+ mpp->alias, orig_size, pp-Quoted 1 line
size);
multipathd/main.c +1
-0+ }}
out:
lock_cleanup_pop(vecs->lock);
Benjamin Marzinski
maintainerPATCH 7/7 libmultipath.version: bump ABI version to 22.0.0
In reply to Benjamin MarzinskiCommits ("libmultipath: Add max_retries config option") and ("multipathd: Add auto_resize config option") changed the size and member offsets of multiple structs.
--- libmultipath/libmultipath.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/libmultipath.version +1 -1
@@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 { put_multipath_config; }; -LIBMULTIPATH_21.0.0 { +LIBMULTIPATH_22.0.0 { global: /* symbols referenced by multipath and multipathd */ add_foreign;
Signature · 1 line
2.41.0
Re: [PATCH 7/7] libmultipath.version: bump ABI version to 22.0.0
Quoted 5 lines · Benjamin Marzinski
Commits ("libmultipath: Add
max_retriesconfig option") and ("multipathd: Addauto_resizeconfig option") changed the size and member offsets of multiple structs.Signed-off-by Benjamin Marzinski <[email protected]>
I should have bumped the ABI with my patch "libmultipath: deprecate bindings_file, wwids_file, prkeys_file" already. If you don't mind, just drop this, and I'll fix the ABI issues when I push to the "queue" branch.
I'd like to create a PR to Christophe soon, basically as soon as this series is reviewed.
Thanks,
Martin
Quoted 18 lines
---
libmultipath/libmultipath.version | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)libmultipath/libmultipath.version +0
-0@@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 { put_multipath_config; };libmultipath/libmultipath.version +1
-1-LIBMULTIPATH_21.0.0 { +LIBMULTIPATH_22.0.0 {global:
/* symbols referenced by multipath and multipathd */add_foreign;
Benjamin Marzinski
maintainerRe: [PATCH 7/7] libmultipath.version: bump ABI version to 22.0.0
Quoted 9 lines · Martin Wilck
Quoted 5 lines · Benjamin Marzinski
Commits ("libmultipath: Add
max_retriesconfig option") and ("multipathd: Addauto_resizeconfig option") changed the size and member offsets of multiple structs.Signed-off-by Benjamin Marzinski <[email protected]>
Quoted 7 lines
I should have bumped the ABI with my patch "libmultipath: deprecate
bindings_file,wwids_file,prkeys_file" already. If you don't mind, just drop this, and I'll fix the ABI issues when I push to the "queue" branch.I'd like to create a PR to Christophe soon, basically as soon as this series is reviewed.
Sure.
Quoted 23 lines
Thanks,
MartinQuoted 18 lines
---
libmultipath/libmultipath.version | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)libmultipath/libmultipath.version +0
-0@@ -43,7 +43,7 @@ LIBMPATHCOMMON_1.0.0 { put_multipath_config; };libmultipath/libmultipath.version +1
-1-LIBMULTIPATH_21.0.0 { +LIBMULTIPATH_22.0.0 {global:
/* symbols referenced by multipath and multipathd */add_foreign;