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