summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-07-12 05:29:59 +0000
committerAnand Avati <avati@gluster.com>2011-07-12 07:12:50 -0700
commit9a12df6c6e47553005861de4ae97f571f270af83 (patch)
treea24a504a92dca98afde0275e13e3ee219a1e510a
parent7d1053f30d4c1a8ebf97d93008033704f12fcea6 (diff)
cluster/distribute: send proper 'params' dictionary during linkfile creation
when the code path enters the 'subvol_filled()' case, local->params is set, which contains the 'gfid-req' value, but the linkfile creation was not checking for its existance. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 3159 (mknod (linkfile creation) with no 'gfid-req' key) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3159
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index 76f1df50184..e936f3119a6 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -52,15 +52,20 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
{
dht_local_t *local = NULL;
dict_t *dict = NULL;
+ int need_unref = 0;
int ret = 0;
local = frame->local;
local->linkfile.linkfile_cbk = linkfile_cbk;
local->linkfile.srcvol = tovol;
- dict = dict_new ();
- if (!dict)
- goto out;
+ dict = local->params;
+ if (!dict) {
+ dict = dict_new ();
+ if (!dict)
+ goto out;
+ need_unref = 1;
+ }
if (!uuid_is_null (local->gfid)) {
ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
@@ -83,13 +88,17 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
fromvol, fromvol->fops->mknod, loc,
S_IFREG | DHT_LINKFILE_MODE, 0, dict);
- if (dict)
+ if (need_unref && dict)
dict_unref (dict);
return 0;
out:
local->linkfile.linkfile_cbk (frame, NULL, frame->this, -1, ENOMEM,
loc->inode, NULL, NULL, NULL);
+
+ if (need_unref && dict)
+ dict_unref (dict);
+
return 0;
}