From 25e0f8fb4d6e477bb2bc6d9b92ace6365f7615a6 Mon Sep 17 00:00:00 2001 From: chenjinhao <1195585098@qq.com> Date: Sat, 19 Apr 2025 13:43:49 +0800 Subject: [PATCH] shard: correct file-size xattr in fallocate request failure When the fallocate request to a file returns a failure, there may actually be data written to the backend bricks. So, we do need to refresh file-size xattr for such a file, in that case. Fixes: #4522 --- xlators/features/shard/src/shard.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 684d115cca..6922b2a0bc 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -5572,18 +5572,13 @@ shard_common_inode_write_do_cbk(call_frame_t *frame, void *cookie, call_count = shard_call_count_return(frame); if (call_count == 0) { SHARD_UNSET_ROOT_FS_ID(frame, local); - if (local->op_ret < 0) { - shard_common_failure_unwind(fop, frame, local->op_ret, - local->op_errno); - } else { - shard_get_delta_size_from_inode_ctx(local, local->fd->inode, this); - local->hole_size = 0; - if (xdata) - local->xattr_rsp = dict_ref(xdata); - shard_update_file_size( - frame, this, local->fd, NULL, - shard_common_inode_write_post_update_size_handler); - } + shard_get_delta_size_from_inode_ctx(local, local->fd->inode, this); + local->hole_size = 0; + if (xdata) + local->xattr_rsp = dict_ref(xdata); + shard_update_file_size( + frame, this, local->fd, NULL, + shard_common_inode_write_post_update_size_handler); } return 0;