From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16468 invoked by alias); 15 Aug 2008 15:33:17 -0000 Received: (qmail 16461 invoked by alias); 15 Aug 2008 15:33:17 -0000 X-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on hosted1.fedoraproject.org X-Spam-Level: Subject: master - qdisk: allow scan of sysfs to dive into first level symlinks 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: 72299320730ffb6fa7a0af4694ff152dc501d656 X-Git-Newrev: f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42 From: "Fabio M. Di Nitto" Message-Id: <20080815153230.2A1ED12002B@lists.fedorahosted.org> Date: Mon, 18 Aug 2008 16:51:00 -0000 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: 2008-q3/txt/msg00273.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42 Commit: f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42 Parent: 72299320730ffb6fa7a0af4694ff152dc501d656 Author: Fabio M. Di Nitto AuthorDate: Fri Aug 15 17:23:59 2008 +0200 Committer: Fabio M. Di Nitto CommitterDate: Fri Aug 15 17:32:22 2008 +0200 qdisk: allow scan of sysfs to dive into first level symlinks Some kernels populate /sys/block with symlinks when others don't. Allow sysfs to dive into symlinks at the top level to handle both. Signed-off-by: Fabio M. Di Nitto --- cman/qdisk/scandisk.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c index 820f63e..0f4efa5 100644 --- a/cman/qdisk/scandisk.c +++ b/cman/qdisk/scandisk.c @@ -626,7 +626,7 @@ static int sysfs_is_disk(char *path) * -1 on generic error * -2 -ENOMEM */ -static int scansysfs(struct devlisthead *devlisthead, char *path) +static int scansysfs(struct devlisthead *devlisthead, char *path, int level) { struct devnode *startnode; int i, n, maj, min; @@ -642,12 +642,14 @@ static int scansysfs(struct devlisthead *devlisthead, char *path) if (namelist[n]->d_name[0] != '.') { snprintf(newpath, sizeof(newpath), "%s/%s", path, namelist[n]->d_name); - if (!lstat(newpath, &sb)) { + if (!stat(newpath, &sb) && !level) if (S_ISDIR(sb.st_mode)) - if (scansysfs(devlisthead, newpath) < 0) + if (scansysfs(devlisthead, newpath, 1) < 0) return -1; + if (!lstat(newpath, &sb)) { + if (S_ISLNK(sb.st_mode)) continue; @@ -719,7 +721,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); + devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0); if (res < -1) goto emergencyout;