From 3f7faa4d8d3af3d2e3889c23290b016f27d36386 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Wed, 7 Jan 2015 15:26:08 +0800 Subject: [PATCH] common: Directly return the result of syncfs(). In commit 808c644248e4, it will try sync() if syncfs() return error. No evidence prove this way can work. And sync() don't return result so make this function always return zero which cause filestore omit the error. Signed-off-by: Jianpeng Ma --- src/common/sync_filesystem.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/sync_filesystem.h b/src/common/sync_filesystem.h index 8882cbb1898..49283b3e0ae 100644 --- a/src/common/sync_filesystem.h +++ b/src/common/sync_filesystem.h @@ -34,12 +34,18 @@ inline int sync_filesystem(int fd) #ifdef HAVE_SYS_SYNCFS if (syncfs(fd) == 0) return 0; + else + return -errno; #elif defined(SYS_syncfs) if (syscall(SYS_syncfs, fd) == 0) return 0; + else + return -errno; #elif defined(__NR_syncfs) if (syscall(__NR_syncfs, fd) == 0) return 0; + else + return -errno; #endif #ifdef BTRFS_IOC_SYNC -- 2.47.3