master - qdisk: allow scan of sysfs to dive into first level symlinks
Fabio M. Di Nitto
fabbione@fedoraproject.org
Mon Aug 18 16:51:00 GMT 2008
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42
Commit: f9ca99a1234d2ef4fcbf0c8a2e2e381bf68e5c42
Parent: 72299320730ffb6fa7a0af4694ff152dc501d656
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate: Fri Aug 15 17:23:59 2008 +0200
Committer: Fabio M. Di Nitto <fdinitto@redhat.com>
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 <fdinitto@redhat.com>
---
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;
More information about the Cluster-cvs
mailing list