From 71641e36734c86ac14c62caf57301e2214712502 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 28 Jul 2015 18:38:56 +0530 Subject: features/shard: Fix block size get from xdata Instead of using dict_get_ptr, dict_get_uint64 was used. If the first byte of the value is '\0' then size is returned as 0 because strtoull is used in data_to_uint64. This will make it seem like the file is not sharded at all. BUG: 1247108 Change-Id: Id1fc291198ac94b20ae645c04a51db78bab51993 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/11778 Reviewed-by: Krutika Dhananjay Tested-by: NetBSD Build System Tested-by: Gluster Build System --- xlators/features/shard/src/shard.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators/features/shard/src/shard.c') diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 5c11eb4105d..96c06b1aeb9 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -557,6 +557,7 @@ shard_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, { int ret = 0; uint64_t size = 0; + void *bsize = NULL; void *size_attr = NULL; shard_inode_ctx_t ctx_tmp = {0,}; uint64_t size_array[4]; @@ -576,9 +577,9 @@ shard_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * already initialised to all zeroes, nothing more needs to be done. */ if (shard_inode_ctx_get_block_size (inode, this, &size)) { - ret = dict_get_uint64 (xdata, GF_XATTR_SHARD_BLOCK_SIZE, &size); + ret = dict_get_ptr (xdata, GF_XATTR_SHARD_BLOCK_SIZE, &bsize); if (!ret) { - ctx_tmp.block_size = ntoh64 (size); + ctx_tmp.block_size = ntoh64 (*((uint64_t *)bsize)); ctx_tmp.mode = st_mode_from_ia (buf->ia_prot, buf->ia_type); ctx_tmp.rdev = buf->ia_rdev; -- cgit