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