From 5fa88405ba1aba2312902255282fc4f6625d18ed Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Tue, 8 Dec 2015 12:47:42 +0530 Subject: features/shard: Do not update inode-ctx size (again) after xattrop This is to fix race between parallel writevs that could mess up the file size value in inode ctx. Thanks to Pranith for helping with RCA'ing the issue. Change-Id: Ief94e0b3bcd87a8e2391fb39af1b99d020abd764 BUG: 1289447 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/12907 Reviewed-by: Pranith Kumar Karampuri Tested-by: NetBSD Build System Tested-by: Gluster Build System --- xlators/features/shard/src/shard.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xlators/features/shard') diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 60b49d56180..b641f182fdb 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -573,8 +573,9 @@ shard_update_file_size_cbk (call_frame_t *frame, void *cookie, xlator_t *this, goto err; } - shard_inode_ctx_set (inode, this, &local->postbuf, 0, - SHARD_INODE_WRITE_MASK); + if (local->fop == GF_FOP_FTRUNCATE || local->fop == GF_FOP_TRUNCATE) + shard_inode_ctx_set (inode, this, &local->postbuf, 0, + SHARD_INODE_WRITE_MASK); err: local->post_update_size_handler (frame, this); @@ -3389,6 +3390,7 @@ __shard_get_delta_size_from_inode_ctx (shard_local_t *local, inode_t *inode, } else { local->delta_size = 0; } + local->postbuf = ctx->stat; return 0; } -- cgit