File multipath-tools-adapt-to-new-sysfs-layout of Package multipath-tools

From b33a53646ba745dca3ef93ca29c45cbef2dfa171 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 18 Nov 2008 08:29:17 +0100
Subject: [PATCH] Adapt to new sysfs layout in uev_discard()

Later kernel moved the block sysfs entry below the device path,
so we have to check for the 'block' directory somewhere in the
devpath, not at the beginning.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 multipathd/main.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index a4b0311..6908902 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -603,14 +603,19 @@ uxsock_trigger (char * str, char ** reply, int * len, void * trigger_data)
 static int
 uev_discard(char * devpath)
 {
-	char a[10], b[10];
+	char a[10], b[10], *c;
 
 	/*
 	 * keep only block devices, discard partitions
 	 */
-	if (sscanf(devpath, "/block/%10s", a) != 1 ||
-	    sscanf(devpath, "/block/%10[^/]/%10s", a, b) == 2) {
-		condlog(4, "discard event on %s", devpath);
+	c = strstr(devpath,"/block");
+	if (!c) {
+		condlog(3, "discard non-block event on %s", devpath);
+		return 1;
+	}
+	if (sscanf(c, "/block/%10s", a) != 1 ||
+	    sscanf(c, "/block/%10[^/]/%10s", a, b) == 2) {
+		condlog(3, "discard event on %s", c);
 		return 1;
 	}
 	return 0;
-- 
1.5.3.2

openSUSE Build Service is sponsored by