From 9a12df6c6e47553005861de4ae97f571f270af83 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 12 Jul 2011 05:29:59 +0000 Subject: 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 Signed-off-by: Anand Avati BUG: 3159 (mknod (linkfile creation) with no 'gfid-req' key) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3159 --- xlators/cluster/dht/src/dht-linkfile.c | 17 +++++++++++++---- 1 file 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; } -- cgit