Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1360015 > unrolled thread

Re: [PATCH] vfs: update atime using file->f_inode

Started byMiklos Szeredi <miklos@szeredi.hu>
First post2016-03-17 17:40 +0100
Last post2016-03-17 17:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] vfs: update atime using file->f_inode Miklos Szeredi <miklos@szeredi.hu> - 2016-03-17 17:40 +0100

#1360015 — Re: [PATCH] vfs: update atime using file->f_inode

FromMiklos Szeredi <miklos@szeredi.hu>
Date2016-03-17 17:40 +0100
SubjectRe: [PATCH] vfs: update atime using file->f_inode
Message-ID<rdJ7Q-1lp-11@gated-at.bofh.it>
On Sun, Jan 31, 2016 at 04:19:46PM +0300, Konstantin Khlebnikov wrote:
> This fixes some cases of missing atime update for overlayfs.

Problem is it will update atime on lower layer, even if it's explicitly marked
read-only.  Which I think is a pretty bad breakage of assumptions.

The following patch updates atime (untested) but only in the upper layer.
Obviously it makes no sense to copy-up due to an atime update.

Thanks,
Miklos
---
 fs/overlayfs/inode.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -370,6 +370,27 @@ struct inode *ovl_d_select_inode(struct
 	return d_backing_inode(realpath.dentry);
 }
 
+static int ovl_update_time(struct inode *inode, struct timespec *ts, int flags)
+{
+	struct dentry *alias;
+	struct path upperpath;
+
+	if (!(flags & S_ATIME))
+		return 0;
+
+	alias = d_find_any_alias(inode);
+	if (!alias)
+		return 0;
+
+	ovl_path_upper(alias, &upperpath);
+	if (!upperpath.dentry)
+		return 0;
+
+	touch_atime(&upperpath);
+
+	return 0;
+}
+
 static const struct inode_operations ovl_file_inode_operations = {
 	.setattr	= ovl_setattr,
 	.permission	= ovl_permission,
@@ -378,6 +399,7 @@ static const struct inode_operations ovl
 	.getxattr	= ovl_getxattr,
 	.listxattr	= ovl_listxattr,
 	.removexattr	= ovl_removexattr,
+	.update_time	= ovl_update_time,
 };
 
 static const struct inode_operations ovl_symlink_inode_operations = {

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web