summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShyam <srangana@redhat.com>2014-10-24 15:44:22 -0400
committerVijay Bellur <vbellur@redhat.com>2014-11-05 21:30:30 -0800
commit08109ed5a7e09ec14ecb3640cfcaf9b32d83499b (patch)
treeb9f9642f02418e4806b3a5297c4365096b3081f8
parentedeb348a1cfe41aebd700e0689fa1139c1ebe408 (diff)
xlator/io-stat: Check and copy loc->path
Cases where loc->path is NULL, the current code in create/open/mkdir would copy the same blindly and as a result coredump. This is a preventive fix for the coredump. The reason for loc->path to be NULL in certain cases is yet to be determined. One such case is when resolve_loc_touchup fails to get inode_path due to loops in the inode table. Change-Id: Ic2ddf2cc9f2acaf9b939afc11afd193b4402ee7c BUG: 1159221 Signed-off-by: Shyam <srangana@redhat.com> Reviewed-on: http://review.gluster.org/9029 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/debug/io-stats/src/io-stats.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 9033d724dc2..e6e57c37451 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -1549,6 +1549,9 @@ io_stats_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct ios_stat *iosstat = NULL;
char *path = frame->local;
+ if (!path)
+ goto unwind;
+
UPDATE_PROFILE_STATS (frame, MKDIR);
if (op_ret < 0)
goto unwind;
@@ -1979,7 +1982,8 @@ int
io_stats_mkdir (call_frame_t *frame, xlator_t *this,
loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata)
{
- frame->local = gf_strdup (loc->path);
+ if (loc->path)
+ frame->local = gf_strdup (loc->path);
START_FOP_LATENCY (frame);
@@ -2093,7 +2097,8 @@ int
io_stats_open (call_frame_t *frame, xlator_t *this, loc_t *loc,
int32_t flags, fd_t *fd, dict_t *xdata)
{
- frame->local = gf_strdup (loc->path);
+ if (loc->path)
+ frame->local = gf_strdup (loc->path);
START_FOP_LATENCY (frame);
@@ -2110,7 +2115,8 @@ io_stats_create (call_frame_t *frame, xlator_t *this,
loc_t *loc, int32_t flags, mode_t mode,
mode_t umask, fd_t *fd, dict_t *xdata)
{
- frame->local = gf_strdup (loc->path);
+ if (loc->path)
+ frame->local = gf_strdup (loc->path);
START_FOP_LATENCY (frame);