public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: RHEL5 - qdisk: fix device scanning.
Date: Thu, 12 Feb 2009 19:24:00 -0000	[thread overview]
Message-ID: <20090212192426.C7E501201D2@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=d1ce031d18d7609c8b2ef7519992f21f8c3f1892
Commit:        d1ce031d18d7609c8b2ef7519992f21f8c3f1892
Parent:        bf90935cc54ded61220a81fb9cb949bfa12b001f
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Feb 11 09:41:08 2009 +0100
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Thu Feb 12 14:22:39 2009 -0500

qdisk: fix device scanning.

Bug 484956 part 1.

The basic sysfs scanning filter was completely wrong and it
was not scanning for full devices at all.

So entire devices like multipaths or sda where missing from the
original allocation.

This patch re-arrange the check so that we perform a full scan.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/qdisk/scandisk.c |   43 +++++++++++++++++++++----------------------
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index 428891c..803d149 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -648,38 +648,37 @@ static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
 			snprintf(newpath, sizeof(newpath),
 				 "%s/%s", path, namelist[n]->d_name);
 
-			if (!stat(newpath, &sb) && !level)
+			if (!stat(newpath, &sb) && !level) {
 				if (S_ISDIR(sb.st_mode))
 					if (scansysfs(devlisthead, newpath, 1) < 0)
 						return -1;
-
-			if (!lstat(newpath, &sb)) {
+			} else if (!lstat(newpath, &sb)) {
 				if (S_ISDIR(sb.st_mode))
 					if (scansysfs(devlisthead, newpath, 1) < 0)
 						return -1;
 
 				if (S_ISLNK(sb.st_mode))
 					continue;
+			}
 
-				if (sysfs_is_dev(newpath, &maj, &min) > 0) {
-					startnode =
-					    alloc_list_obj(devlisthead, maj,
-							   min);
-					if (!startnode)
-						return -2;
-
-					startnode->sysfsattrs.sysfs = 1;
-					startnode->sysfsattrs.removable =
-					    sysfs_is_removable(newpath);
-					startnode->sysfsattrs.holders =
-					    sysfs_has_subdirs_entries(newpath,
-								      "holders");
-					startnode->sysfsattrs.slaves =
-					    sysfs_has_subdirs_entries(newpath,
-								      "slaves");
-					startnode->sysfsattrs.disk =
-					    sysfs_is_disk(newpath);
-				}
+			if (sysfs_is_dev(newpath, &maj, &min) > 0) {
+				startnode =
+				    alloc_list_obj(devlisthead, maj,
+						   min);
+				if (!startnode)
+					return -2;
+
+				startnode->sysfsattrs.sysfs = 1;
+				startnode->sysfsattrs.removable =
+				    sysfs_is_removable(newpath);
+				startnode->sysfsattrs.holders =
+				    sysfs_has_subdirs_entries(newpath,
+							      "holders");
+				startnode->sysfsattrs.slaves =
+				    sysfs_has_subdirs_entries(newpath,
+							      "slaves");
+				startnode->sysfsattrs.disk =
+				    sysfs_is_disk(newpath);
 			}
 		}
 		free(namelist[n]);


                 reply	other threads:[~2009-02-12 19:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090212192426.C7E501201D2@lists.fedorahosted.org \
    --to=lon@fedoraproject.org \
    --cc=cluster-cvs-relay@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).