From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16244 invoked by alias); 11 Feb 2009 10:06:29 -0000 Received: (qmail 16238 invoked by alias); 11 Feb 2009 10:06:29 -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: fix device scanning. 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: 723c5e45265a16ef45f50516d367fdf4b79b7605 X-Git-Newrev: 8a4a6df74092e2294786b3d4215a4ee2a23416fd From: "Fabio M. Di Nitto" Message-Id: <20090211100608.18AF0120198@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/msg00413.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8a4a6df74092e2294786b3d4215a4ee2a23416fd Commit: 8a4a6df74092e2294786b3d4215a4ee2a23416fd Parent: 723c5e45265a16ef45f50516d367fdf4b79b7605 Author: Fabio M. Di Nitto AuthorDate: Wed Feb 11 09:41:08 2009 +0100 Committer: Fabio M. Di Nitto CommitterDate: Wed Feb 11 11:05:37 2009 +0100 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 --- 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 4456e53..e393008 100644 --- a/cman/qdisk/scandisk.c +++ b/cman/qdisk/scandisk.c @@ -643,38 +643,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]);