From b12ee8fbaf8f720f9072ea6b62bb844232870e6e Mon Sep 17 00:00:00 2001 From: Zhang Huan Date: Fri, 7 Mar 2014 11:08:47 +0800 Subject: storage/posix: fix issue in posix_fsync Fix the issue that posix_fsync does not correctly return and save error code in op_errno when call to sys_fdatasync fails. Change-Id: Id0b62cfa009dbb52c8a0992abd5c46330fa0a8c0 BUG: 1125814 Signed-off-by: Zhang Huan Reviewed-on: http://review.gluster.org/8398 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Santosh Pradhan Reviewed-by: Vijay Bellur --- xlators/storage/posix/src/posix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 5decac295ff..330fb74a550 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -2946,12 +2946,13 @@ posix_fsync (call_frame_t *frame, xlator_t *this, } if (datasync) { - ; op_ret = sys_fdatasync (_fd); if (op_ret == -1) { + op_errno = errno; gf_log (this->name, GF_LOG_ERROR, "fdatasync on fd=%p failed: %s", fd, strerror (errno)); + goto out; } } else { op_ret = sys_fsync (_fd); -- cgit