mmap: update atime upon successful file reading (via mmap or otherwise)
authorErez_Zadok <ezk@cs.sunysb.edu>
Sun, 6 May 2007 00:41:46 +0000 (20:41 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 23 Feb 2014 19:02:43 +0000 (14:02 -0500)
fs/unionfs/file.c
fs/unionfs/mmap.c

index c4deba619237a27de3b5c34ac2102cf9dc42974e..1c20844e705a24aebd25ac55cadeeea667db1463 100644 (file)
@@ -33,12 +33,9 @@ static ssize_t unionfs_read(struct file *file, char __user *buf,
 
        err = do_sync_read(file, buf, count, ppos);
 
-#if 0
-       FIXME: do_sync_read updates a time
        if (err >= 0)
                touch_atime(unionfs_lower_mnt(file->f_path.dentry),
-                               unionfs_lower_dentry(file->f_path.dentry));
-#endif
+                           unionfs_lower_dentry(file->f_path.dentry));
 
 out:
        unionfs_read_unlock(file->f_dentry->d_sb);
@@ -56,12 +53,9 @@ static ssize_t unionfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
        if (err == -EIOCBQUEUED)
                err = wait_on_sync_kiocb(iocb);
 
-#if 0
-       XXX: is this needed?
        if (err >= 0)
                touch_atime(unionfs_lower_mnt(iocb->ki_filp->f_path.dentry),
-                               unionfs_lower_dentry(iocb->ki_filp->f_path.dentry));
-#endif
+                           unionfs_lower_dentry(iocb->ki_filp->f_path.dentry));
 
 #if 0
 out:
index ade8c926b26fd4de7bb6bb768d7465898119ef43..7d1e2f70af1e994a297994a79acdd35ec55032f9 100644 (file)
@@ -168,6 +168,10 @@ int unionfs_readpage(struct file *file, struct page *page)
 
        err = unionfs_do_readpage(file, page);
 
+       if (!err)
+               touch_atime(unionfs_lower_mnt(file->f_path.dentry),
+                           unionfs_lower_dentry(file->f_path.dentry));
+
        /*
         * we have to unlock our page, b/c we _might_ have gotten a locked
         * page.  but we no longer have to wakeup on our page here, b/c