Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp659269imp; Thu, 21 Feb 2019 08:38:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IaJpwEQhgXx9Vd36Z7q1x30BbMZeDZ+i1BLJT57vvKxlanyo9sdm28znmhGGgHfGQkWQbln X-Received: by 2002:a17:902:f83:: with SMTP id 3mr38230170plz.125.1550767114037; Thu, 21 Feb 2019 08:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550767114; cv=none; d=google.com; s=arc-20160816; b=b771P4pccOnXNlY8bvtrXpEEE2G9ZOzwpmpO31RpihGYwKYJHIyfbu22KstwuLzZ5f bu3VmjHwI2ld3F2mjqcAJz5GSJ3U1+wWqxMhdNscDMVTlHtz6wIyxx06dfWoFVUtoqdB xutsIXJTGg8nG9ZjW0bneddJKuFS6Ym8yctFqIuUC4P75/pgvfcpV5T2C+Tz52hKPyWm YdAiNu3GcF/YrJPpGLKDXiIKllGNzOnXFR4lKzkJ7hhehNXY/rvrtbY+t01Qg+47TNBl lOcJFzX8Ko/qko8kXPgiZkxJs2CrQrNSzUovRZzptvZk0R8SAizrmABcOZHk5TrCrrzK 3JRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=pabEVffLHyfT9+Gk+SQigQFIfsgJZ+T3RDsW3Yf6sas=; b=ZVrVu03r4XlqDJy6WrCV41mAxSO0BIdHsGBHbQREyOhKf70/WBmV1rN7oSQOijMRUm h/zRNukbIJwc2DkvxutJIAFpXkvLchQJvJtXAFa19MMaGB0gR5lsRjpEc81ddYf6Xnu5 xtc496S78glMO0XMjf6tmTyg8BgyhiGbCgFTyTCFw17U4jEjCKd4ColG1Tpl/Dspblz1 GwC7tOLY0fNQulOqsAKnfty/zXTFrdyBYuDLIJTFse069r66EvjFQmB2iVliRXk9nEAL yQqMRxNi5YcooAOt7cinPY6Vt24wmzfhS7XrQb+xog6cJis/nC2quDKbvt+QkR2xpYXe o89w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c13si15417512pgg.446.2019.02.21.08.38.18; Thu, 21 Feb 2019 08:38:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726805AbfBUQhc (ORCPT + 99 others); Thu, 21 Feb 2019 11:37:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38302 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbfBUQhb (ORCPT ); Thu, 21 Feb 2019 11:37:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95A6B811D3; Thu, 21 Feb 2019 16:37:31 +0000 (UTC) Received: from laptop.jcline.org (ovpn-124-228.rdu2.redhat.com [10.10.124.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67A4227C4B; Thu, 21 Feb 2019 16:37:31 +0000 (UTC) Received: from laptop.jcline.org.com (localhost [IPv6:::1]) by laptop.jcline.org (Postfix) with ESMTP id 86B437045B3B; Thu, 21 Feb 2019 11:37:30 -0500 (EST) From: Jeremy Cline To: Alexey Dobriyan Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jeremy Cline , David Both Subject: [PATCH] proc: update i_atime when reading files Date: Thu, 21 Feb 2019 11:37:14 -0500 Message-Id: <20190221163714.22330-1-jcline@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 21 Feb 2019 16:37:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Jeremy Cline --- 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