diff options
Diffstat (limited to 'xlators/features/index/src/index.c')
-rw-r--r-- | xlators/features/index/src/index.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 2923e9c91..db592719b 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -16,6 +16,7 @@ #include "options.h" #include "glusterfs3-xdr.h" #include "syncop.h" +#include "syscall.h" #define XATTROP_SUBDIR "xattrop" #define BASE_INDICES_HOLDER_SUBDIR "base_indices_holder" @@ -264,7 +265,7 @@ check_delete_stale_index_file (xlator_t *this, char *filename) ret = stat (filepath_under_base_indices_holder, &base_index_st); if (ret) { gf_log (THIS->name, GF_LOG_ERROR, "Base index is not created" - "under index/base_indices_holder"); + " under index/base_indices_holder"); return; } @@ -407,7 +408,8 @@ sync_base_indices (void *index_priv) snprintf (base_index_path, PATH_MAX, "%s/%s", base_indices_holder, entry->d_name); - ret = link (xattrop_index_path, base_index_path); + ret = sys_link (xattrop_index_path, base_index_path); + if (ret && errno != EEXIST) goto out; @@ -543,7 +545,8 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir) index_get_index (priv, index); make_index_path (priv->index_basepath, subdir, index, index_path, sizeof (index_path)); - ret = link (index_path, gfid_path); + + ret = sys_link (index_path, gfid_path); if (!ret || (errno == EEXIST)) { ret = 0; index_created = 1; @@ -576,7 +579,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir) if (fd >= 0) close (fd); - ret = link (index_path, gfid_path); + ret = sys_link (index_path, gfid_path); if (ret && (errno != EEXIST)) { gf_log (this->name, GF_LOG_ERROR, "%s: Not able to " "add to index (%s)", uuid_utoa (gfid), @@ -590,7 +593,7 @@ index_add (xlator_t *this, uuid_t gfid, const char *subdir) make_index_path (priv->index_basepath, GF_BASE_INDICES_HOLDER_GFID, index, base_path, sizeof (base_path)); - ret = link (index_path, base_path); + ret = sys_link (index_path, base_path); if (ret) goto out; } |