From 22035d5e37db748cbdee2596d99006cea6b5282e Mon Sep 17 00:00:00 2001 From: Xavier Hernandez Date: Sat, 8 Nov 2014 21:46:41 +0100 Subject: ec: Fix posix compliance failures This patch solves some problems that caused dispersed volumes to not pass posix smoke tests: * Problems in open/create with O_WRONLY Opening files with -w- permissions using O_WRONLY returned an EACCES error because internally O_WRONLY was replaced with O_RDWR. * Problems with entrylk on renames. When source and destination were the same, ec tried to acquire the same entrylk twice, causing a deadlock. * Overwrite of a variable when reordering locks. On a rename, if the second lock needed to be placed at the beggining of the list, the 'lock' variable was overwritten and later its timer was cancelled, cancelling the incorrect one. * Handle O_TRUNC in open. When O_TRUNC was received in an open call, it was blindly propagated to child subvolumes. This caused a discrepancy between real file size and the size stored into trusted.ec.size xattr. This has been solved by removing O_TRUNC from open and later calling ftruncate. This is a backport of http://review.gluster.org/9420 Change-Id: I20c3d6e1c11be314be86879be54b728e01013798 BUG: 1159471 Signed-off-by: Xavier Hernandez Reviewed-on: http://review.gluster.org/9501 Tested-by: Gluster Build System Reviewed-by: Dan Lambright Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Raghavendra Bhat --- xlators/cluster/ec/src/ec-dir-write.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/ec/src/ec-dir-write.c') diff --git a/xlators/cluster/ec/src/ec-dir-write.c b/xlators/cluster/ec/src/ec-dir-write.c index e8d96272987..d48be20470d 100644 --- a/xlators/cluster/ec/src/ec-dir-write.c +++ b/xlators/cluster/ec/src/ec-dir-write.c @@ -158,10 +158,7 @@ int32_t ec_manager_create(ec_fop_data_t * fop, int32_t state) return EC_STATE_REPORT; } - if (ctx->flags == 0) - { - ctx->flags = fop->int32; - } + ctx->flags = fop->int32; UNLOCK(&fop->fd->lock); @@ -207,8 +204,7 @@ int32_t ec_manager_create(ec_fop_data_t * fop, int32_t state) /* We need to write to specific offsets on the bricks, so we * need to remove O_APPEND from flags (if present) */ - fop->int32 &= ~(O_ACCMODE | O_APPEND); - fop->int32 |= O_RDWR; + fop->int32 &= ~O_APPEND; /* Fall through */ -- cgit