multipath-tools series part II: dev_loss_tmo fixes
cover multipath-tools series part II: dev_loss_tmo fixes
From: Martin Wilck <[email protected]>
Hi Christophe, hi Ben,
This is part II of a larger patch series for multpath-tools I've been preparing. It contains some minor fixes for dev_loss_tmo handling, mostly logging. It's based on the previously submitted part I.
The full series will also be available here:
https://github.com/mwilck/multipath-tools/tree/ups/submit-2007
There are tags in that repo for each part of the series. This part is tagged "submit-200709-2".
Regards,
Martin
Martin Wilck (4):
libmultipath: add macro DEV_LOSS_TMO_UNSET
libmultipath: improve logging for dev_loss_tmo override
libmultipath: print message if setting dev_loss_tmo is unsupported
libmultipath: increase log level of limiting dev_loss_tmo
libmultipath/defaults.h | 1 + libmultipath/dict.c | 4 +-- libmultipath/discovery.c | 56 ++++++++++++++++++++++++++++++---------- libmultipath/propsel.c | 2 +- 4 files changed, 46 insertions(+), 17 deletions(-)
Signature · 1 line
2.26.2
PATCH 36/39 libmultipath: add macro DEV_LOSS_TMO_UNSET
From: Martin Wilck <[email protected]>
The special value 0 means "unset" for dev_loss. Make this more explicit by using a macro.
--- libmultipath/defaults.h | 1 + libmultipath/dict.c | 4 ++-- libmultipath/discovery.c | 12 +++++++----- libmultipath/propsel.c | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-)
libmultipath/defaults.h +1 -0
@@ -58,6 +58,7 @@#define CHECKINT_UNDEF UINT_MAX#define DEFAULT_CHECKINT 5 +#define DEV_LOSS_TMO_UNSET 0U#define MAX_DEV_LOSS_TMO UINT_MAX#define DEFAULT_PIDFILE "/" RUN_DIR "/multipathd.pid"#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
libmultipath/dict.c +2 -2
@@ -873,7 +873,7 @@ set_dev_loss(vector strvec, void *ptr)if (!strcmp (buff,"infinity" )) *uint_ptr =MAX_DEV_LOSS_TMO ;else if (sscanf (buff,"%u" , uint_ptr) !=1 ) - *uint_ptr =0 ; + *uint_ptr =DEV_LOSS_TMO_UNSET ;FREE (buff);return 0 ;
@@ -882,7 +882,7 @@ set_dev_loss(vector strvec, void *ptr)int print_dev_loss (char * buff,int len,unsigned long v) { -if (!v) +if (v ==DEV_LOSS_TMO_UNSET )return 0 ;if (v >=MAX_DEV_LOSS_TMO )return snprintf (buff, len,"\"infinity\"" );
libmultipath/discovery.c +7 -5
@@ -671,7 +671,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) rport_id, value, -ret); } } -if (mpp->dev_loss >0 ) { +if (mpp->dev_loss !=DEV_LOSS_TMO_UNSET ) {snprintf (value,16 ,"%u" , mpp->dev_loss); ret =sysfs_attr_set_value (rport_dev,"dev_loss_tmo" , value,strlen (value));
@@ -705,7 +705,7 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)condlog (4 ,"target%d:%d:%d -> %s" , pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id, session_id); -if (mpp->dev_loss) { +if (mpp->dev_loss !=DEV_LOSS_TMO_UNSET ) {condlog (3 ,"%s: ignoring dev_loss_tmo on iSCSI" , pp->dev); }if (mpp->fast_io_fail !=MP_FAST_IO_FAIL_UNSET ) {
@@ -747,7 +747,7 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)condlog (4 ,"target%d:%d:%d -> %s" , pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.scsi_id, end_dev_id); -if (mpp->dev_loss) { +if (mpp->dev_loss !=DEV_LOSS_TMO_UNSET ) {snprintf (value,11 ,"%u" , mpp->dev_loss);if (sysfs_attr_set_value (sas_dev,"I_T_nexus_loss_timeout" , value,strlen (value)) <=0 )
@@ -782,13 +782,15 @@ sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint) mpp->alias, dev_loss_tmo); } mpp->dev_loss = dev_loss_tmo; -if (mpp->dev_loss && mpp->fast_io_fail >0 && +if (mpp->dev_loss !=DEV_LOSS_TMO_UNSET && + mpp->fast_io_fail !=MP_FAST_IO_FAIL_UNSET && (unsigned int )mpp->fast_io_fail >= mpp->dev_loss) {condlog (3 ,"%s: turning off fast_io_fail (%d is not smaller than dev_loss_tmo)" , mpp->alias, mpp->fast_io_fail); mpp->fast_io_fail =MP_FAST_IO_FAIL_OFF ; } -if (!mpp->dev_loss && mpp->fast_io_fail ==MP_FAST_IO_FAIL_UNSET ) +if (mpp->dev_loss ==DEV_LOSS_TMO_UNSET && + mpp->fast_io_fail ==MP_FAST_IO_FAIL_UNSET )return 0 ; vector_foreach_slot(mpp->paths, pp, i) {
libmultipath/propsel.c +1 -1
@@ -766,7 +766,7 @@ int select_dev_loss(struct config *conf, struct multipath *mp)mp_set_ovr (dev_loss);mp_set_hwe (dev_loss);mp_set_conf (dev_loss); - mp->dev_loss =0 ; + mp->dev_loss =DEV_LOSS_TMO_UNSET ;return 0 ; out:print_dev_loss (buff,12 , mp->dev_loss);
Signature · 1 line
2.26.2
PATCH 37/39 libmultipath: improve logging for dev_loss_tmo override
In reply to [email protected]From: Martin Wilck <[email protected]>
Print a more meaningful warning message, and at higher level, if the configured dev_loss_tmo can't be applied because it conflicts with no_path_retry.
--- libmultipath/discovery.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
libmultipath/discovery.c +6 -5
@@ -774,14 +774,15 @@ sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint) no_path_retry_tmo =MAX_DEV_LOSS_TMO ;if (no_path_retry_tmo > dev_loss_tmo) dev_loss_tmo = no_path_retry_tmo; -condlog (3 ,"%s: update dev_loss_tmo to %u" , - mpp->alias, dev_loss_tmo); }else if (mpp->no_path_retry ==NO_PATH_RETRY_QUEUE ) { dev_loss_tmo =MAX_DEV_LOSS_TMO ; -condlog (3 ,"%s: update dev_loss_tmo to %u" , - mpp->alias, dev_loss_tmo); } - mpp->dev_loss = dev_loss_tmo; +if (mpp->dev_loss !=DEV_LOSS_TMO_UNSET && + mpp->dev_loss != dev_loss_tmo) { +condlog (2 ,"%s: Using dev_loss_tmo=%u instead of %u because of no_path_retry setting" , + mpp->alias, dev_loss_tmo, mpp->dev_loss); + mpp->dev_loss = dev_loss_tmo; + }if (mpp->dev_loss !=DEV_LOSS_TMO_UNSET && mpp->fast_io_fail !=MP_FAST_IO_FAIL_UNSET && (unsigned int )mpp->fast_io_fail >= mpp->dev_loss) {
Signature · 1 line
2.26.2
PATCH 38/39 libmultipath: print message if setting dev_loss_tmo is unsupported
In reply to [email protected]From: Martin Wilck <[email protected]>
If dev_loss_tmo can't be set because it's not supported for the protocol at hand, let the user know.
Fixme: we could implement this for other protocols such as NVMe.
--- libmultipath/discovery.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
libmultipath/discovery.c +28 -3
@@ -33,6 +33,8 @@#include "unaligned.h" #include "prioritizers/alua_rtpg.h" #include "foreign.h" +#include "configure.h" +#include "print.h" struct vpd_vendor_page vpd_vendor_pages[VPD_VP_ARRAY_SIZE ] = { [VPD_VP_UNDEF ] = {0x00 ,"undef" },
@@ -765,6 +767,7 @@ sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint)struct path *pp;int i;unsigned int dev_loss_tmo = mpp->dev_loss; +struct path *err_path =NULL ;if (mpp->no_path_retry >0 ) { uint64_t no_path_retry_tmo =
@@ -795,12 +798,34 @@ sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint)return 0 ; vector_foreach_slot(mpp->paths, pp, i) { -if (pp->sg_id.proto_id ==SCSI_PROTOCOL_FCP ) +if (pp->bus !=SYSFS_BUS_SCSI ) { +if (!err_path) + err_path = pp; +continue ; + } + +switch (pp->sg_id.proto_id) { +case SCSI_PROTOCOL_FCP :sysfs_set_rport_tmo (mpp, pp); -if (pp->sg_id.proto_id ==SCSI_PROTOCOL_ISCSI ) +continue ; +case SCSI_PROTOCOL_ISCSI :sysfs_set_session_tmo (mpp, pp); -if (pp->sg_id.proto_id ==SCSI_PROTOCOL_SAS ) +continue ; +case SCSI_PROTOCOL_SAS :sysfs_set_nexus_loss_tmo (mpp, pp); +continue ; +default : +if (!err_path) + err_path = pp; + } + } + +if (err_path) { +char proto_buf[32 ]; + +snprint_path_protocol (proto_buf,sizeof (proto_buf), err_path); +condlog (2 ,"%s: setting dev_loss_tmo is unsupported for protocol %s" , + mpp->alias, proto_buf); }return 0 ; }
Signature · 1 line
2.26.2
PATCH 39/39 libmultipath: increase log level of limiting dev_loss_tmo
In reply to [email protected]From: Martin Wilck <[email protected]>
Users who aren't familar with the complex dependencies between dev_loss_tmo, no_path_retry, and fast_io_fail may be confused if their settings aren't applied. Print this log message at the default level.
--- libmultipath/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/discovery.c +1 -1
@@ -651,7 +651,7 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp) } }else if (mpp->dev_loss >DEFAULT_DEV_LOSS_TMO && mpp->no_path_retry !=NO_PATH_RETRY_QUEUE ) { -condlog (3 ,"%s: limiting dev_loss_tmo to %d, since " +condlog (2 ,"%s: limiting dev_loss_tmo to %d, since " "fast_io_fail is not set" , rport_id,DEFAULT_DEV_LOSS_TMO ); mpp->dev_loss =DEFAULT_DEV_LOSS_TMO ;
Signature · 1 line
2.26.2
Quoted 8 lines · On Thu, Jul 09, 2020 at 12:19:48PM +0200, [email protected] wrote:
From: Martin Wilck <[email protected]>
Hi Christophe, hi Ben,
This is part II of a larger patch series for multpath-tools I've been preparing. It contains some minor fixes for
dev_loss_tmohandling, mostly logging. It's based on the previously submitted part I.
Quoted 9 lines
The full series will also be available here:
https://github.com/mwilck/multipath-tools/tree/ups/submit-2007There are tags in that repo for each part of the series. This part is tagged "submit-200709-2".
Regards,
Martin
for the part.
Quoted 15 lines
Martin Wilck (4):
libmultipath: add macroDEV_LOSS_TMO_UNSET
libmultipath: improve logging fordev_loss_tmooverride
libmultipath: print message if settingdev_loss_tmois unsupported
libmultipath: increase log level of limitingdev_loss_tmolibmultipath/defaults.h | 1 + libmultipath/dict.c | 4 +-- libmultipath/discovery.c | 56 ++++++++++++++++++++++++++++++---------- libmultipath/propsel.c | 2 +- 4 files changed, 46 insertions(+), 17 deletions(-)Signature · 1 line
2.26.2