9ae3f9
From 3ed98fc9dcb39223032e343fd5b0ad17fa3cae14 Mon Sep 17 00:00:00 2001
9ae3f9
From: Pranith Kumar K <pkarampu@redhat.com>
9ae3f9
Date: Fri, 29 May 2020 14:24:53 +0530
9ae3f9
Subject: [PATCH 439/449] cluster/afr: Delay post-op for fsync
9ae3f9
9ae3f9
Problem:
9ae3f9
AFR doesn't delay post-op for fsync fop. For fsync heavy workloads
9ae3f9
this leads to un-necessary fxattrop/finodelk for every fsync leading
9ae3f9
to bad performance.
9ae3f9
9ae3f9
Fix:
9ae3f9
Have delayed post-op for fsync. Add special flag in xdata to indicate
9ae3f9
that afr shouldn't delay post-op in cases where either the
9ae3f9
process will terminate or graph-switch would happen. Otherwise it leads
9ae3f9
to un-necessary heals when the graph-switch/process-termination
9ae3f9
happens before delayed-post-op completes.
9ae3f9
9ae3f9
> Upstream-patch: https://review.gluster.org/c/glusterfs/+/24473
9ae3f9
> Fixes: #1253
9ae3f9
9ae3f9
BUG: 1838479
9ae3f9
Change-Id: I531940d13269a111c49e0510d49514dc169f4577
9ae3f9
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
9ae3f9
Reviewed-on: https://code.engineering.redhat.com/gerrit/202676
9ae3f9
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9ae3f9
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9ae3f9
---
9ae3f9
 api/src/glfs-resolve.c                         |  14 ++-
9ae3f9
 tests/basic/afr/durability-off.t               |   2 +
9ae3f9
 tests/basic/gfapi/gfapi-graph-switch-open-fd.t |  44 +++++++++
9ae3f9
 tests/basic/gfapi/gfapi-keep-writing.c         | 129 +++++++++++++++++++++++++
9ae3f9
 xlators/cluster/afr/src/afr-inode-write.c      |  11 ++-
9ae3f9
 xlators/cluster/afr/src/afr-transaction.c      |   9 +-
9ae3f9
 xlators/cluster/afr/src/afr.h                  |   2 +-
9ae3f9
 xlators/cluster/dht/src/dht-rebalance.c        |  15 ++-
9ae3f9
 xlators/mount/fuse/src/fuse-bridge.c           |  23 ++++-
9ae3f9
 9 files changed, 239 insertions(+), 10 deletions(-)
9ae3f9
 create mode 100644 tests/basic/gfapi/gfapi-graph-switch-open-fd.t
9ae3f9
 create mode 100644 tests/basic/gfapi/gfapi-keep-writing.c
9ae3f9
9ae3f9
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
9ae3f9
index a79f490..062b7dc 100644
9ae3f9
--- a/api/src/glfs-resolve.c
9ae3f9
+++ b/api/src/glfs-resolve.c
9ae3f9
@@ -722,6 +722,7 @@ glfs_migrate_fd_safe(struct glfs *fs, xlator_t *newsubvol, fd_t *oldfd)
9ae3f9
         0,
9ae3f9
     };
9ae3f9
     char uuid1[64];
9ae3f9
+    dict_t *xdata = NULL;
9ae3f9
 
9ae3f9
     oldinode = oldfd->inode;
9ae3f9
     oldsubvol = oldinode->table->xl;
9ae3f9
@@ -730,7 +731,15 @@ glfs_migrate_fd_safe(struct glfs *fs, xlator_t *newsubvol, fd_t *oldfd)
9ae3f9
         return fd_ref(oldfd);
9ae3f9
 
