From 0ee0cfae80f7b17115b78d76610b995edb1bfa8b Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Wed, 10 Sep 2014 23:43:07 +0200 Subject: 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. Change-Id: Ibd18accf2652193b395a841b9029729e5f4867c6 BUG: 1140396 Signed-off-by: Xavier Hernandez Reviewed-on: http://review.gluster.org/8695 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/ec/src/ec-generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/cluster/ec/src/ec-generic.c') diff --git a/xlators/cluster/ec/src/ec-generic.c b/xlators/cluster/ec/src/ec-generic.c index 162cb901814..286425e07c9 100644 --- a/xlators/cluster/ec/src/ec-generic.c +++ b/xlators/cluster/ec/src/ec-generic.c @@ -1420,7 +1420,7 @@ int32_t ec_manager_xattrop(ec_fop_data_t * fop, int32_t state) GF_ASSERT(cbk != NULL); - if (fop->fd == NULL) + if (fop->id == GF_FOP_XATTROP) { if (fop->cbks.xattrop != NULL) { @@ -1447,7 +1447,7 @@ int32_t ec_manager_xattrop(ec_fop_data_t * fop, int32_t state) case -EC_STATE_REPORT: GF_ASSERT(fop->error != 0); - if (fop->fd == NULL) + if (fop->id == GF_FOP_XATTROP) { if (fop->cbks.xattrop != NULL) { -- cgit