From 267934d0e6910c8d8166a6e78f93c1bab40857b8 Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Sat, 31 Dec 2011 19:51:29 -0500 Subject: [PATCH] linux: fsync on a directory should return 0, not EINVAL Directory writes are synchronous, so this is fine. There's a mostly-convenient function in fs/libfs.c that returns 0 that we can use to do what we want ("mostly" because it was renamed in 2.6.35). FIXES 130425 Change-Id: I9a2af60ed3152be036f0145c94152d8cff2e1242 Reviewed-on: http://gerrit.openafs.org/6491 Reviewed-by: Simon Wilkinson Tested-by: BuildBot Reviewed-by: Derrick Brashear --- acinclude.m4 | 3 +++ src/afs/LINUX/osi_vnodeops.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 2a4026a..81d22aa 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -897,6 +897,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_FUNC([zero_user_segments], [#include ], [zero_user_segments(NULL, 0, 0, 0, 0);]) + AC_CHECK_LINUX_FUNC([noop_fsync], + [#include ], + [noop_fsync(NULL, 0, 0, 0);]) dnl Consequences - things which get set as a result of the dnl above tests diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 18be0ff..c379f67 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -733,6 +733,11 @@ struct file_operations afs_dir_fops = { .open = afs_linux_open, .release = afs_linux_release, .llseek = default_llseek, +#ifdef HAVE_LINUX_NOOP_FSYNC + .fsync = noop_fsync, +#else + .fsync = simple_sync_file, +#endif }; struct file_operations afs_file_fops = { -- 1.9.4