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