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: propagate parent_holder information to childs
Date: Thu, 12 Feb 2009 19:25:00 -0000	[thread overview]
Message-ID: <20090212192433.B22811201D2@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4b0686b390a0a9dbc1afe19dd7db3a6fe3e7303a
Commit:        4b0686b390a0a9dbc1afe19dd7db3a6fe3e7303a
Parent:        ba4a7fb8e69deff35d8f993bec9f273957eb3305
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Feb 11 10:54:05 2009 +0100
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Thu Feb 12 14:23:45 2009 -0500

qdisk: propagate parent_holder information to childs

Bug 484956 part 3.

If a device (e.g. sda) has holders (lvm or mpath), it's children
do not have holders information in sysfs.

Make sure to propagate the information from parent to children
when scanning in sysfs.

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

diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index 13251f1..9ff4bf6 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -631,10 +631,10 @@ static int sysfs_is_disk(char *path)
  * -1 on generic error
  * -2 -ENOMEM
  */
-static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
+static int scansysfs(struct devlisthead *devlisthead, char *path, int level, int parent_holder)
 {
 	struct devnode *startnode;
-	int i, n, maj, min;
+	int i, n, maj, min, has_holder = 0;
 	struct dirent **namelist;
 	struct stat sb;
 	char newpath[MAXPATHLEN];
@@ -662,9 +662,16 @@ static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
 				startnode->sysfsattrs.sysfs = 1;
 				startnode->sysfsattrs.removable =
 				    sysfs_is_removable(newpath);
-				startnode->sysfsattrs.holders =
-				    sysfs_has_subdirs_entries(newpath,
-							      "holders");
+
+				if (!parent_holder)
+					has_holder =
+					startnode->sysfsattrs.holders =
+					    sysfs_has_subdirs_entries(newpath,
+								      "holders");
+				else
+					has_holder =
+					startnode->sysfsattrs.holders = parent_holder;
+
 				startnode->sysfsattrs.slaves =
 				    sysfs_has_subdirs_entries(newpath,
 							      "slaves");
@@ -674,12 +681,12 @@ static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
 
 			if (!stat(newpath, &sb) && !level)
 				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath, 1) < 0)
+					if (scansysfs(devlisthead, newpath, 1, has_holder) < 0)
 						return -1;
 
 			if (!lstat(newpath, &sb))
 				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath, 1) < 0)
+					if (scansysfs(devlisthead, newpath, 1, has_holder) < 0)
 						return -1;
 
 		}
@@ -730,7 +737,7 @@ struct devlisthead *scan_for_dev(struct devlisthead *devlisthead,
 	/* it's important we check those 3 errors and abort in case
 	 * as it means that we are running out of mem,
 	 */
-	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0);
+	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0, 0);
 	if (res < -1)
 		goto emergencyout;
 


                 reply	other threads:[~2009-02-12 19:25 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=20090212192433.B22811201D2@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).