From 834408a49f204e8c256dad4b46d0f19053bf4b0e Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 29 Mar 2012 12:17:12 +0530 Subject: cluster/afr: handle fstat failure in data-self-heal The final fstat which makes the call_count 0 could be a failure. In that case the buf could either be NULL or buf is all zeros. If buf is NULL then it will crash, if it is all zeros buf->ia_type will be IA_INVAL and it proceeds to special file fix. sh->type is assigned with the ia_type of the file to be healed. I modified the code to depend on that instead. Change-Id: Icf7e19ff5908207128f2a1ee2963ad6b791c1ac5 BUG: 804645 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/3031 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heal-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 3df6a0e8705..bf37729fe82 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -909,7 +909,7 @@ afr_sh_data_fstat_cbk (call_frame_t *frame, void *cookie, afr_sh_data_fail (frame, this); goto out; } - if (IA_ISREG (buf->ia_type)) + if (IA_ISREG (sh->type)) afr_sh_data_fix (frame, this); else afr_sh_data_special_file_fix (frame, this); -- cgit