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