From 2142614f385352903d0cdb67657f2e639b79f72c 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 Backport of: http://review.gluster.org/#/c/12907/ 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: I8e26d92568434bc6c60b0c23089532bf3bdac509 BUG: 1289570 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/12911 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/features/shard/src/shard.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xlators') 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