d2787b
From 46e2bbd52d4427c1348fa38dcb5d2b5f125555f1 Mon Sep 17 00:00:00 2001
d2787b
From: Amar Tumballi <amarts@redhat.com>
d2787b
Date: Thu, 30 May 2019 15:25:01 +0530
d2787b
Subject: [PATCH 522/526] lcov: improve line coverage
d2787b
d2787b
upcall: remove extra variable assignment and use just one
d2787b
        initialization.
d2787b
open-behind: reduce the overall number of lines, in functions
d2787b
             not frequently called
d2787b
selinux: reduce some lines in init failure cases
d2787b
d2787b
Upstream patch:
d2787b
> Upstream-patch-link: https://review.gluster.org/#/c/glusterfs/+/22789
d2787b
> updates: bz#1693692
d2787b
> Change-Id: I7c1de94f2ec76a5bfe1f48a9632879b18e5fbb95
d2787b
> Signed-off-by: Amar Tumballi <amarts@redhat.com>
d2787b
d2787b
BUG: 1830713
d2787b
Change-Id: I7c1de94f2ec76a5bfe1f48a9632879b18e5fbb95
d2787b
Signed-off-by: Amar Tumballi <amarts@redhat.com>
d2787b
Reviewed-on: https://code.engineering.redhat.com/gerrit/224486
d2787b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d2787b
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d2787b
---
d2787b
 xlators/features/selinux/src/selinux.c            |   6 +-
d2787b
 xlators/features/upcall/src/upcall.c              | 108 +++++++---------------
d2787b
 xlators/performance/open-behind/src/open-behind.c |  58 ++++--------
d2787b
 3 files changed, 55 insertions(+), 117 deletions(-)
d2787b
d2787b
diff --git a/xlators/features/selinux/src/selinux.c b/xlators/features/selinux/src/selinux.c
d2787b
index 58b4c5d..e8e16cd 100644
d2787b
--- a/xlators/features/selinux/src/selinux.c
d2787b
+++ b/xlators/features/selinux/src/selinux.c
d2787b
@@ -234,7 +234,6 @@ init(xlator_t *this)
d2787b
     priv = GF_CALLOC(1, sizeof(*priv), gf_selinux_mt_selinux_priv_t);
d2787b
     if (!priv) {
d2787b
         gf_log(this->name, GF_LOG_ERROR, "out of memory");
d2787b
-        ret = ENOMEM;
d2787b
         goto out;
d2787b
     }
d2787b
 
d2787b
@@ -242,7 +241,6 @@ init(xlator_t *this)
d2787b
 
d2787b
     this->local_pool = mem_pool_new(selinux_priv_t, 64);
