Blob Blame History Raw
From cdedd41ab825bfe59e8d1739fdea625a51f659f9 Mon Sep 17 00:00:00 2001
From: Soumya Koduri <skoduri@redhat.com>
Date: Fri, 9 Nov 2018 02:29:52 -0500
Subject: [PATCH 474/493] afr: open_ftruncate_cbk should read fd from
 local->cont.open struct

afr_open stores the fd as part of its local->cont.open struct
but when it calls ftruncate (if open flags contain O_TRUNC), the
corresponding cbk function (afr_ open_ftruncate_cbk) is
incorrectly referencing uninitialized local->fd. This patch fixes
the same.

Upstream reference:
Change-Id: Icbdedbd1b8cfea11d8f41b6e5c4cb4b44d989aba
> updates: bz#1648687
> review-url: https://review.gluster.org/#/c/glusterfs/+/21617/

BUG: 1655578
updates: bz#1655578
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Change-Id: I9c26eadd811fdd32630227f3130dec28e4b6972b
Reviewed-on: https://code.engineering.redhat.com/gerrit/158799
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Karthik Subrahmanya <ksubrahm@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 xlators/cluster/afr/src/afr-open.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index 6c625cc..d820462 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -62,7 +62,7 @@ afr_open_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
         afr_local_t * local = frame->local;
 
         AFR_STACK_UNWIND (open, frame, local->op_ret, local->op_errno,
-                          local->fd, xdata);
+                          local->cont.open.fd, xdata);
         return 0;
 }
 
-- 
1.8.3.1