Skip to content

Commit

Permalink
common/syncfs: fall back to sync(2) if syncfs(2) not available
Browse files Browse the repository at this point in the history
Fixes: #12512
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 08210d6)

Conflicts:
	src/common/sync_filesystem.h
          - master does not have #ifdef BTRFS_IOC_SYNC
          - firefly does not have else return -errno clauses in #ifdef HAVE_SYS_SYNCFS
  • Loading branch information
tchaikov authored and smithfarm committed Aug 10, 2015
1 parent abe6c03 commit 85ed3d8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/common/sync_filesystem.h
Expand Up @@ -47,6 +47,14 @@ inline int sync_filesystem(int fd)
return 0;
#endif

#if defined(HAVE_SYS_SYNCFS) || defined(SYS_syncfs) || defined(__NR_syncfs)
else if (errno == ENOSYS) {
sync();
return 0;
} else {
return -errno;
}
#else
sync();
return 0;
}
Expand Down

0 comments on commit 85ed3d8

Please sign in to comment.