/* generic_file_read updates the atime of upper layer inode. But, it doesn't give us a chance to update the atime of the lower layer inode. This function is a wrapper to generic_file_read. It updates the atime of the lower level inode if generic_file_read returns without any errors. This is to be used only for file reads. The function to be used for directory reads is ecryptfs_read.  */
static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos)
/* generic_file_read updates the atime of upper layer inode. But, it doesn't give us a chance to update the atime of the lower layer inode. This function is a wrapper to generic_file_read. It updates the atime of the lower level inode if generic_file_read returns without any errors. This is to be used only for file reads. The function to be used for directory reads is ecryptfs_read.  */
static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos)
{
	int rc;
	struct dentry *lower_dentry;
	struct vfsmount *lower_vfsmount;
	struct file *file = iocb->ki_filp;
	rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
	if (-EIOCBQUEUED == rc)
		rc = wait_on_sync_kiocb(iocb);
	if (rc >= 0) {
		lower_dentry = ecryptfs_dentry_to_lower(file->f_path.dentry);
		lower_vfsmount = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry);
		touch_atime(lower_vfsmount, lower_dentry);
	}
	return rc;
}