|
|
21ab4e |
From 2ad5156aac58c366c96cdf7cc16b3ff054283357 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Krutika Dhananjay <kdhananj@redhat.com>
|
|
|
21ab4e |
Date: Fri, 5 May 2017 14:30:49 +0530
|
|
|
21ab4e |
Subject: [PATCH 427/473] features/shard: Set size in inode ctx before size
|
|
|
21ab4e |
update for truncate too
|
|
|
21ab4e |
|
|
|
21ab4e |
Backport of: https://review.gluster.org/17184
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: I92ef77b50bf3d26e820afadb21f9da85e1d28af3
|
|
|
21ab4e |
BUG: 1447959
|
|
|
21ab4e |
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/105871
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/features/shard/src/shard.c | 14 ++++++++------
|
|
|
21ab4e |
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
|
|
|
21ab4e |
index 4dd581d..bbd566a 100644
|
|
|
21ab4e |
--- a/xlators/features/shard/src/shard.c
|
|
|
21ab4e |
+++ b/xlators/features/shard/src/shard.c
|
|
|
21ab4e |
@@ -697,11 +697,6 @@ shard_update_file_size_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
21ab4e |
local->op_errno = ENOMEM;
|
|
|
21ab4e |
goto err;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
-
|
|
|
21ab4e |
- if (local->fop == GF_FOP_FTRUNCATE || local->fop == GF_FOP_TRUNCATE)
|
|
|
21ab4e |
- shard_inode_ctx_set (inode, this, &local->postbuf, 0,
|
|
|
21ab4e |
- SHARD_INODE_WRITE_MASK);
|
|
|
21ab4e |
-
|
|
|
21ab4e |
err:
|
|
|
21ab4e |
local->post_update_size_handler (frame, this);
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
@@ -2010,6 +2005,7 @@ int
|
|
|
21ab4e |
shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
shard_local_t *local = NULL;
|
|
|
21ab4e |
+ struct iatt tmp_stbuf = {0,};
|
|
|
21ab4e |
|
|
|
21ab4e |
local = frame->local;
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -2024,7 +2020,7 @@ shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- local->postbuf = local->prebuf;
|
|
|
21ab4e |
+ local->postbuf = tmp_stbuf = local->prebuf;
|
|
|
21ab4e |
|
|
|
21ab4e |
if (local->prebuf.ia_size == local->offset) {
|
|
|
21ab4e |
/* If the file size is same as requested size, unwind the call
|
|
|
21ab4e |
@@ -2046,6 +2042,9 @@ shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)
|
|
|
21ab4e |
local->delta_size = 0;
|
|
|
21ab4e |
local->delta_blocks = 0;
|
|
|
21ab4e |
local->postbuf.ia_size = local->offset;
|
|
|
21ab4e |
+ tmp_stbuf.ia_size = local->offset;
|
|
|
21ab4e |
+ shard_inode_ctx_set (local->loc.inode, this, &tmp_stbuf, 0,
|
|
|
21ab4e |
+ SHARD_INODE_WRITE_MASK);
|
|
|
21ab4e |
shard_update_file_size (frame, this, NULL, &local->loc,
|
|
|
21ab4e |
shard_post_update_size_truncate_handler);
|
|
|
21ab4e |
} else {
|
|
|
21ab4e |
@@ -2058,6 +2057,9 @@ shard_post_lookup_truncate_handler (call_frame_t *frame, xlator_t *this)
|
|
|
21ab4e |
local->hole_size = 0;
|
|
|
21ab4e |
local->delta_size = (local->offset - local->prebuf.ia_size);
|
|
|
21ab4e |
local->delta_blocks = 0;
|
|
|
21ab4e |
+ tmp_stbuf.ia_size = local->offset;
|
|
|
21ab4e |
+ shard_inode_ctx_set (local->loc.inode, this, &tmp_stbuf, 0,
|
|
|
21ab4e |
+ SHARD_INODE_WRITE_MASK);
|
|
|
21ab4e |
shard_truncate_begin (frame, this);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
return 0;
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|