From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16547 invoked by alias); 11 Feb 2009 10:06:42 -0000 Received: (qmail 16541 invoked by alias); 11 Feb 2009 10:06:42 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion.fedora.phx.redhat.com Subject: cluster: master - qdisk: propagate parent_holder information to childs To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: c6f9e3d333f7b61bc50789d67e74fd10c055449f X-Git-Newrev: fa8609d8630744939426200a1840cfb6573cf587 From: "Fabio M. Di Nitto" Message-Id: <20090211100614.7A3A6120198@lists.fedorahosted.org> Date: Wed, 11 Feb 2009 10:06:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q1/txt/msg00416.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=fa8609d8630744939426200a1840cfb6573cf587 Commit: fa8609d8630744939426200a1840cfb6573cf587 Parent: c6f9e3d333f7b61bc50789d67e74fd10c055449f Author: Fabio M. Di Nitto AuthorDate: Wed Feb 11 10:54:05 2009 +0100 Committer: Fabio M. Di Nitto CommitterDate: Wed Feb 11 11:05:55 2009 +0100 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 --- 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 e0a486b..52fe7a3 100644 --- a/cman/qdisk/scandisk.c +++ b/cman/qdisk/scandisk.c @@ -626,10 +626,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]; @@ -657,9 +657,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"); @@ -669,12 +676,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; } @@ -725,7 +732,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;