From f367671d451ae0fc3e178d26cae1880d59eb6ebd Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Thu, 6 Jul 2017 16:40:07 +0530 Subject: cluster/ec: Get size of file in EC [f]xattrop Problem: For allowing parallel writes we shouldn't depend on ia_size to be same for all the bricks in each write_cbk(). But we need to make sure backend size is correct on all the bricks and no crashes/manual modifications happened. Fix: At the time of get_size_version() we do 1 check to make sure size of the file is same across the bricks. From then on the FOPs will give the status of the fop, so we rely on this information to keep which bricks are good/bad. Updates #251 Change-Id: I1df645347e2e9f2e09cfa4411b6cc305d7f4e4e5 Signed-off-by: Pranith Kumar K Reviewed-on: https://review.gluster.org/17741 Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Xavier Hernandez --- xlators/storage/posix/src/posix-helpers.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xlators/storage/posix/src') diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 649107d8cac..8c1a789f70b 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -515,6 +515,11 @@ _posix_xattr_get_set (dict_t *xattr_req, char *key, data_t *data, } else if (strcmp(key, GF_REQUEST_LINK_COUNT_XDATA) == 0) { ret = dict_set (filler->xattr, GF_REQUEST_LINK_COUNT_XDATA, data); + } else if (strcmp (key, GF_GET_SIZE) == 0) { + if (filler->stbuf && IA_ISREG (filler->stbuf->ia_type)) { + ret = dict_set_uint64 (filler->xattr, GF_GET_SIZE, + filler->stbuf->ia_size); + } } else { ret = _posix_xattr_get_set_from_backend (filler, key); } -- cgit