190130
From a92b4f6373cb18544325436cf86abfebd6780d79 Mon Sep 17 00:00:00 2001
190130
From: Homma <homma@allworks.co.jp>
190130
Date: Fri, 5 Jul 2019 16:10:41 +0530
190130
Subject: [PATCH 409/449] system/posix-acl: update ctx only if iatt is non-NULL
190130
190130
We need to safe-guard against possible zero'ing out of iatt
190130
structure in acl ctx, which can cause many issues.
190130
190130
> upstream patch: https://review.gluster.org/#/c/glusterfs/+/23003/
190130
> fixes: 1668286
190130
> Change-Id: Ie81a57d7453a6624078de3be8c0845bf4d432773
190130
> Signed-off-by: Amar Tumballi <amarts@redhat.com>
190130
190130
BUG: 1781649
190130
Change-Id: I655b61551d30215b9f23cafc3ef9a5c0d98a43d0
190130
Signed-off-by: Raghavendra M <raghavendra@redhat.com>
190130
Reviewed-on: https://code.engineering.redhat.com/gerrit/202446
190130
Tested-by: RHGS Build Bot <nigelb@redhat.com>
190130
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
190130
---
190130
 xlators/system/posix-acl/src/posix-acl.c | 8 ++++++++
190130
 1 file changed, 8 insertions(+)
190130
190130
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
190130
index 38e48b8..c6ba281 100644
190130
--- a/xlators/system/posix-acl/src/posix-acl.c
190130
+++ b/xlators/system/posix-acl/src/posix-acl.c
190130
@@ -875,6 +875,13 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf,
190130
     int ret = 0;
190130
     int i = 0;
190130
 
190130
+    if (!buf || !buf->ia_ctime) {
190130
+        /* No need to update ctx if buf is empty */
190130
+        gf_log_callingfn(this->name, GF_LOG_DEBUG, "iatt struct is empty (%d)",
190130
+                         fop);
190130
+        goto out;
190130
+    }
190130
+
190130
     LOCK(&inode->lock);
190130
     {
190130
         ctx = __posix_acl_ctx_get(inode, this, _gf_true);
190130
@@ -928,6 +935,7 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf,
190130
     }
190130
 unlock:
190130
     UNLOCK(&inode->lock);
190130
+out:
190130
     return ret;
190130
 }
190130
 
190130
-- 
190130
1.8.3.1
190130