summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-heal.c
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-09-10 23:43:07 +0200
committerVijay Bellur <vbellur@redhat.com>2014-09-19 12:31:46 -0700
commitb8c820be5f1d3ad7f60a2a0c7256081491d79d51 (patch)
tree4da885d039c85e19515e139f13c7c4a59e3271df /xlators/cluster/ec/src/ec-heal.c
parent61bf585398c514d437a022792f6726a4292509dd (diff)
ec: Fix invalid inode lock in ftruncate
The fops 'truncate' and 'ftruncate' share some code and inodelk() was always made against the inode inside the loc_t structure instead of that of fd_t. Since ftruncate has the loc initialized to NULL, this fop was executed without any lock, allowing some concurrent modifications in the file size. Also changed the way in which 'fop' and 'ffop' are differentiated in shared code. Now it uses 'id' field instead of checking if 'fd' is NULL. This is a backport of http://review.gluster.org/8695/ Change-Id: Ibd18accf2652193b395a841b9029729e5f4867c6 BUG: 1140847 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8780 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-heal.c')
-rw-r--r--xlators/cluster/ec/src/ec-heal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
index 107ff5ffe3d..54301d10df4 100644
--- a/xlators/cluster/ec/src/ec-heal.c
+++ b/xlators/cluster/ec/src/ec-heal.c
@@ -1336,7 +1336,7 @@ int32_t ec_manager_heal(ec_fop_data_t * fop, int32_t state)
GF_ASSERT(cbk != NULL);
- if (fop->fd == NULL)
+ if (fop->id == EC_FOP_HEAL)
{
if (fop->cbks.heal != NULL)
{
@@ -1364,7 +1364,7 @@ int32_t ec_manager_heal(ec_fop_data_t * fop, int32_t state)
case -EC_STATE_REPORT:
GF_ASSERT(fop->error != 0);
- if (fop->fd == NULL)
+ if (fop->id == EC_FOP_HEAL)
{
if (fop->cbks.heal != NULL)
{