From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17298 invoked by alias); 11 Feb 2009 10:08:46 -0000 Received: (qmail 17292 invoked by alias); 11 Feb 2009 10:08:46 -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: STABLE2 - qdisk: fix device scanning order. To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE2 X-Git-Reftype: branch X-Git-Oldrev: 84c48acd057dcc61ae2320ccda5845571ababa4c X-Git-Newrev: cec63d245b5a79136a4dcab8dbddb3d5e275b220 From: "Fabio M. Di Nitto" Message-Id: <20090211100822.53A31120199@lists.fedorahosted.org> Date: Wed, 11 Feb 2009 10:08: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/msg00418.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=cec63d245b5a79136a4dcab8dbddb3d5e275b220 Commit: cec63d245b5a79136a4dcab8dbddb3d5e275b220 Parent: 84c48acd057dcc61ae2320ccda5845571ababa4c Author: Fabio M. Di Nitto AuthorDate: Wed Feb 11 10:40:34 2009 +0100 Committer: Fabio M. Di Nitto CommitterDate: Wed Feb 11 11:07:57 2009 +0100 qdisk: fix device scanning order. Bug 484956 part 2. This patch re-arrange the check so that full devices are always scanned before the underneath partitions. Signed-off-by: Fabio M. Di Nitto --- cman/qdisk/scandisk.c | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c index e393008..4a0935f 100644 --- a/cman/qdisk/scandisk.c +++ b/cman/qdisk/scandisk.c @@ -643,18 +643,9 @@ 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 (S_ISDIR(sb.st_mode)) - if (scansysfs(devlisthead, newpath, 1) < 0) - return -1; - } else if (!lstat(newpath, &sb)) { - if (S_ISDIR(sb.st_mode)) - if (scansysfs(devlisthead, newpath, 1) < 0) - return -1; - + if (!lstat(newpath, &sb) && level) if (S_ISLNK(sb.st_mode)) continue; - } if (sysfs_is_dev(newpath, &maj, &min) > 0) { startnode = @@ -674,7 +665,20 @@ static int scansysfs(struct devlisthead *devlisthead, char *path, int level) "slaves"); startnode->sysfsattrs.disk = sysfs_is_disk(newpath); + + printf("Allocated: %s holders: %d\n", newpath, startnode->sysfsattrs.holders); } + + if (!stat(newpath, &sb) && !level) + if (S_ISDIR(sb.st_mode)) + if (scansysfs(devlisthead, newpath, 1) < 0) + return -1; + + if (!lstat(newpath, &sb)) + if (S_ISDIR(sb.st_mode)) + if (scansysfs(devlisthead, newpath, 1) < 0) + return -1; + } free(namelist[n]); }