cb8e9e
From 8861e84d3fb7518cae2c1f2fa733ba85a2ab560d Mon Sep 17 00:00:00 2001
cb8e9e
From: Raghavendra Talur <rtalur@redhat.com>
cb8e9e
Date: Thu, 25 Jun 2015 02:18:42 +0530
cb8e9e
Subject: [PATCH 177/190] storage/posix: Check xdata for NULL before dict_get
cb8e9e
cb8e9e
         Backport of http://review.gluster.org/#/c/11417/
cb8e9e
         Backport of http://review.gluster.org/#/c/11390
cb8e9e
cb8e9e
Performing a dict_get on xdata can lead to
cb8e9e
frequent logging if xdata is NULL.
cb8e9e
cb8e9e
Change-Id: I1666f0cc958c639ccd816e3738dd4a1efebbff82
cb8e9e
BUG: 1235940
cb8e9e
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/51689
cb8e9e
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
cb8e9e
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
---
cb8e9e
 xlators/storage/posix/src/posix.c |    8 ++++----
cb8e9e
 1 files changed, 4 insertions(+), 4 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
cb8e9e
index a2e484e..91e95ef 100644
cb8e9e
--- a/xlators/storage/posix/src/posix.c
cb8e9e
+++ b/xlators/storage/posix/src/posix.c
cb8e9e
@@ -3295,7 +3295,7 @@ posix_setxattr (call_frame_t *frame, xlator_t *this,
cb8e9e
  * This is used by DHT to redirect FOPs if the file is being migrated
cb8e9e
  * Ignore errors for now
cb8e9e
  */
cb8e9e
-        if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
+        if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
                 ret = posix_pstat(this, loc->gfid, real_path, &stbuf);
cb8e9e
                 if (ret)
cb8e9e
                         goto out;
cb8e9e
@@ -4399,7 +4399,7 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
cb8e9e
                 }
cb8e9e
         }
cb8e9e
 
cb8e9e
-        if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
+        if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
                 ret = posix_fdstat (this, pfd->fd, &stbuf);
cb8e9e
                 if (ret == -1) {
cb8e9e
                         gf_log (this->name, GF_LOG_ERROR,
cb8e9e
@@ -4540,7 +4540,7 @@ posix_removexattr (call_frame_t *frame, xlator_t *this,
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
+        if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
                 ret = posix_pstat(this, loc->gfid, real_path, &stbuf);
cb8e9e
                 if (ret)
cb8e9e
                         goto out;
cb8e9e
@@ -4612,7 +4612,7 @@ posix_fremovexattr (call_frame_t *frame, xlator_t *this,
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
+        if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) {
cb8e9e
                 ret = posix_fdstat (this, pfd->fd, &stbuf);
cb8e9e
                 if (ret)
cb8e9e
                         goto out;
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e