From 2c410a4c0964f4bec3a513a405a39486dd0183eb Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Tue, 1 Mar 2016 16:23:22 +0530 Subject: features/shard: Fix NULL-dereference when fsync fails Backport of: http://review.gluster.org/#/c/13562/ Change-Id: I6a642203949227452e0f64bcffae23ade1a34fd0 BUG: 1313315 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/13563 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/features/shard/src/shard.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'xlators/features') diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index e46d4dc33ec..857578fde2c 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -3880,8 +3880,12 @@ shard_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, struct iatt *prebuf, struct iatt *postbuf, dict_t *xdata) { + if (op_ret < 0) + goto out; + /* To-Do: Wind fsync on all shards of the file */ postbuf->ia_ctime = 0; +out: SHARD_STACK_UNWIND (fsync, frame, op_ret, op_errno, prebuf, postbuf, xdata); return 0; -- cgit