summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Huan <zhhuan@gmail.com>2014-03-07 11:08:47 +0800
committerVijay Bellur <vbellur@redhat.com>2014-08-01 16:38:18 -0700
commitb12ee8fbaf8f720f9072ea6b62bb844232870e6e (patch)
tree4032d33da4745f46dd98e7c8abe4000e9e6e86e2
parent590006d824f4051acdccbe59415fc4772e3caa2f (diff)
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 <zhhuan@gmail.com> Reviewed-on: http://review.gluster.org/8398 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Santosh Pradhan <spradhan@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/storage/posix/src/posix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 5decac2..330fb74 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);