All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Anderson <andmike@us.ibm.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: latest multipath-tools from git breaks EMC CX
Date: Thu, 2 Jun 2005 23:54:22 -0700	[thread overview]
Message-ID: <20050603065422.GA29496@us.ibm.com> (raw)
In-Reply-To: <1117748565.15294.106.camel@zezette>

christophe varoqui [christophe.varoqui@free.fr] wrote:
> Most certainly the 8af5a2b1b5e4d3a457f5bb477214356385087eae commit is
> the culprit : I did a bit of spliting in path discovery, and introduced
> a new fn to get the sysfs bus that I use as a switch to choose a
> discovery template.
> 
> Reading your output, I would say the bus fetching went wrong.
> 
> Well, revert it or debug it :/
> 

I was hitting the same problem on my system (the sysfs_get_bus function
leaving bus a none) the hack below fix it for me, but I only tested the
bus code against scsi YMMV.

-andmike
--
Michael Anderson
andmike@us.ibm.com


Hack fix for libmultipath sysfs_get_bus function.

Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---

--- multipath-tools-git/libmultipath/discovery.c	2005-06-03 06:11:15.752789640 -0700
+++ multipath-tools-fix/libmultipath/discovery.c	2005-06-03 06:21:15.913551336 -0700
@@ -337,6 +337,7 @@ get_serial (char * str, int fd)
 static void
 sysfs_get_bus (char * sysfs_path, struct path * curpath)
 {
+	struct sysfs_device *sdev;
 	char attr_path[FILE_NAME_SIZE];
 	char attr_buff[FILE_NAME_SIZE];
 
@@ -352,25 +353,19 @@ sysfs_get_bus (char * sysfs_path, struct
 		condlog(0, "attr_path too small");
 		return;
 	}
-	if (0 > sysfs_get_link(attr_path, attr_buff, sizeof(attr_buff)))
-		return;
-
-	if (strlen(attr_buff) + 4 > FILE_NAME_SIZE) {
-		condlog(0, "attr_path too small");
-		return;
-	}
-	snprintf(attr_path, FILE_NAME_SIZE, "%s/bus", attr_buff);
 
 	if (0 > sysfs_get_link(attr_path, attr_buff, sizeof(attr_buff)))
 		return;
 
-	basename(attr_buff, attr_path);
-	
-	if (!strncmp(attr_path, "scsi", 4))
+	sdev = sysfs_open_device_path(attr_buff);
+
+	if (!strncmp(sdev->bus, "scsi", 4))
 		curpath->bus = SYSFS_BUS_SCSI;
-	else if (!strncmp(attr_path, "ide", 3))
+	else if (!strncmp(sdev->bus, "ide", 3))
 		curpath->bus = SYSFS_BUS_IDE;
 
+	sysfs_close_device(sdev);
+
 	return;
 }
 

  reply	other threads:[~2005-06-03  6:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-02 20:46 latest multipath-tools from git breaks EMC CX Lars Marowsky-Bree
2005-06-02 21:42 ` christophe varoqui
2005-06-03  6:54   ` Mike Anderson [this message]
2005-06-03  9:43     ` Christophe Varoqui
2005-06-03 16:03       ` Lars Marowsky-Bree

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050603065422.GA29496@us.ibm.com \
    --to=andmike@us.ibm.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.