diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2014-09-10 23:43:07 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-19 03:05:25 -0700 |
commit | 0ee0cfae80f7b17115b78d76610b995edb1bfa8b (patch) | |
tree | ec73cb45642474eec30ab0b8aa98fe12bec5364b /xlators/cluster/ec/src/ec-inode-read.c | |
parent | f32378b660dab5f3f311da8252969a7da16898f4 (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.
Change-Id: Ibd18accf2652193b395a841b9029729e5f4867c6
BUG: 1140396
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8695
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-inode-read.c')
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-read.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c index 0cb5559f62b..bc3d94c7e61 100644 --- a/xlators/cluster/ec/src/ec-inode-read.c +++ b/xlators/cluster/ec/src/ec-inode-read.c @@ -1534,7 +1534,7 @@ int32_t ec_manager_stat(ec_fop_data_t * fop, int32_t state) GF_ASSERT(cbk != NULL); - if (fop->fd == NULL) + if (fop->id == GF_FOP_STAT) { if (fop->cbks.stat != NULL) { @@ -1560,7 +1560,7 @@ int32_t ec_manager_stat(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_STAT) { if (fop->cbks.stat != NULL) { |