diff options
| author | Krutika Dhananjay <kdhananj@redhat.com> | 2017-05-05 14:30:49 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-05-10 12:33:53 +0000 | 
| commit | 9df83b504a01e86d3b73af6c40df0c94cd2cd97a (patch) | |
| tree | 5829d32cc5df0c8e7d311cc0dbc7f31a25a7b79c | |
| parent | 9bfb74a39954a7e63bfd762c816efc7e64b9df65 (diff) | |
features/shard: Set size in inode ctx before size update for truncate too
Change-Id: I7e984bb0f50c7d42764c0648e697d94d6c768dc7
BUG: 1448299
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: https://review.gluster.org/17184
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
| -rw-r--r-- | xlators/features/shard/src/shard.c | 14 | 
1 files changed, 8 insertions, 6 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index a48806c6a8b..eaeb840e86d 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -697,11 +697,6 @@ shard_update_file_size_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                  local->op_errno = ENOMEM;                  goto err;          } - -        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);          return 0; @@ -2010,6 +2005,7 @@ int  shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)  {          shard_local_t  *local            = NULL; +        struct iatt     tmp_stbuf        = {0,};          local = frame->local; @@ -2024,7 +2020,7 @@ shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)                  return 0;          } -        local->postbuf = local->prebuf; +        local->postbuf = tmp_stbuf = local->prebuf;          if (local->prebuf.ia_size == local->offset) {                  /* If the file size is same as requested size, unwind the call @@ -2046,6 +2042,9 @@ shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)                  local->delta_size = 0;                  local->delta_blocks = 0;                  local->postbuf.ia_size = local->offset; +                tmp_stbuf.ia_size = local->offset; +                shard_inode_ctx_set (local->loc.inode, this, &tmp_stbuf, 0, +                                     SHARD_INODE_WRITE_MASK);                  shard_update_file_size (frame, this, NULL, &local->loc,                                         shard_post_update_size_truncate_handler);          } else { @@ -2058,6 +2057,9 @@ shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)                  local->hole_size = 0;                  local->delta_size = (local->offset - local->prebuf.ia_size);                  local->delta_blocks = 0; +                tmp_stbuf.ia_size = local->offset; +                shard_inode_ctx_set (local->loc.inode, this, &tmp_stbuf, 0, +                                     SHARD_INODE_WRITE_MASK);                  shard_truncate_begin (frame, this);          }          return 0;  | 
