@@ -44,6 +44,31 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
44
44
return rc ;
45
45
}
46
46
47
+ /*
48
+ * ecryptfs_splice_read_update_atime
49
+ *
50
+ * generic_file_splice_read updates the atime of upper layer inode. But, it
51
+ * doesn't give us a chance to update the atime of the lower layer inode. This
52
+ * function is a wrapper to generic_file_read. It updates the atime of the
53
+ * lower level inode if generic_file_read returns without any errors. This is
54
+ * to be used only for file reads. The function to be used for directory reads
55
+ * is ecryptfs_read.
56
+ */
57
+ static ssize_t ecryptfs_splice_read_update_atime (struct file * in , loff_t * ppos ,
58
+ struct pipe_inode_info * pipe ,
59
+ size_t len , unsigned int flags )
60
+ {
61
+ ssize_t rc ;
62
+ const struct path * path ;
63
+
64
+ rc = generic_file_splice_read (in , ppos , pipe , len , flags );
65
+ if (rc >= 0 ) {
66
+ path = ecryptfs_dentry_to_lower_path (in -> f_path .dentry );
67
+ touch_atime (path );
68
+ }
69
+ return rc ;
70
+ }
71
+
47
72
struct ecryptfs_getdents_callback {
48
73
struct dir_context ctx ;
49
74
struct dir_context * caller ;
@@ -414,5 +439,5 @@ const struct file_operations ecryptfs_main_fops = {
414
439
.release = ecryptfs_release ,
415
440
.fsync = ecryptfs_fsync ,
416
441
.fasync = ecryptfs_fasync ,
417
- .splice_read = generic_file_splice_read ,
442
+ .splice_read = ecryptfs_splice_read_update_atime ,
418
443
};
0 commit comments