linux: fsync on a directory should return 0, not EINVAL
authorGeoffrey Thomas <geofft@ldpreload.com>
Sun, 1 Jan 2012 00:51:29 +0000 (19:51 -0500)
committerDerrick Brashear <shadow@dementix.org>
Tue, 3 Jan 2012 15:26:06 +0000 (07:26 -0800)
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 <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

acinclude.m4
src/afs/LINUX/osi_vnodeops.c

index 2a4026a..81d22aa 100644 (file)
@@ -897,6 +897,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([zero_user_segments],
                                     [#include <linux/highmem.h>],
                                     [zero_user_segments(NULL, 0, 0, 0, 0);])
+                AC_CHECK_LINUX_FUNC([noop_fsync],
+                                    [#include <linux/fs.h>],
+                                    [noop_fsync(NULL, 0, 0, 0);])
 
                 dnl Consequences - things which get set as a result of the
                 dnl                above tests
index 18be0ff..c379f67 100644 (file)
@@ -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 = {