12a457
From 14abb0c32e9ab9bd43c1476dcc3e2125f80ad08d Mon Sep 17 00:00:00 2001
12a457
From: vmallika <vmallika@redhat.com>
12a457
Date: Mon, 11 Apr 2016 15:44:16 +0530
12a457
Subject: [PATCH 082/104] posix_acl: create inode ctx for posix_acl_get
12a457
12a457
This is a backport of http://review.gluster.org/13961
12a457
12a457
> Change-Id: Ibe5b00cd4b5d896133adc61f65094d783c492ed4
12a457
> BUG: 1325822
12a457
> Signed-off-by: vmallika <vmallika@redhat.com>
12a457
> Reviewed-on: http://review.gluster.org/13961
12a457
> Smoke: Gluster Build System <jenkins@build.gluster.com>
12a457
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
12a457
> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
12a457
> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
12a457
12a457
Change-Id: I95dfb0ca2f25cc533a8fbf8d8d73b764616b4df6
12a457
BUG: 1324338
12a457
Signed-off-by: vmallika <vmallika@redhat.com>
12a457
Reviewed-on: https://code.engineering.redhat.com/gerrit/71896
12a457
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
12a457
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
12a457
---
12a457
 xlators/system/posix-acl/src/posix-acl.c |   36 +++++++++++++++++++++--------
12a457
 1 files changed, 26 insertions(+), 10 deletions(-)
12a457
12a457
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
12a457
index 3ebdca4..cd799fc 100644
12a457
--- a/xlators/system/posix-acl/src/posix-acl.c
12a457
+++ b/xlators/system/posix-acl/src/posix-acl.c
12a457
@@ -853,17 +853,25 @@ posix_acl_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
12a457
                       int op_ret, int op_errno, inode_t *inode,
12a457
                       struct iatt *buf, dict_t *xattr, struct iatt *postparent)
12a457
 {
12a457
-        struct posix_acl     *acl_access = NULL;
12a457
+        struct posix_acl     *acl_access  = NULL;
12a457
         struct posix_acl     *acl_default = NULL;
12a457
-        struct posix_acl     *old_access = NULL;
12a457
+        struct posix_acl     *old_access  = NULL;
12a457
         struct posix_acl     *old_default = NULL;
12a457
-        data_t               *data = NULL;
12a457
-        int                   ret = 0;
12a457
-        dict_t               *my_xattr = NULL;
12a457
+        struct posix_acl_ctx *ctx         = NULL;
12a457
+        data_t               *data        = NULL;
12a457
+        int                   ret         = 0;
12a457
+        dict_t               *my_xattr    = NULL;
12a457
 
12a457
         if (op_ret != 0)
12a457
                 goto unwind;
12a457
 
12a457
+        ctx = posix_acl_ctx_new (inode, this);
12a457
+        if (!ctx) {
12a457
+                op_ret = -1;
12a457
+                op_errno = ENOMEM;
12a457
+                goto unwind;
12a457
+        }
12a457
+
12a457
         ret = posix_acl_get (inode, this, &old_access, &old_default);
12a457
 
12a457
         data = dict_get (xattr, POSIX_ACL_ACCESS_XATTR);
12a457
@@ -1624,11 +1632,12 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
12a457
                         int op_ret, int op_errno, gf_dirent_t *entries,
12a457
                         dict_t *xdata)
12a457
 {
12a457
-        gf_dirent_t      *entry       = NULL;
12a457
-        struct posix_acl *acl_access  = NULL;
12a457
-        struct posix_acl *acl_default = NULL;
12a457
-        data_t           *data        = NULL;
12a457
-        int               ret         = 0;
12a457
+        gf_dirent_t          *entry       = NULL;
12a457
+        struct posix_acl     *acl_access  = NULL;
12a457
+        struct posix_acl     *acl_default = NULL;
12a457
+        struct posix_acl_ctx *ctx         = NULL;
12a457
+        data_t               *data        = NULL;
12a457
+        int                   ret         = 0;
12a457
 
12a457
         if (op_ret <= 0)
12a457
                 goto unwind;
12a457
@@ -1638,6 +1647,13 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
12a457
                 if (!entry->dict || !entry->inode)
12a457
                         continue;
12a457
 
12a457
+                ctx = posix_acl_ctx_new (entry->inode, this);
12a457
+                if (!ctx) {
12a457
+                        op_ret = -1;
12a457
+                        op_errno = ENOMEM;
12a457
+                        goto unwind;
12a457
+                }
12a457
+
12a457
                 ret = posix_acl_get (entry->inode, this,
12a457
                                      &acl_access, &acl_default);
12a457
 
12a457
-- 
12a457
1.7.1
12a457