summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/syncop.c32
-rw-r--r--libglusterfs/src/syncop.h2
-rw-r--r--libglusterfs/src/xlator.c3
3 files changed, 35 insertions, 2 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index 7b6f78248ef..712e5b1f239 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -938,6 +938,38 @@ syncop_unlink (xlator_t *subvol, loc_t *loc)
}
int
+syncop_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, inode_t *inode,
+ struct iatt *buf, struct iatt *preparent,
+ struct iatt *postparent)
+{
+ struct syncargs *args = NULL;
+
+ args = cookie;
+
+ args->op_ret = op_ret;
+ args->op_errno = op_errno;
+
+ __wake (args);
+
+ return 0;
+}
+
+
+int
+syncop_link (xlator_t *subvol, loc_t *oldloc, loc_t *newloc)
+{
+ struct syncargs args = {0, };
+
+ SYNCOP (subvol, (&args), syncop_link_cbk, subvol->fops->link,
+ oldloc, newloc);
+
+ errno = args.op_errno;
+
+ return args.op_ret;
+}
+
+int
syncop_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int op_ret, int op_errno, struct iatt *prebuf,
struct iatt *postbuf)
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 627fb619703..7d8a2cb0230 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -217,5 +217,5 @@ int syncop_symlink (xlator_t *subvol, loc_t *loc, char *newpath, dict_t *dict);
int syncop_readlink (xlator_t *subvol, loc_t *loc, char **buffer, size_t size);
int syncop_mknod (xlator_t *subvol, loc_t *loc, mode_t mode, dev_t rdev,
dict_t *dict);
-
+int syncop_link (xlator_t *subvol, loc_t *oldloc, loc_t *newloc);
#endif /* _SYNCOP_H */
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index 428357633af..01475f5a1c3 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -567,7 +567,8 @@ loc_copy (loc_t *dst, loc_t *src)
if (src->parent)
dst->parent = inode_ref (src->parent);
- dst->path = gf_strdup (src->path);
+ if (src->path)
+ dst->path = gf_strdup (src->path);
if (!dst->path)
goto out;