Whamcloud - gitweb
b=18801
authoranserper <anserper>
Fri, 17 Jul 2009 16:04:06 +0000 (16:04 +0000)
committeranserper <anserper>
Fri, 17 Jul 2009 16:04:06 +0000 (16:04 +0000)
i=Johann Lombardi
i=Girish Shilamkar

mtime fix for dio

lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/llite/rw.c
lustre/tests/sanityN.sh

index f15857e..d4f3c2c 100644 (file)
@@ -976,6 +976,23 @@ LB_LINUX_TRY_COMPILE([
 EXTRA_KCFLAGS="$tmp_flags"
 ])
 
+# LC_FILE_UPDATE_TIME
+# 2.6.9 has inode_update_time instead of file_update_time
+AC_DEFUN([LC_FILE_UPDATE_TIME],
+[AC_MSG_CHECKING([if file_update_time is exported])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+        file_update_time(NULL);
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_FILE_UPDATE_TIME, 1,
+                [use file_update_time])
+],[
+       AC_MSG_RESULT(no)
+])
+])
+
 # LC_FILE_WRITEV
 # 2.6.19 replaced writev with aio_write
 AC_DEFUN([LC_FILE_WRITEV],
@@ -1887,6 +1904,7 @@ AC_DEFUN([LC_PROG_LINUX],
           # 2.6.19
           LC_INODE_BLKSIZE
           LC_VFS_READDIR_U64_INO
+          LC_FILE_UPDATE_TIME
           LC_FILE_WRITEV
           LC_FILE_READV
 
index 62eeb47..34ea09e 100644 (file)
@@ -615,5 +615,11 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount)
 #define bio_hw_segments(q, bio) 0
 #endif
 
+#ifdef HAVE_FILE_UPDATE_TIME
+#define ll_update_time(file) file_update_time(file)
+#else
+#define ll_update_time(file) inode_update_time(file->f_mapping->host, 1)
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _COMPAT25_H */
index 1487e57..d97ade6 100644 (file)
@@ -2379,6 +2379,8 @@ ssize_t ll_file_lockless_io(struct file *file, const struct iovec *iov,
         }
 
         if (file->f_flags & O_DIRECT) {
+                if (rw == WRITE)
+                        ll_update_time(file);
                 /* do not copy data for O_DIRECT */
                 rc = ll_direct_IO(rw, file, iov, *ppos, nr_segs, 0);
                 if (rc > 0)
index db77e5d..fcc3ccd 100644 (file)
@@ -841,6 +841,23 @@ test_37() { # bug 18695
 }
 run_test 37 "check i_size is not updated for directory on close (bug 18695) =============="
 
+test_39() {
+        local originaltime
+        local updatedtime
+        local delay=3
+
+        touch $DIR1/$tfile
+        originaltime=$(stat -c %Y $DIR1/$tfile)
+        log "original modification time is $originaltime"
+        sleep $delay
+        multiop $DIR1/$tfile oO_DIRECT:O_WRONLY:w$((10*1048576))c || error "multiop has failed"
+        updatedtime=$(stat -c %Y $DIR2/$tfile)
+        log "updated modification time is $updatedtime"
+        [ $((updatedtime - originaltime)) -ge $delay ] || error "invalid modification time"
+        rm -rf $DIR/$tfile
+}
+run_test 39 "direct I/O writes should update mtime ========="
+
 log "cleanup: ======================================================"
 
 check_and_cleanup_lustre