summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-07-19 21:08:14 +0530
committerAnand Avati <avati@gluster.com>2011-07-19 08:51:26 -0700
commit46afd33ebe184604443a695ebf8eaea8c2098443 (patch)
tree3c392c90b31516ccc09e197f4f6d855c3c0e4a71
parente74bf1ae7d974ae3681818a0a6240adee5983323 (diff)
glusterd rebalance: use lstat() instead of stat()
so the symlinks pointing to directories are not considered as directories themself and the control flows outside gluster's scope Change-Id: Iae910ce6c68886d34ae6e5efe46062481b40cd25 BUG: 3191 Reviewed-on: http://review.gluster.com/30 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index a91c46f191a..168f504446c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -81,7 +81,7 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir)
snprintf (full_path, PATH_MAX, "%s/%s", dir, entry->d_name);
- ret = stat (full_path, &stbuf);
+ ret = lstat (full_path, &stbuf);
if (ret == -1)
continue;
@@ -125,7 +125,7 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir)
snprintf (full_path, 1024, "%s/%s", dir, entry->d_name);
- ret = stat (full_path, &stbuf);
+ ret = lstat (full_path, &stbuf);
if (ret == -1)
continue;
@@ -169,7 +169,7 @@ gf_glusterd_rebalance_fix_layout (glusterd_volinfo_t *volinfo, const char *dir)
snprintf (full_path, 1024, "%s/%s", dir, entry->d_name);
- ret = stat (full_path, &stbuf);
+ ret = lstat (full_path, &stbuf);
if (ret == -1)
continue;
@@ -215,11 +215,11 @@ glusterd_defrag_start (void *data)
goto out;
sleep (1);
- ret = stat (defrag->mount, &stbuf);
+ ret = lstat (defrag->mount, &stbuf);
if ((ret == -1) && (errno == ENOTCONN)) {
/* Wait for some more time before starting rebalance */
sleep (2);
- ret = stat (defrag->mount, &stbuf);
+ ret = lstat (defrag->mount, &stbuf);
if (ret == -1) {
volinfo->defrag_status = GF_DEFRAG_STATUS_FAILED;
volinfo->rebalance_files = 0;