Final round of SLES resync patches
cover Final round of SLES resync patches
Hi Christophe,
and this is now the final round of SLES resync patches. Mostly cleanup and minor fixes, except from the abstract socket patch for CLI commands.
I _thought_ I had send this early, but apparently not. Please apply.
Note that I've removed the rules file as it shouldn't be necessary anymore; we're using libudev directly.
Hannes Reinecke (10):
Cleanup whitespaces
Provide correct persistent symlinks for user_friendly_names
kpartx_id: Generate persistent symlinks for 'wwn'
kpartx: Fix DASD name in kpartx_id
Break out loop in factorize_hwtable()
multipathd: switch to abstract sockets for CLI commands
multipathd: log message when check interval has changed
multipathd: call 'reconfigure' during startup
multipath: do not install rules file
kpartx: Deinstall kpartx_id
Petr Uzel (1):
Fix inconsistent entries after merging hwtable with user's config
kpartx/Makefile | 1 + kpartx/kpartx.rules | 8 ++++++++ kpartx/kpartx_id | 11 +++++++++-- libmultipath/config.c | 25 +++++++++++++++++++------ libmultipath/defaults.h | 2 +- libmultipath/uxsock.c | 27 ++++++++++++++------------- multipath/Makefile | 3 --- multipath/multipath.rules | 7 ------- multipathd/main.c | 26 ++++++++++++++------------ multipathd/multipathd.init.suse | 2 +- multipathd/uxlsnr.c | 6 +++--- 11 files changed, 70 insertions(+), 48 deletions(-) delete mode 100644 multipath/multipath.rules
Signature · 1 line
1.7.10.4
PATCH 1/11 Cleanup whitespaces
--- multipathd/uxlsnr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
multipathd/uxlsnr.c +3 -3
@@ -1,6 +1,6 @@/* * Original author : [email protected], January 2002 -* +* * Copyright (c) 2005 Christophe Varoqui * Copyright (c) 2005 Benjamin Marzinski, Redhat */
@@ -54,7 +54,7 @@ static void new_client(int ux_sock)int fd; fd =accept (ux_sock, &addr, &len); - +if (fd ==-1 )return ;
@@ -133,7 +133,7 @@ void * uxsock_listen(int (*uxsock_trigger)(char *, char **, int *, void *),/* most of our life is spent in this call */ poll_count =poll (polls, i,SLEEP_TIME ); - +if (poll_count ==-1 ) {if (errno ==EINTR )continue ;
Signature · 1 line
1.7.10.4
PATCH 2/11 Provide correct persistent symlinks for user_friendly_names
In reply to Hannes ReineckeWhen the option 'user_friendly_names' is set we should provide both symlinks, the persistent one and that one generated for user_friendly_names.
--- kpartx/kpartx.rules | 4 ++++ kpartx/kpartx_id | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
kpartx/kpartx.rules +4 -0
@@ -18,10 +18,14 @@ OPTIONS="link_priority=50" # Create persistent links for multipath tables ENV{DM_UUID}=="mpath-*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}" +ENV{DM_MPATH}=="?*", ENV{DM_PART}!="?*", \ + SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}" # Create persistent links for partitions ENV{DM_PART}=="?*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}" +ENV{DM_MPATH}=="?*", ENV{DM_PART}=="?*", \ + SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}-part$env{DM_PART}" # Create dm tables for partitions ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
kpartx/kpartx_id +6 -1
@@ -55,6 +55,9 @@ if [ "$dmtbl" = "part" ] ; then # The name of the kpartx table is the name of the parent table dmname=$($DMSETUP info -c --noheadings -o name -u $dmuuid) echo "DM_NAME=$dmname" + if [ "$dmname" != ${dmuuid#mpath-} ] ; then + echo "DM_MPATH=${dmuuid#mpath-}" + fi # We need the dependencies of the parent table to figure out # the type if the parent is a multipath table case "$dmuuid" in
@@ -63,7 +66,9 @@ if [ "$dmtbl" = "part" ] ; then ;; esac elif [ "$dmtbl" = "mpath" ] ; then - dmname=$tblname + if [ -n "$DM_NAME" -a "$DM_NAME" != "$dmuuid" ] ; then + echo "DM_MPATH=$dmuuid" + fi # We need the dependencies of the table to figure out the type dmdeps=$($DMSETUP deps -u $UUID) elif [ "$dmtbl" = "dmraid" ] ; then
Signature · 1 line
1.7.10.4
PATCH 3/11 kpartx_id: Generate persistent symlinks for 'wwn'
In reply to Hannes ReineckeNewer udev versions generate /dev/disk/by-id/wwn-* symlinks. We should be adjusting those for multipathing, too.
--- kpartx/kpartx.rules | 4 ++++ kpartx/kpartx_id | 2 ++ 2 files changed, 6 insertions(+)
kpartx/kpartx.rules +4 -0
@@ -20,12 +20,16 @@ ENV{DM_UUID}=="mpath-*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}" ENV{DM_MPATH}=="?*", ENV{DM_PART}!="?*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}" +ENV{DM_WWN}=="?*", ENV{DM_PART}!="?*", \ + SYMLINK+="disk/by-id/wwn-$env{DM_WWN}" # Create persistent links for partitions ENV{DM_PART}=="?*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}" ENV{DM_MPATH}=="?*", ENV{DM_PART}=="?*", \ SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_MPATH}-part$env{DM_PART}" +ENV{DM_WWN}=="?*", ENV{DM_PART}=="?*", \ + SYMLINK+="disk/by-id/wwn-$env{DM_WWN}-part$env{DM_PART}" # Create dm tables for partitions ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
kpartx/kpartx_id +2 -0
@@ -69,6 +69,7 @@ elif [ "$dmtbl" = "mpath" ] ; then if [ -n "$DM_NAME" -a "$DM_NAME" != "$dmuuid" ] ; then echo "DM_MPATH=$dmuuid" fi + dmname="$dmuuid" # We need the dependencies of the table to figure out the type dmdeps=$($DMSETUP deps -u $UUID) elif [ "$dmtbl" = "dmraid" ] ; then
@@ -92,6 +93,7 @@ if [ -n "$dmdeps" ] ; then ;; *) echo "DM_TYPE=scsi" + echo "DM_WWN=0x${dmname#?}" ;; esac else
Signature · 1 line
1.7.10.4
PATCH 4/11 Fix inconsistent entries after merging hwtable with user's config
In reply to Hannes ReineckeFrom: Petr Uzel <[email protected]>
When merging the user provided configuration with the internal hwtable entry in merge_hwe(), it can happen that the resulting entry has a discrepancy between 'features' and 'no_path_retry'. Check for this special case and fix it.
--- libmultipath/config.c | 9 +++++++++ 1 file changed, 9 insertions(+)
libmultipath/config.c +9 -0
@@ -335,6 +335,15 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)merge_num (retain_hwhandler);merge_num (detect_prio); +/* +* Make sure features is consistent with +* no_path_retry +*/ +if (dst->no_path_retry ==NO_PATH_RETRY_FAIL ) +remove_feature (&dst->features,"queue_if_no_path" ); +else if (dst->no_path_retry !=NO_PATH_RETRY_UNDEF ) +add_feature (&dst->features,"queue_if_no_path" ); +return 0 ; }
Signature · 1 line
1.7.10.4
PATCH 5/11 kpartx: Fix DASD name in kpartx_id
In reply to Hannes ReineckeThe name of the DASD type is 'ccw', not 'dasd'.
--- kpartx/kpartx_id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kpartx/kpartx_id +1 -1
@@ -83,7 +83,7 @@ fi if [ -n "$dmdeps" ] ; then case "$dmdeps" in *\(94,*) - echo "DM_TYPE=dasd" + echo "DM_TYPE=ccw" ;; *\(104,* | *\(105,* | *\(106,* | *\(107,* | *\(108,* | *\(109,* | *\(110,* | *\(112,*) echo "DM_TYPE=cciss"
Signature · 1 line
1.7.10.4
PATCH 6/11 Break out loop in factorize_hwtable()
In reply to Hannes ReineckeWe need to break out of the loop in factorize_hwtable() as soon as we have removed a duplicate. Otherwise we might run onto an deleted element in the outer loop.
Also we should declare factorize_hwtable() as 'void' as it doesn't return anything.
--- libmultipath/config.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
libmultipath/config.c +10 -6
@@ -418,12 +418,13 @@ out:return 1 ; } -static int +static void factorize_hwtable (vector hw,int n) {struct hwentry *hwe1, *hwe2;int i, j; +restart: vector_foreach_slot(hw, hwe1, i) {if (i == n)break ;
@@ -435,14 +436,17 @@ factorize_hwtable (vector hw, int n)merge_hwe (hwe2, hwe1);if (hwe_strmatch (hwe2, hwe1) ==0 ) {vector_del_slot (hw, i); -free_hwe (hwe1); - n -=1 ; - i -=1 ; -break ; +/* +* Play safe here; we have modified +* the original vector so the outer +* vector_foreach_slot() might +* become confused. +*/ + goto restart; } } } -return 0 ; +return ; } struct config *
Signature · 1 line
1.7.10.4
PATCH 7/11 multipathd: switch to abstract sockets for CLI commands
In reply to Hannes ReineckeInstead of using file-based sockets we should be switching to abstract sockets. Otherwise multipathd won't be able to start if the directory is not available.
--- libmultipath/defaults.h | 2 +- libmultipath/uxsock.c | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-)
libmultipath/defaults.h +1 -1
@@ -24,7 +24,7 @@#define MAX_DEV_LOSS_TMO 0x7FFFFFFF#define DEFAULT_PIDFILE "/var/run/multipathd.pid" -#define DEFAULT_SOCKET "/var/run/multipathd.sock" +#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"#define DEFAULT_CONFIGFILE "/etc/multipath.conf"#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids"
libmultipath/uxsock.c +14 -13
@@ -25,19 +25,21 @@*/ int ux_socket_connect (const char *name) { -int fd; +int fd, len;struct sockaddr_un addr;memset (&addr,0 ,sizeof (addr)); - addr.sun_family =AF_UNIX ; -strncpy (addr.sun_path, name,sizeof (addr.sun_path)); + addr.sun_family =AF_LOCAL ; + addr.sun_path[0 ] ='\0' ; + len =strlen (name) +1 ; +strncpy (&addr.sun_path[1 ], name, len); - fd =socket (AF_UNIX ,SOCK_STREAM ,0 ); + fd =socket (AF_LOCAL ,SOCK_STREAM ,0 );if (fd ==-1 ) {return -1 ; } -if (connect (fd, (struct sockaddr *)&addr,sizeof (addr)) ==-1 ) { +if (connect (fd, (struct sockaddr *)&addr, len) ==-1 ) {close (fd);return -1 ; }
@@ -51,20 +53,19 @@ int ux_socket_connect(const char *name)*/ int ux_socket_listen (const char *name) { -int fd; +int fd, len;struct sockaddr_un addr; -/* get rid of any old socket */ -unlink (name); - - fd =socket (AF_UNIX ,SOCK_STREAM ,0 ); + fd =socket (AF_LOCAL ,SOCK_STREAM ,0 );if (fd ==-1 )return -1 ;memset (&addr,0 ,sizeof (addr)); - addr.sun_family =AF_UNIX ; -strncpy (addr.sun_path, name,sizeof (addr.sun_path)); + addr.sun_family =AF_LOCAL ; + addr.sun_path[0 ] ='\0' ; + len =strlen (name) +1 ; +strncpy (&addr.sun_path[1 ], name, len); -if (bind (fd, (struct sockaddr *)&addr,sizeof (addr)) ==-1 ) { +if (bind (fd, (struct sockaddr *)&addr, len) ==-1 ) {close (fd);return -1 ; }
Signature · 1 line
1.7.10.4
PATCH 8/11 multipathd: log message when check interval has changed
In reply to Hannes ReineckeWe should only log the message if the check interval has indeed changed.
--- multipathd/main.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
multipathd/main.c +14 -12
@@ -1209,18 +1209,20 @@ check_path (struct vectors * vecs, struct path * pp)reinstate_path (pp,0 ); }else {LOG_MSG (4 ,checker_message (&pp->checker)); -/* -* double the next check delay. -* max at conf->max_checkint -*/ -if (pp->checkint < (conf->max_checkint /2 )) - pp->checkint =2 * pp->checkint; -else - pp->checkint = conf->max_checkint; - - pp->tick = pp->checkint; -condlog (4 ,"%s: delay next check %is" , - pp->dev_t, pp->tick); +if (pp->checkint != conf->max_checkint) { +/* +* double the next check delay. +* max at conf->max_checkint +*/ +if (pp->checkint < (conf->max_checkint /2 )) + pp->checkint =2 * pp->checkint; +else + pp->checkint = conf->max_checkint; + + pp->tick = pp->checkint; +condlog (4 ,"%s: delay next check %is" , + pp->dev_t, pp->tick); + } } }else if (newstate ==PATH_DOWN ) {
Signature · 1 line
1.7.10.4
PATCH 9/11 multipathd: call 'reconfigure' during startup
In reply to Hannes ReineckeThe init script should be calling 'reconfigure' cli command during startup. That not only checks if the daemon is running, but will also cause a complete reconfiguration, so all devices which might have been missed during init will be catched.
--- multipathd/multipathd.init.suse | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
multipathd/multipathd.init.suse +1 -1
@@ -38,7 +38,7 @@ case "$1" in start) echo -n "Starting multipathd" ulimit -c unlimited - if $DAEMON -k"show daemon" > /dev/null 2>&1 ; then + if $DAEMON -k"reconfigure" > /dev/null 2>&1 ; then echo -n " (multipathd running)" rc_status -v rc_exit
Signature · 1 line
1.7.10.4
PATCH 10/11 multipath: do not install rules file
In reply to Hannes Reineckemultipathd now uses libudev, so the rules file is not required.
--- multipath/Makefile | 3 --- multipath/multipath.rules | 7 ------- 2 files changed, 10 deletions(-) delete mode 100644 multipath/multipath.rules
multipath/Makefile +0 -3
@@ -21,15 +21,12 @@ $(EXEC): $(OBJS) install: $(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - $(INSTALL_PROGRAM) -d $(DESTDIR)/etc/udev/rules.d - $(INSTALL_PROGRAM) -m 644 multipath.rules $(DESTDIR)/etc/udev/rules.d/ $(INSTALL_PROGRAM) -d $(DESTDIR)$(mandir) $(INSTALL_PROGRAM) -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) $(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir) $(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir) uninstall: - rm $(DESTDIR)/etc/udev/rules.d/multipath.rules rm $(DESTDIR)$(bindir)/$(EXEC) rm $(DESTDIR)$(mandir)/$(EXEC).8.gz rm $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
multipath/multipath.rules deleted +0 -7
@@ -1,7 +0,0 @@ -# -# udev rules for multipathing. -# The persistent symlinks are created with the kpartx rules -# - -# socket for uevents -SUBSYSTEM=="block", RUN+="socket:/org/kernel/dm/multipath_event"
Signature · 1 line
1.7.10.4
PATCH 11/11 kpartx: Deinstall kpartx_id
In reply to Hannes ReineckeWe've installed it, so we should be uninstalling it, too.
--- kpartx/Makefile | 1 + 1 file changed, 1 insertion(+)
kpartx/Makefile +1 -0
@@ -36,6 +36,7 @@ install: $(EXEC) $(EXEC).8 uninstall: rm -f $(DESTDIR)$(bindir)/$(EXEC) rm -f $(DESTDIR)$(mandir)/$(EXEC).8.gz + rm -f $(DESTDIR)$(libudevdir)/kpartx_id clean: rm -f core *.o $(EXEC) *.gz
Signature · 1 line
1.7.10.4
Quoted 1 line · Hannes Reinecke
and this is now the final round of SLES resync patches.
Hannes, I do miss support for HSV3[46]0 devices.
Quoted 6 lines · Xose Vazquez Perez
Quoted 1 line · Hannes Reinecke
and this is now the final round of SLES resync patches.
Hannes, I do miss support for HSV3[46]0 devices.
Oh. Correct.
Christophe, could you apply the patch?
Thanks.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
From 9631beb23e3f873ceac4a80746cd3013891d33b6 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <[email protected]>
Date: Thu, 28 Jun 2012 18:19:48 +0200
Subject: [PATCH] Add definitions for HP P6300
libmultipath/hwtable.c +1 -1
@@ -133,7 +133,7 @@ static struct hwentry default_hw[] = { {/* EVA 3000/5000 with new firmware, EVA 4000/6000/8000 */ .vendor = "(COMPAQ|HP)", - .product = "HSV1[01]1|HSV2[01]0|HSV300|HSV4[05]0", + .product = "HSV1[01]1|HSV2[01]0|HSV3[046]0|HSV4[05]0", .features = DEFAULT_FEATURES, .hwhandler = DEFAULT_HWHANDLER, .pgpolicy = GROUP_BY_PRIO,
Quoted 11 lines · Hannes Reinecke
Quoted 6 lines · Xose Vazquez Perez
Quoted 1 line · Hannes Reinecke
and this is now the final round of SLES resync patches.
Hannes, I do miss support for HSV3[46]0 devices.
Oh. Correct.
Christophe, could you apply the patch?
Done.
Christophe Varoqui
www.opensvc.com
Christophe Varoqui
AppliedQuoted 11 lines · Hannes Reinecke
Hi Christophe,
and this is now the final round of SLES resync patches. Mostly cleanup and minor fixes, except from the abstract socket patch for CLI commands.
I _thought_ I had send this early, but apparently not. Please apply.Note that I've removed the rules file as it shouldn't be necessary anymore; we're using libudev directly.
Applied.
Best regards,
Christophe Varoqui
www.opensvc.com
Quoted 29 lines
Hannes Reinecke (10):
Cleanup whitespaces
Provide correct persistent symlinks foruser_friendly_names
kpartx_id: Generate persistent symlinks for 'wwn'
kpartx: Fix DASD name inkpartx_id
Break out loop infactorize_hwtable()
multipathd: switch to abstract sockets for CLI commands
multipathd: log message when check interval has changed
multipathd: call 'reconfigure' during startup
multipath: do not install rules file
kpartx: Deinstallkpartx_idPetr Uzel (1):
Fix inconsistent entries after merging hwtable with user's configkpartx/Makefile | 1 + kpartx/kpartx.rules | 8 ++++++++ kpartx/kpartx_id | 11 +++++++++-- libmultipath/config.c | 25 +++++++++++++++++++------ libmultipath/defaults.h | 2 +- libmultipath/uxsock.c | 27 ++++++++++++++------------- multipath/Makefile | 3 --- multipath/multipath.rules | 7 ------- multipathd/main.c | 26 ++++++++++++++------------ multipathd/multipathd.init.suse | 2 +- multipathd/uxlsnr.c | 6 +++--- 11 files changed, 70 insertions(+), 48 deletions(-) delete mode 100644 multipath/multipath.rules