Skip to content

Instantly share code, notes, and snippets.

@aszlig
Created March 14, 2019 00:31
Show Gist options
  • Save aszlig/f3679a5fec5a3b94b74a1fe62c651174 to your computer and use it in GitHub Desktop.
Save aszlig/f3679a5fec5a3b94b74a1fe62c651174 to your computer and use it in GitHub Desktop.
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 84dd957efa24..531bb3a86bcc 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -29,10 +29,14 @@ static struct file *ovl_open_realfile(const struct file *file,
struct inode *inode = file_inode(file);
struct file *realfile;
const struct cred *old_cred;
+ int flags = file->f_flags;
+
+ if (inode_owner_or_capable(realinode))
+ flags |= O_NOATIME;
old_cred = ovl_override_creds(inode->i_sb);
- realfile = open_with_fake_path(&file->f_path, file->f_flags | O_NOATIME,
- realinode, current_cred());
+ realfile = open_with_fake_path(&file->f_path, flags, realinode,
+ current_cred());
revert_creds(old_cred);
pr_debug("open(%p[%pD2/%c], 0%o) -> (%p, 0%o)\n",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment