From: Jeremy Cline <jcline@redhat.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeremy Cline <jcline@redhat.com>,
David Both <dboth@millennium-technology.com>
Subject: [PATCH] proc: update i_atime when reading files
Date: Thu, 21 Feb 2019 11:37:14 -0500 [thread overview]
Message-ID: <20190221163714.22330-1-jcline@redhat.com> (raw)
Prior to commit 1da4d377f943 ("proc: revalidate misc dentries"), the
access, modify, and change times of files in /proc were just the current
time. Now the mtime and ctime values change mostly as a user would
expect, but the atime isn't updated when the file read. This patch
updates the access time of /proc files when they are read.
Reported-by: David Both <dboth@millennium-technology.com>
Signed-off-by: Jeremy Cline <jcline@redhat.com>
---
fs/proc/inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index da649ccd6804..34d8603b9aa1 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -221,12 +221,17 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence)
static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
- struct proc_dir_entry *pde = PDE(file_inode(file));
+ struct inode *inode = file_inode(file);
+ struct proc_dir_entry *pde = PDE(inode);
ssize_t rv = -EIO;
if (use_pde(pde)) {
read = pde->proc_fops->read;
- if (read)
+ if (read) {
rv = read(file, buf, count, ppos);
+ if (rv >= 0)
+ inode->i_atime = current_time(inode);
+ }
+
unuse_pde(pde);
}
return rv;
--
2.20.1
next reply other threads:[~2019-02-21 16:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 16:37 Jeremy Cline [this message]
2019-02-22 5:37 ` [PATCH] proc: update i_atime when reading files Alexey Dobriyan
2019-02-22 15:00 ` Jeremy Cline
2019-02-25 19:47 ` Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190221163714.22330-1-jcline@redhat.com \
--to=jcline@redhat.com \
--cc=adobriyan@gmail.com \
--cc=dboth@millennium-technology.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).