d2787b
     if (!this->local_pool) {
d2787b
-        ret = -1;
d2787b
         gf_msg(this->name, GF_LOG_ERROR, ENOMEM, SL_MSG_ENOMEM,
d2787b
                "Failed to create local_t's memory pool");
d2787b
         goto out;
d2787b
@@ -252,9 +250,7 @@ init(xlator_t *this)
d2787b
     ret = 0;
d2787b
 out:
d2787b
     if (ret) {
d2787b
-        if (priv) {
d2787b
-            GF_FREE(priv);
d2787b
-        }
d2787b
+        GF_FREE(priv);
d2787b
         mem_pool_destroy(this->local_pool);
d2787b
     }
d2787b
     return ret;
d2787b
diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c
d2787b
index 2583c50..0795f58 100644
d2787b
--- a/xlators/features/upcall/src/upcall.c
d2787b
+++ b/xlators/features/upcall/src/upcall.c
d2787b
@@ -57,14 +57,13 @@ static int32_t
d2787b
 up_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
d2787b
         fd_t *fd, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -111,14 +110,13 @@ up_writev(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector,
d2787b
           int count, off_t off, uint32_t flags, struct iobref *iobref,
d2787b
           dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -167,14 +165,13 @@ static int32_t
d2787b
 up_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
d2787b
          off_t offset, uint32_t flags, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -220,14 +217,13 @@ static int32_t
d2787b
 up_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
d2787b
       struct gf_flock *flock, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -274,14 +270,13 @@ static int32_t
d2787b
 up_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
d2787b
             dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -343,14 +338,13 @@ static int32_t
d2787b
 up_setattr(call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf,
d2787b
            int32_t valid, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -410,14 +404,13 @@ static int32_t
d2787b
 up_rename(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
d2787b
           dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, newloc, NULL, oldloc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -472,14 +465,13 @@ static int32_t
d2787b
 up_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
d2787b
           dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -531,14 +523,13 @@ static int32_t
d2787b
 up_link(call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc,
d2787b
         dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, newloc, NULL, oldloc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -592,14 +583,13 @@ static int32_t
d2787b
 up_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
d2787b
          dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -653,14 +643,13 @@ static int32_t
d2787b
 up_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
d2787b
          mode_t umask, dict_t *params)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -717,15 +706,13 @@ static int32_t
d2787b
 up_create(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
d2787b
           mode_t mode, mode_t umask, fd_t *fd, dict_t *params)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
d2787b
-
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -774,14 +761,13 @@ out:
d2787b
 static int32_t
d2787b
 up_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -826,14 +812,13 @@ out:
d2787b
 static int32_t
d2787b
 up_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -852,14 +837,13 @@ err:
d2787b
 static int32_t
d2787b
 up_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -879,14 +863,13 @@ static int32_t
d2787b
 up_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
d2787b
              dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -932,14 +915,13 @@ static int32_t
d2787b
 up_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask,
d2787b
           dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -986,14 +968,13 @@ static int32_t
d2787b
 up_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
d2787b
             dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1047,14 +1028,13 @@ static int32_t
d2787b
 up_mknod(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
d2787b
          dev_t rdev, mode_t umask, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1110,14 +1090,13 @@ static int32_t
d2787b
 up_symlink(call_frame_t *frame, xlator_t *this, const char *linkpath,
d2787b
            loc_t *loc, mode_t umask, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->parent, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1164,14 +1143,13 @@ static int32_t
d2787b
 up_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
d2787b
            dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1216,14 +1194,13 @@ out:
d2787b
 static int32_t
d2787b
 up_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1270,14 +1247,13 @@ static int32_t
d2787b
 up_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
d2787b
            off_t off, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1334,14 +1310,13 @@ static int32_t
d2787b
 up_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
d2787b
             off_t off, dict_t *dict)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1361,14 +1336,13 @@ static int32_t
d2787b
 up_fsetattr(call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf,
d2787b
             int32_t valid, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1415,14 +1389,13 @@ static int32_t
d2787b
 up_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode,
d2787b
              off_t offset, size_t len, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1470,14 +1443,13 @@ static int32_t
d2787b
 up_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
d2787b
            size_t len, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1524,14 +1496,13 @@ static int
d2787b
 up_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
d2787b
             off_t len, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1577,14 +1548,13 @@ static int32_t
d2787b
 up_seek(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
d2787b
         gf_seek_what_t what, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1652,14 +1622,13 @@ static int32_t
d2787b
 up_setxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict,
d2787b
             int32_t flags, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->inode, dict);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1727,14 +1696,13 @@ static int32_t
d2787b
 up_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict,
d2787b
              int32_t flags, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, fd, fd->inode, dict);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1800,7 +1768,7 @@ static int32_t
d2787b
 up_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
d2787b
                 dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
     dict_t *xattr = NULL;
d2787b
 
d2787b
@@ -1808,13 +1776,11 @@ up_fremovexattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
d2787b
 
d2787b
     xattr = dict_for_key_value(name, "", 1, _gf_true);
d2787b
     if (!xattr) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, fd, fd->inode, xattr);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1885,7 +1851,7 @@ static int32_t
d2787b
 up_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
d2787b
                const char *name, dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
     dict_t *xattr = NULL;
d2787b
 
d2787b
@@ -1893,13 +1859,11 @@ up_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
d2787b
 
d2787b
     xattr = dict_for_key_value(name, "", 1, _gf_true);
d2787b
     if (!xattr) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
     local = upcall_local_init(frame, this, loc, NULL, loc->inode, xattr);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -1950,14 +1914,13 @@ static int32_t
d2787b
 up_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
d2787b
              dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, fd->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -2000,14 +1963,13 @@ static int32_t
d2787b
 up_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
d2787b
             dict_t *xdata)
d2787b
 {
d2787b
-    int32_t op_errno = -1;
d2787b
+    int32_t op_errno = ENOMEM;
d2787b
     upcall_local_t *local = NULL;
d2787b
 
d2787b
     EXIT_IF_UPCALL_OFF(this, out);
d2787b
 
d2787b
     local = upcall_local_init(frame, this, NULL, NULL, loc->inode, NULL);
d2787b
     if (!local) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
d2787b
index dd2f2fd..cbe89ec 100644
d2787b
--- a/xlators/performance/open-behind/src/open-behind.c
d2787b
+++ b/xlators/performance/open-behind/src/open-behind.c
d2787b
@@ -581,7 +581,7 @@ ob_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
d2787b
 {
d2787b
     fd_t *old_fd = NULL;
d2787b
     int ret = -1;
d2787b
-    int op_errno = 0;
d2787b
+    int op_errno = ENOMEM;
d2787b
     call_stub_t *stub = NULL;
d2787b
 
d2787b
     old_fd = fd_lookup(fd->inode, 0);
d2787b
@@ -589,7 +589,6 @@ ob_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
d2787b
         /* open-behind only when this is the first FD */
d2787b
         stub = fop_open_stub(frame, default_open_resume, loc, flags, fd, xdata);
d2787b
         if (!stub) {
d2787b
-            op_errno = ENOMEM;
d2787b
             fd_unref(old_fd);
d2787b
             goto err;
d2787b
         }
d2787b
@@ -603,7 +602,6 @@ ob_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, fd_t *fd,
d2787b
 
d2787b
     ret = ob_open_behind(frame, this, loc, flags, fd, xdata);
d2787b
     if (ret) {
d2787b
-        op_errno = ENOMEM;
d2787b
         goto err;
d2787b
     }
d2787b
 
d2787b
@@ -900,18 +898,12 @@ int
d2787b
 ob_finodelk(call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd,
d2787b
             int cmd, struct gf_flock *flock, dict_t *xdata)
d2787b
 {
d2787b
-    call_stub_t *stub = NULL;
d2787b
-
d2787b
-    stub = fop_finodelk_stub(frame, default_finodelk_resume, volume, fd, cmd,
d2787b
-                             flock, xdata);
d2787b
-    if (!stub)
d2787b
-        goto err;
d2787b
-
d2787b
-    open_and_resume(this, fd, stub);
d2787b
-
d2787b
-    return 0;
d2787b
-err:
d2787b
-    STACK_UNWIND_STRICT(finodelk, frame, -1, ENOMEM, 0);
d2787b
+    call_stub_t *stub = fop_finodelk_stub(frame, default_finodelk_resume,
d2787b
+                                          volume, fd, cmd, flock, xdata);
d2787b
+    if (stub)
d2787b
+        open_and_resume(this, fd, stub);
d2787b
+    else
d2787b
+        STACK_UNWIND_STRICT(finodelk, frame, -1, ENOMEM, 0);
d2787b
 
d2787b
     return 0;
d2787b
 }
d2787b
@@ -921,18 +913,12 @@ ob_fentrylk(call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd,
d2787b
             const char *basename, entrylk_cmd cmd, entrylk_type type,
d2787b
             dict_t *xdata)
d2787b
 {
d2787b
-    call_stub_t *stub = NULL;
d2787b
-
d2787b
-    stub = fop_fentrylk_stub(frame, default_fentrylk_resume, volume, fd,
d2787b
-                             basename, cmd, type, xdata);
d2787b
-    if (!stub)
d2787b
-        goto err;
d2787b
-
d2787b
-    open_and_resume(this, fd, stub);
d2787b
-
d2787b
-    return 0;
d2787b
-err:
d2787b
-    STACK_UNWIND_STRICT(fentrylk, frame, -1, ENOMEM, 0);
d2787b
+    call_stub_t *stub = fop_fentrylk_stub(
d2787b
+        frame, default_fentrylk_resume, volume, fd, basename, cmd, type, xdata);
d2787b
+    if (stub)
d2787b
+        open_and_resume(this, fd, stub);
d2787b
+    else
d2787b
+        STACK_UNWIND_STRICT(fentrylk, frame, -1, ENOMEM, 0);
d2787b
 
d2787b
     return 0;
d2787b
 }
d2787b
@@ -941,18 +927,12 @@ int
d2787b
 ob_fxattrop(call_frame_t *frame, xlator_t *this, fd_t *fd,
d2787b
             gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata)
d2787b
 {
d2787b
-    call_stub_t *stub = NULL;
d2787b
-
d2787b
-    stub = fop_fxattrop_stub(frame, default_fxattrop_resume, fd, optype, xattr,
d2787b
-                             xdata);
d2787b
-    if (!stub)
d2787b
-        goto err;
d2787b
-
d2787b
-    open_and_resume(this, fd, stub);
d2787b
-
d2787b
-    return 0;
d2787b
-err:
d2787b
-    STACK_UNWIND_STRICT(fxattrop, frame, -1, ENOMEM, 0, 0);
d2787b
+    call_stub_t *stub = fop_fxattrop_stub(frame, default_fxattrop_resume, fd,
d2787b
+                                          optype, xattr, xdata);
d2787b
+    if (stub)
d2787b
+        open_and_resume(this, fd, stub);
d2787b
+    else
d2787b
+        STACK_UNWIND_STRICT(fxattrop, frame, -1, ENOMEM, 0, 0);
d2787b
 
d2787b
     return 0;
d2787b
 }
d2787b
-- 
d2787b
1.8.3.1
d2787b