From 0b1ded9bbd1b20f20e2e68850c38c5b8b14b6292 Mon Sep 17 00:00:00 2001 From: Raghavendra Talur Date: Thu, 25 Jun 2015 02:18:42 +0530 Subject: storage/posix: Check xdata for NULL before dict_get Backport of http://review.gluster.org/#/c/11390 Performing a dict_get on xdata can lead to frequent logging if xdata is NULL. Change-Id: I1666f0cc958c639ccd816e3738dd4a1efebbff82 BUG: 1235923 Signed-off-by: Raghavendra Talur Reviewed-on: http://review.gluster.org/11417 Tested-by: NetBSD Build System Reviewed-by: N Balachandran Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat --- xlators/storage/posix/src/posix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index b3856cc91ff..42b1d0f112f 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3295,7 +3295,7 @@ posix_setxattr (call_frame_t *frame, xlator_t *this, * This is used by DHT to redirect FOPs if the file is being migrated * Ignore errors for now */ - if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { + if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { ret = posix_pstat(this, loc->gfid, real_path, &stbuf); if (ret) goto out; @@ -4399,7 +4399,7 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this, } } - if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { + if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { ret = posix_fdstat (this, pfd->fd, &stbuf); if (ret == -1) { gf_log (this->name, GF_LOG_ERROR, @@ -4540,7 +4540,7 @@ posix_removexattr (call_frame_t *frame, xlator_t *this, goto out; } - if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { + if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { ret = posix_pstat(this, loc->gfid, real_path, &stbuf); if (ret) goto out; @@ -4612,7 +4612,7 @@ posix_fremovexattr (call_frame_t *frame, xlator_t *this, goto out; } - if (dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { + if (xdata && dict_get (xdata, DHT_IATT_IN_XDATA_KEY)) { ret = posix_fdstat (this, pfd->fd, &stbuf); if (ret) goto out; -- cgit