Bug#427532: fails to detect any paths on kernels > 2.6.20

2007-06-04 Thread Guido Guenther
Package: multipath-tools
Version: 0.4.7-3
Severity: serious
Tags: pending

This is just a notice, so people don't break their systems.  Subject
says it all, path detection is broken due to sysfs changes - I'm
currently testing a patch to fix this.
Cheers,
 -- Guido


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#427532: fails to detect any paths on kernels > 2.6.20

2007-06-04 Thread Christophe Varoqui
Le lundi 04 juin 2007 à 20:53 +0200, Guido Guenther a écrit :
> Package: multipath-tools
> Version: 0.4.7-3
> Severity: serious
> Tags: pending
> 
> This is just a notice, so people don't break their systems.  Subject
> says it all, path detection is broken due to sysfs changes - I'm
> currently testing a patch to fix this.
> Cheers,
>  -- Guido

I'm in the process of merging upstream a patch from Suse to remove
libsysfs dependency. It should resolve this issue, or at least it will
break your fix ;).

Regards




Bug#427532: fails to detect any paths on kernels > 2.6.20

2007-06-04 Thread Guido Guenther
On Mon, Jun 04, 2007 at 10:45:33PM +0200, Christophe Varoqui wrote:
> Le lundi 04 juin 2007 à 20:53 +0200, Guido Guenther a écrit :
> > Package: multipath-tools
> > Version: 0.4.7-3
> > Severity: serious
> > Tags: pending
> > 
> > This is just a notice, so people don't break their systems.  Subject
> > says it all, path detection is broken due to sysfs changes - I'm
> > currently testing a patch to fix this.
> > Cheers,
> >  -- Guido
> 
> I'm in the process of merging upstream a patch from Suse to remove
> libsysfs dependency. It should resolve this issue, or at least it will
> break your fix ;).
Actually no, I'm using the libsysfs removal patch from Suse, rediffed
against current git and fixed to not segfault ;)
Cheers,
 -- Guido



Bug#427532: fails to detect any paths on kernels > 2.6.20

2007-06-05 Thread Guido Guenther
Hi Christophe,
On Tue, Jun 05, 2007 at 08:45:33AM +0200, Guido Guenther wrote:
> On Mon, Jun 04, 2007 at 10:45:33PM +0200, Christophe Varoqui wrote:
> > Le lundi 04 juin 2007 à 20:53 +0200, Guido Guenther a écrit :
> > > Package: multipath-tools
> > > Version: 0.4.7-3
> > > Severity: serious
> > > Tags: pending
> > > 
> > > This is just a notice, so people don't break their systems.  Subject
> > > says it all, path detection is broken due to sysfs changes - I'm
> > > currently testing a patch to fix this.
> > > Cheers,
> > >  -- Guido
> > 
> > I'm in the process of merging upstream a patch from Suse to remove
> > libsysfs dependency. It should resolve this issue, or at least it will
> > break your fix ;).
> Actually no, I'm using the libsysfs removal patch from Suse, rediffed
> against current git and fixed to not segfault ;)
Current patch attached, it basically works, but there I there still seem
to be bugs in the new sysfs code. Hopefully I'll get around to look at
this soon.
Cheers,
 -- Guido
>From 72009e0cf8271ee849af3b34b2b82a639939ea71 Mon Sep 17 00:00:00 2001
From: Guido Guenther <[EMAIL PROTECTED]>
Date: Mon, 4 Jun 2007 21:15:15 +0200
Subject: [PATCH] Get rid of libsysfs

This is almost the patch from Hannes Reinecke <[EMAIL PROTECTED]>, sent to dm-devel,
with a minor fix (initialize attr to NULL) in sysfs.c and rediffed to apply
against current git.
---
 Makefile.inc   |1 -
 libmultipath/Makefile  |2 +-
 libmultipath/config.h  |1 +
 libmultipath/configure.c   |4 +-
 libmultipath/discovery.c   |  422 +---
 libmultipath/discovery.h   |7 +-
 libmultipath/list.h|  289 ++
 libmultipath/print.c   |   47 +++--
 libmultipath/structs.h |   15 ++-
 libmultipath/structs_vec.c |7 +-
 libmultipath/sysfs.c   |  409 ++
 libmultipath/sysfs.h   |   24 +++
 libmultipath/util.c|   52 ++
 libmultipath/util.h|4 +-
 multipath/Makefile |2 +-
 multipath/main.c   |   11 +-
 multipathd/Makefile|2 +-
 multipathd/cli_handlers.c  |   17 ++-
 multipathd/main.c  |   90 +-
 multipathd/main.h  |2 +-
 20 files changed, 1063 insertions(+), 345 deletions(-)
 create mode 100644 libmultipath/list.h
 create mode 100644 libmultipath/sysfs.c
 create mode 100644 libmultipath/sysfs.h

diff --git a/Makefile.inc b/Makefile.inc
index 4a705aa..9a1fa94 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -17,7 +17,6 @@ ifeq ($(strip $(BUILD)),klibc)
 	CC = klcc
 	klibcdir = /usr/lib/klibc
 	libdm= $(klibcdir)/lib/libdevmapper.a
-	libsysfs = $(klibcdir)/lib/libsysfs.a
 endif
 
 prefix  = 
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index 5d8c586..8027572 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -13,7 +13,7 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \
structs.o discovery.o propsel.o dict.o \
pgpolicies.o debug.o regex.o defaults.o uevent.o \
switchgroup.o uxsock.o print.o alias.o log_pthread.o \
-   log.o configure.o structs_vec.o
+   log.o configure.o structs_vec.o sysfs.o
 
 PREVBUILD = $(shell nm debug.o 2> /dev/null|grep log_safe)
 
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 61e5adf..b93deba 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -63,6 +63,7 @@ struct config {
 	int user_friendly_names;
 
 	char * dev;
+	char * sysfs_dir;
 	char * udev_dir;
 	char * selector;
 	char * getuid;
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index fba04a4..8c445ed 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -324,8 +324,10 @@ domap (struct multipath * mpp)
 		}
 		dm_shut_log();
 
-		if (dm_map_present(mpp->alias))
+		if (dm_map_present(mpp->alias)) {
+			condlog(3, "%s: map already present", mpp->alias);
 			break;
+		}
 
 		r = dm_addmap(DM_DEVICE_CREATE, mpp->alias, DEFAULT_TARGET,
 			  mpp->params, mpp->size, mpp->wwid);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a196583..52e0621 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -8,9 +8,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
-#include 
 
 #include 
 
@@ -24,6 +23,7 @@
 #include "debug.h"
 #include "propsel.h"
 #include "sg_include.h"
+#include "sysfs.h"
 #include "discovery.h"
 
 struct path *
@@ -87,127 +87,117 @@ path_discover (vector pathvec, struct config * conf, char * devname, int flag)
 int
 path_discovery (vector pathvec, struct config * conf, int flag)
 {
-	struct dlist * ls;
-	struct sysfs_class * class;
-	struct sysfs_class_device * dev;
-	int r = 1;
-
-	if (!(class = sysfs_open_class("block")))
+	DIR *blkdir;
+	struct dirent *blkdev;
+	struct stat statbuf;
+	char devpath[PATH_MAX];
+	char *devptr;
+	int r = 0;
+
+	if (!(blkdir = opendir("/sys/block")))
 		return 1;
 
-	if (!