From: Sage Weil Date: Sun, 25 Nov 2012 21:29:52 +0000 (-0800) Subject: syncfs: check for __NR_syncfs too X-Git-Tag: v0.55~54 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc32fc42d2bb38c300f65d577ab105f02cc50571;p=ceph.git syncfs: check for __NR_syncfs too Also make the filestore startup tell us *all* variants that are supported, not just the first one. Tested-by: Stefan Priebe Signed-off-by: Sage Weil --- diff --git a/src/common/sync_filesystem.h b/src/common/sync_filesystem.h index dc90b890c93c..5b23576ff4cd 100644 --- a/src/common/sync_filesystem.h +++ b/src/common/sync_filesystem.h @@ -41,6 +41,11 @@ inline int sync_filesystem(int fd) return 0; #endif +#ifdef __NR_syncfs + if (syscall(__NR_syncfs, fd) == 0) + return 0; +#endif + #ifdef BTRFS_IOC_SYNC if (::ioctl(fd, BTRFS_IOC_SYNC) == 0) return 0; diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 1d6797c2b321..70eef5ae13f6 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -1227,7 +1227,7 @@ int FileStore::_detect_fs() } else { dout(0) << "mount syncfs(2) syscall supported by glibc BUT NOT the kernel" << dendl; } -#else +#endif #ifdef SYS_syncfs if (syscall(SYS_syncfs, fd) == 0) { dout(0) << "mount syscall(SYS_syncfs, fd) fully supported" << dendl; @@ -1235,11 +1235,17 @@ int FileStore::_detect_fs() } else { dout(0) << "mount syscall(SYS_syncfs, fd) supported by libc BUT NOT the kernel" << dendl; } -#else - dout(0) << "mount syncfs(2) syscall not support by glibc" << dendl; #endif +#ifdef __NR_syncfs + if (syscall(__NR_syncfs, fd) == 0) { + dout(0) << "mount syscall(__NR_syncfs, fd) fully supported" << dendl; + have_syncfs = true; + } else { + dout(0) << "mount syscall(__NR_syncfs, fd) supported by libc BUT NOT the kernel" << dendl; + } #endif if (!have_syncfs) { + dout(0) << "mount syncfs(2) syscall not supported" << dendl; if (btrfs) { dout(0) << "mount no syncfs(2), but the btrfs SYNC ioctl will suffice" << dendl; } else if (m_filestore_fsync_flushes_journal_data) {