9ae3f9
     if (!oldsubvol->switched) {
9ae3f9
-        ret = syncop_fsync(oldsubvol, oldfd, 0, NULL, NULL, NULL, NULL);
9ae3f9
+        xdata = dict_new();
9ae3f9
+        if (!xdata || dict_set_int8(xdata, "last-fsync", 1)) {
9ae3f9
+            gf_msg(fs->volname, GF_LOG_WARNING, ENOMEM, API_MSG_FSYNC_FAILED,
9ae3f9
+                   "last-fsync set failed on %s graph %s (%d)",
9ae3f9
+                   uuid_utoa_r(oldfd->inode->gfid, uuid1),
9ae3f9
+                   graphid_str(oldsubvol), oldsubvol->graph->id);
9ae3f9
+        }
9ae3f9
+
9ae3f9
+        ret = syncop_fsync(oldsubvol, oldfd, 0, NULL, NULL, xdata, NULL);
9ae3f9
         DECODE_SYNCOP_ERR(ret);
9ae3f9
         if (ret) {
9ae3f9
             gf_msg(fs->volname, GF_LOG_WARNING, errno, API_MSG_FSYNC_FAILED,
9ae3f9
@@ -809,6 +818,9 @@ out:
9ae3f9
         newfd = NULL;
9ae3f9
     }
9ae3f9
 
9ae3f9
+    if (xdata)
9ae3f9
+        dict_unref(xdata);
9ae3f9
+
9ae3f9
     return newfd;
9ae3f9
 }
9ae3f9
 
9ae3f9
diff --git a/tests/basic/afr/durability-off.t b/tests/basic/afr/durability-off.t
9ae3f9
index 155ffa0..6e0f18b 100644
9ae3f9
--- a/tests/basic/afr/durability-off.t
9ae3f9
+++ b/tests/basic/afr/durability-off.t
9ae3f9
@@ -26,6 +26,8 @@ TEST $CLI volume heal $V0
9ae3f9
 EXPECT_WITHIN $HEAL_TIMEOUT "0" get_pending_heal_count $V0
9ae3f9
 EXPECT "^0$" echo $($CLI volume profile $V0 info | grep -w FSYNC | wc -l)
9ae3f9
 
9ae3f9
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
9ae3f9
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
9ae3f9
 #Test that fsyncs happen when durability is on
9ae3f9
 TEST $CLI volume set $V0 cluster.ensure-durability on
9ae3f9
 TEST $CLI volume set $V0 performance.strict-write-ordering on
9ae3f9
diff --git a/tests/basic/gfapi/gfapi-graph-switch-open-fd.t b/tests/basic/gfapi/gfapi-graph-switch-open-fd.t
9ae3f9
new file mode 100644
9ae3f9
index 0000000..2e666be
9ae3f9
--- /dev/null
9ae3f9
+++ b/tests/basic/gfapi/gfapi-graph-switch-open-fd.t
9ae3f9
@@ -0,0 +1,44 @@
9ae3f9
+#!/bin/bash
9ae3f9
+
9ae3f9
+. $(dirname $0)/../../include.rc
9ae3f9
+. $(dirname $0)/../../volume.rc
9ae3f9
+
9ae3f9
+cleanup;
9ae3f9
+
9ae3f9
+TEST glusterd
9ae3f9
+
9ae3f9
+TEST $CLI volume create $V0 replica 3 ${H0}:$B0/brick{0..2};
9ae3f9
+EXPECT 'Created' volinfo_field $V0 'Status';
9ae3f9
+
9ae3f9
+TEST $CLI volume start $V0;
9ae3f9
+EXPECT 'Started' volinfo_field $V0 'Status';
9ae3f9
+
9ae3f9
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
9ae3f9
+TEST touch $M0/sync
9ae3f9
+logdir=`gluster --print-logdir`
9ae3f9
+
9ae3f9
+TEST build_tester $(dirname $0)/gfapi-keep-writing.c -lgfapi
9ae3f9
+
9ae3f9
+
9ae3f9
+#Launch a program to keep doing writes on an fd
9ae3f9
+./$(dirname $0)/gfapi-keep-writing ${H0} $V0 $logdir/gfapi-async-calls-test.log sync &
9ae3f9
+p=$!
9ae3f9
+sleep 1 #Let some writes go through
9ae3f9
+#Check if graph switch will lead to any pending markers for ever
9ae3f9
+TEST $CLI volume set $V0 performance.quick-read off
9ae3f9
+TEST $CLI volume set $V0 performance.io-cache off
9ae3f9
+TEST $CLI volume set $V0 performance.stat-prefetch off
9ae3f9
+TEST $CLI volume set $V0 performance.read-ahead off
9ae3f9
+
9ae3f9
+
9ae3f9
+TEST rm -f $M0/sync #Make sure the glfd is closed
9ae3f9
+TEST wait #Wait for background process to die
9ae3f9
+#Goal is to check if there is permanent FOOL changelog
9ae3f9
+sleep 5
9ae3f9
+EXPECT "0x000000000000000000000000" afr_get_changelog_xattr $B0/brick0/glfs_test.txt trusted.afr.dirty
9ae3f9
+EXPECT "0x000000000000000000000000" afr_get_changelog_xattr $B0/brick1/glfs_test.txt trusted.afr.dirty
9ae3f9
+EXPECT "0x000000000000000000000000" afr_get_changelog_xattr $B0/brick2/glfs_test.txt trusted.afr.dirty
9ae3f9
+
9ae3f9
+cleanup_tester $(dirname $0)/gfapi-async-calls-test
9ae3f9
+
9ae3f9
+cleanup;
9ae3f9
diff --git a/tests/basic/gfapi/gfapi-keep-writing.c b/tests/basic/gfapi/gfapi-keep-writing.c
9ae3f9
new file mode 100644
9ae3f9
index 0000000..91b59ce
9ae3f9
--- /dev/null
9ae3f9
+++ b/tests/basic/gfapi/gfapi-keep-writing.c
9ae3f9
@@ -0,0 +1,129 @@
9ae3f9
+#include <fcntl.h>
9ae3f9
+#include <unistd.h>
9ae3f9
+#include <time.h>
9ae3f9
+#include <limits.h>
9ae3f9
+#include <string.h>
9ae3f9
+#include <stdio.h>
9ae3f9
+#include <stdlib.h>
9ae3f9
+#include <errno.h>
9ae3f9
+#include <glusterfs/api/glfs.h>
9ae3f9
+#include <glusterfs/api/glfs-handles.h>
9ae3f9
+
9ae3f9
+#define LOG_ERR(msg)                                                           \
9ae3f9
+    do {                                                                       \
9ae3f9
+        fprintf(stderr, "%s : Error (%s)\n", msg, strerror(errno));            \
9ae3f9
+    } while (0)
9ae3f9
+
9ae3f9
+glfs_t *
9ae3f9
+init_glfs(const char *hostname, const char *volname, const char *logfile)
9ae3f9
+{
9ae3f9
+    int ret = -1;
9ae3f9
+    glfs_t *fs = NULL;
9ae3f9
+
9ae3f9
+    fs = glfs_new(volname);
9ae3f9
+    if (!fs) {
9ae3f9
+        LOG_ERR("glfs_new failed");
9ae3f9
+        return NULL;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    ret = glfs_set_volfile_server(fs, "tcp", hostname, 24007);
9ae3f9
+    if (ret < 0) {
9ae3f9
+        LOG_ERR("glfs_set_volfile_server failed");
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    ret = glfs_set_logging(fs, logfile, 7);
9ae3f9
+    if (ret < 0) {
9ae3f9
+        LOG_ERR("glfs_set_logging failed");
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    ret = glfs_init(fs);
9ae3f9
+    if (ret < 0) {
9ae3f9
+        LOG_ERR("glfs_init failed");
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    ret = 0;
9ae3f9
+out:
9ae3f9
+    if (ret) {
9ae3f9
+        glfs_fini(fs);
9ae3f9
+        fs = NULL;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    return fs;
9ae3f9
+}
9ae3f9
+
9ae3f9
+int
9ae3f9
+glfs_test_function(const char *hostname, const char *volname,
9ae3f9
+                   const char *logfile, const char *syncfile)
9ae3f9
+{
9ae3f9
+    int ret = -1;
9ae3f9
+    int flags = O_CREAT | O_RDWR;
9ae3f9
+    glfs_t *fs = NULL;
9ae3f9
+    glfs_fd_t *glfd = NULL;
9ae3f9
+    const char *buff = "This is from my prog\n";
9ae3f9
+    const char *filename = "glfs_test.txt";
9ae3f9
+    struct stat buf = {0};
9ae3f9
+
9ae3f9
+    fs = init_glfs(hostname, volname, logfile);
9ae3f9
+    if (fs == NULL) {
9ae3f9
+        LOG_ERR("init_glfs failed");
9ae3f9
+        return -1;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    glfd = glfs_creat(fs, filename, flags, 0644);
9ae3f9
+    if (glfd == NULL) {
9ae3f9
+        LOG_ERR("glfs_creat failed");
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    while (glfs_stat(fs, syncfile, &buf) == 0) {
9ae3f9
+        ret = glfs_write(glfd, buff, strlen(buff), flags);
9ae3f9
+        if (ret < 0) {
9ae3f9
+            LOG_ERR("glfs_write failed");
9ae3f9
+            goto out;
9ae3f9
+        }
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    ret = glfs_close(glfd);
9ae3f9
+    if (ret < 0) {
9ae3f9
+        LOG_ERR("glfs_write failed");
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+out:
9ae3f9
+    ret = glfs_fini(fs);
9ae3f9
+    if (ret) {
9ae3f9
+        LOG_ERR("glfs_fini failed");
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    return ret;
9ae3f9
+}
9ae3f9
+
9ae3f9
+int
9ae3f9
+main(int argc, char *argv[])
9ae3f9
+{
9ae3f9
+    int ret = 0;
9ae3f9
+    char *hostname = NULL;
9ae3f9
+    char *volname = NULL;
9ae3f9
+    char *logfile = NULL;
9ae3f9
+    char *syncfile = NULL;
9ae3f9
+
9ae3f9
+    if (argc != 5) {
9ae3f9
+        fprintf(stderr, "Invalid argument\n");
9ae3f9
+        exit(1);
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    hostname = argv[1];
9ae3f9
+    volname = argv[2];
9ae3f9
+    logfile = argv[3];
9ae3f9
+    syncfile = argv[4];
9ae3f9
+
9ae3f9
+    ret = glfs_test_function(hostname, volname, logfile, syncfile);
9ae3f9
+    if (ret) {
9ae3f9
+        LOG_ERR("glfs_test_function failed");
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    return ret;
9ae3f9
+}
9ae3f9
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
9ae3f9
index 7fcc9d4..df82b6e 100644
9ae3f9
--- a/xlators/cluster/afr/src/afr-inode-write.c
9ae3f9
+++ b/xlators/cluster/afr/src/afr-inode-write.c
9ae3f9
@@ -2492,6 +2492,7 @@ afr_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync,
9ae3f9
     call_frame_t *transaction_frame = NULL;
9ae3f9
     int ret = -1;
9ae3f9
     int32_t op_errno = ENOMEM;
9ae3f9
+    int8_t last_fsync = 0;
9ae3f9
 
9ae3f9
     transaction_frame = copy_frame(frame);
9ae3f9
     if (!transaction_frame)
9ae3f9
@@ -2501,10 +2502,16 @@ afr_fsync(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync,
9ae3f9
     if (!local)
9ae3f9
         goto out;
9ae3f9
 
9ae3f9
-    if (xdata)
9ae3f9
+    if (xdata) {
9ae3f9
         local->xdata_req = dict_copy_with_ref(xdata, NULL);
9ae3f9
-    else
9ae3f9
+        if (dict_get_int8(xdata, "last-fsync", &last_fsync) == 0) {
9ae3f9
+            if (last_fsync) {
9ae3f9
+                local->transaction.disable_delayed_post_op = _gf_true;
9ae3f9
+            }
9ae3f9
+        }
9ae3f9
+    } else {
9ae3f9
         local->xdata_req = dict_new();
9ae3f9
+    }
9ae3f9
 
9ae3f9
     if (!local->xdata_req)
9ae3f9
         goto out;
9ae3f9
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
9ae3f9
index 8e65ae2..ffd0ab8 100644
9ae3f9
--- a/xlators/cluster/afr/src/afr-transaction.c
9ae3f9
+++ b/xlators/cluster/afr/src/afr-transaction.c
9ae3f9
@@ -2385,8 +2385,13 @@ afr_is_delayed_changelog_post_op_needed(call_frame_t *frame, xlator_t *this,
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
 
9ae3f9
-    if ((local->op != GF_FOP_WRITE) && (local->op != GF_FOP_FXATTROP)) {
9ae3f9
-        /*Only allow writes but shard does [f]xattrops on writes, so
9ae3f9
+    if (local->transaction.disable_delayed_post_op) {
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    if ((local->op != GF_FOP_WRITE) && (local->op != GF_FOP_FXATTROP) &&
9ae3f9
+        (local->op != GF_FOP_FSYNC)) {
9ae3f9
+        /*Only allow writes/fsyncs but shard does [f]xattrops on writes, so
9ae3f9
          * they are fine too*/
9ae3f9
         goto out;
9ae3f9
     }
9ae3f9
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
9ae3f9
index 18f1a6a..ff96246 100644
9ae3f9
--- a/xlators/cluster/afr/src/afr.h
9ae3f9
+++ b/xlators/cluster/afr/src/afr.h
9ae3f9
@@ -854,7 +854,7 @@ typedef struct _afr_local {
9ae3f9
 
9ae3f9
         int (*unwind)(call_frame_t *frame, xlator_t *this);
9ae3f9
 
9ae3f9
-        /* post-op hook */
9ae3f9
+        gf_boolean_t disable_delayed_post_op;
9ae3f9
     } transaction;
9ae3f9
 
9ae3f9
     syncbarrier_t barrier;
9ae3f9
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
9ae3f9
index d0c21b4..e9974cd 100644
9ae3f9
--- a/xlators/cluster/dht/src/dht-rebalance.c
9ae3f9
+++ b/xlators/cluster/dht/src/dht-rebalance.c
9ae3f9
@@ -1550,6 +1550,7 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
9ae3f9
     xlator_t *old_target = NULL;
9ae3f9
     xlator_t *hashed_subvol = NULL;
9ae3f9
     fd_t *linkto_fd = NULL;
9ae3f9
+    dict_t *xdata = NULL;
9ae3f9
 
9ae3f9
     if (from == to) {
9ae3f9
         gf_msg_debug(this->name, 0,
9ae3f9
@@ -1868,7 +1869,15 @@ dht_migrate_file(xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
9ae3f9
 
9ae3f9
     /* TODO: Sync the locks */
9ae3f9
 
9ae3f9
-    ret = syncop_fsync(to, dst_fd, 0, NULL, NULL, NULL, NULL);
9ae3f9
+    xdata = dict_new();
9ae3f9
+    if (!xdata || dict_set_int8(xdata, "last-fsync", 1)) {
9ae3f9
+        gf_log(this->name, GF_LOG_ERROR,
9ae3f9
+               "%s: failed to set last-fsync flag on "
9ae3f9
+               "%s (%s)",
9ae3f9
+               loc->path, to->name, strerror(ENOMEM));
9ae3f9
+    }
9ae3f9
+
9ae3f9
+    ret = syncop_fsync(to, dst_fd, 0, NULL, NULL, xdata, NULL);
9ae3f9
     if (ret) {
9ae3f9
         gf_log(this->name, GF_LOG_WARNING, "%s: failed to fsync on %s (%s)",
9ae3f9
                loc->path, to->name, strerror(-ret));
9ae3f9
@@ -2342,11 +2351,15 @@ out:
9ae3f9
 
9ae3f9
     if (dst_fd)
9ae3f9
         syncop_close(dst_fd);
9ae3f9
+
9ae3f9
     if (src_fd)
9ae3f9
         syncop_close(src_fd);
9ae3f9
     if (linkto_fd)
9ae3f9
         syncop_close(linkto_fd);
9ae3f9
 
9ae3f9
+    if (xdata)
9ae3f9
+        dict_unref(xdata);
9ae3f9
+
9ae3f9
     loc_wipe(&tmp_loc);
9ae3f9
     loc_wipe(&parent_loc);
9ae3f9
 
9ae3f9
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
9ae3f9
index fdeec49..4264fad 100644
9ae3f9
--- a/xlators/mount/fuse/src/fuse-bridge.c
9ae3f9
+++ b/xlators/mount/fuse/src/fuse-bridge.c
9ae3f9
@@ -5559,6 +5559,7 @@ fuse_migrate_fd(xlator_t *this, fd_t *basefd, xlator_t *old_subvol,
9ae3f9
     char create_in_progress = 0;
9ae3f9
     fuse_fd_ctx_t *basefd_ctx = NULL;
9ae3f9
     fd_t *oldfd = NULL;
9ae3f9
+    dict_t *xdata = NULL;
9ae3f9
 
9ae3f9
     basefd_ctx = fuse_fd_ctx_get(this, basefd);
9ae3f9
     GF_VALIDATE_OR_GOTO("glusterfs-fuse", basefd_ctx, out);
9ae3f9
@@ -5595,10 +5596,23 @@ fuse_migrate_fd(xlator_t *this, fd_t *basefd, xlator_t *old_subvol,
9ae3f9
     }
9ae3f9
 
9ae3f9
     if (oldfd->inode->table->xl == old_subvol) {
9ae3f9
-        if (IA_ISDIR(oldfd->inode->ia_type))
9ae3f9
+        if (IA_ISDIR(oldfd->inode->ia_type)) {
9ae3f9
             ret = syncop_fsyncdir(old_subvol, oldfd, 0, NULL, NULL);
9ae3f9
-        else
9ae3f9
-            ret = syncop_fsync(old_subvol, oldfd, 0, NULL, NULL, NULL, NULL);
9ae3f9
+        } else {
9ae3f9
+            xdata = dict_new();
9ae3f9
+            if (!xdata || dict_set_int8(xdata, "last-fsync", 1)) {
9ae3f9
+                gf_log("glusterfs-fuse", GF_LOG_WARNING,
9ae3f9
+                       "last-fsync set failed (%s) on fd (%p)"
9ae3f9
+                       "(basefd:%p basefd-inode.gfid:%s) "
9ae3f9
+                       "(old-subvolume:%s-%d new-subvolume:%s-%d)",
9ae3f9
+                       strerror(ENOMEM), oldfd, basefd,
9ae3f9
+                       uuid_utoa(basefd->inode->gfid), old_subvol->name,
9ae3f9
+                       old_subvol->graph->id, new_subvol->name,
9ae3f9
+                       new_subvol->graph->id);
9ae3f9
+            }
9ae3f9
+
9ae3f9
+            ret = syncop_fsync(old_subvol, oldfd, 0, NULL, NULL, xdata, NULL);
9ae3f9
+        }
9ae3f9
 
9ae3f9
         if (ret < 0) {
9ae3f9
             gf_log("glusterfs-fuse", GF_LOG_WARNING,
9ae3f9
@@ -5653,6 +5667,9 @@ out:
9ae3f9
 
9ae3f9
     fd_unref(oldfd);
9ae3f9
 
9ae3f9
+    if (xdata)
9ae3f9
+        dict_unref(xdata);
9ae3f9
+
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
-- 
9ae3f9
1.8.3.1
9ae3f9