From patchwork Sun Jan 31 13:19:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 8174341 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D4ADB9F38B for ; Sun, 31 Jan 2016 13:20:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00E96202F0 for ; Sun, 31 Jan 2016 13:20:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2978220253 for ; Sun, 31 Jan 2016 13:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757480AbcAaNTx (ORCPT ); Sun, 31 Jan 2016 08:19:53 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:35492 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757450AbcAaNTw (ORCPT ); Sun, 31 Jan 2016 08:19:52 -0500 Received: by mail-lf0-f49.google.com with SMTP id l143so14213901lfe.2; Sun, 31 Jan 2016 05:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=bPzOJT2Vbpd6AlGo3kmDwksWCjuQTGfeJCPqbq2oCsA=; b=gTj3FmV9L/yxIywKK3NsHAz8QRq3nk15opvrXnXixJiTYA83LDrIo42ngrCjGx9AOy hPX4tQs753MDQms0l30mIbJG0W7SmopqCzYuwSjMzM33QRXZdebsdjxdFnzcXL2cEmfn KSCQwOBQQ5S53tqqDm5OSD03eU6c15vCZB6oy89zXUDYCaknfaCyLCELFGyFdc+mGEXg N2nPTThdn5WOqXoY3dFMHvXfe9H1Gcu+1GbfLmNEioe1lnOZ/zOuthOG8Wd1pnOMBir3 ci4tA9JNBWb0K3/yuVgMNJhWngsqGHf7YIZVgA/lBey9JAdKWePQlk38uhPkxOkLxf45 3ZOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=bPzOJT2Vbpd6AlGo3kmDwksWCjuQTGfeJCPqbq2oCsA=; b=d3SNJWr0f6x4p0+q3vdJmGZmStf+jMcuGYlfoCflNrgogo/7mpOL0AqPRUafCM46Za qrcd0sE2LxwGROqmqZ7uWNgZpzoRcFHCbywpbU/ihyV7fzhZ/khNdOPsFD3U2sZM23TO Ry5dajzAMgORC8nVj+AjXR0hej7HhZfAnL7TzO8A/KvJElf5ykom18Lp68l/tXS8Mcx+ Zo1eVUHOR07Qyisidr7TIqBVKr7sGblR3plcIv7A0XCFyis4H9h/gdLjAfZLAZKMbe+R ECCe+eS3mOYwcpNcghQOOWwOWet7VPaIDB4+1TWyW1lVTUsaqIvSavi6+OH8mvGtglRv v8xQ== X-Gm-Message-State: AG10YOQ4VLCYUipVqSFB/4S8NYxNZBuRNxyUhHKUj3GvxuDnJDdXsw7o98hXYZye3ojUuA== X-Received: by 10.25.205.81 with SMTP id d78mr6996333lfg.15.1454246390542; Sun, 31 Jan 2016 05:19:50 -0800 (PST) Received: from localhost (ppp79-139-147-94.pppoe.spdop.ru. [79.139.147.94]) by smtp.gmail.com with ESMTPSA id b5sm3239696lbc.14.2016.01.31.05.19.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Jan 2016 05:19:48 -0800 (PST) Subject: [PATCH] vfs: update atime using file->f_inode From: Konstantin Khlebnikov To: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, Alexander Viro Cc: linux-kernel@vger.kernel.org, Miklos Szeredi Date: Sun, 31 Jan 2016 16:19:46 +0300 Message-ID: <145424638614.10446.16013603987277558993.stgit@zurg> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes some cases of missing atime update for overlayfs. Signed-off-by: Konstantin Khlebnikov --- fs/inode.c | 15 +++++++++++++-- include/linux/fs.h | 6 +----- 2 files changed, 14 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/inode.c b/fs/inode.c index 9f62db3bcc3e..6a4dd94c0ea3 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1631,10 +1631,9 @@ bool atime_needs_update(const struct path *path, struct inode *inode) return true; } -void touch_atime(const struct path *path) +static void touch_inode_atime(const struct path *path, struct inode *inode) { struct vfsmount *mnt = path->mnt; - struct inode *inode = d_inode(path->dentry); struct timespec now; if (!atime_needs_update(path, inode)) @@ -1660,8 +1659,20 @@ void touch_atime(const struct path *path) skip_update: sb_end_write(inode->i_sb); } + +void touch_atime(const struct path *path) +{ + touch_inode_atime(path, d_inode(path->dentry)); +} EXPORT_SYMBOL(touch_atime); +void file_accessed(const struct file *file) +{ + if (!(file->f_flags & O_NOATIME)) + touch_inode_atime(&file->f_path, file_inode(file)); +} +EXPORT_SYMBOL(file_accessed); + /* * The logic we want is * diff --git a/include/linux/fs.h b/include/linux/fs.h index 1a2046275cdf..22c89094a7e3 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1951,11 +1951,7 @@ enum file_time_flags { extern bool atime_needs_update(const struct path *, struct inode *); extern void touch_atime(const struct path *); -static inline void file_accessed(struct file *file) -{ - if (!(file->f_flags & O_NOATIME)) - touch_atime(&file->f_path); -} +extern void file_accessed(const struct file *file); int sync_inode(struct inode *inode, struct writeback_control *wbc); int sync_inode_metadata(struct inode *inode, int wait);