diff options
author | Emmanuel Dreyfus <manu@netbsd.org> | 2012-05-21 18:38:11 +0200 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-05-22 12:15:14 -0700 |
commit | 7fcdcebd81fd38cbb59cf9a890e44ac01b08c3ee (patch) | |
tree | 02d166a7402b1635b7e970e29ca070feebf3e6b7 /xlators | |
parent | fa287178ac714071ceacf8697bd36cc8a8a8da00 (diff) |
Fix volume create
Improve Krishnan Parthasarathi's patch, which fixed situation where
a brick mount point did not had EA enabled. This fixes an incorrect
assumption that dirname(3) returns the same address it was given as
argument. GNU dirname(3) does it, BSD dirname(3) does not.
Also makes the code a bit easier to read.
Change-Id: I031fda5b9359a64eefb2279e640e73a416e58d90
BUG: 812214
Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org>
Reviewed-on: http://review.gluster.com/3380
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 987244e7518..2b5c1c6ca1e 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -4388,17 +4388,27 @@ glusterd_is_uuid_present (char *path, char *xattr, gf_boolean_t *present) goto out; ret = sys_lgetxattr (path, xattr, &uid, 16); - if (ret < 0 && errno != ENODATA) { - goto out; - } else if (ret >= 0) { + if (ret >= 0) { *present = _gf_true; - - } else { - *present = _gf_false; + ret = 0; + goto out; + } + + switch (errno) { +#if defined(ENODATA) + case ENODATA: /* FALLTHROUGH */ +#endif +#if defined(ENOATTR) && (ENOATTR != ENODATA) + case ENOATTR: /* FALLTHROUGH */ +#endif + case ENOTSUP: + *present = _gf_false; + ret = 0; + break; + default: + break; } - - ret = 0; out: return ret; } @@ -4433,7 +4443,7 @@ glusterd_is_path_in_use (char *path, gf_boolean_t *in_use, char **op_errstr) if (used) break; - curdir = dirname (dir); + curdir = dirname (curdir); if (!strcmp (curdir, ".")) goto out; |