From patchwork Wed Feb 3 06:07:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8198601 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C4FFDBEEE5 for ; Wed, 3 Feb 2016 06:14:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9517201BB for ; Wed, 3 Feb 2016 06:14:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCA2620172 for ; Wed, 3 Feb 2016 06:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755902AbcBCGLO (ORCPT ); Wed, 3 Feb 2016 01:11:14 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35260 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933216AbcBCGLM (ORCPT ); Wed, 3 Feb 2016 01:11:12 -0500 Received: by mail-pf0-f193.google.com with SMTP id 66so535603pfe.2; Tue, 02 Feb 2016 22:11:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3z/iyI+v2Zmw3fFYrzQ7cAOr6a0tIbeBg/spWp0+5Vc=; b=c9z5wkVazv7u+VwgCVc2SgtVB9UG5QCLQMVZFSXip5nMKHpzB79YvkWv7f0059pfel Vbec/hh9qvhYiuSG3MNxq1zTltozq9Ntp8UaHg9Q++IB9jeOh9VFipe54tbhRFLBj9Fi bprio/p2OnEf3PLLP94jbxMuyx5gviQccQN/BS4Ouo55jZir/s6wNoq3D+u759trcYwu pBOKrCMHppIaEmX1j+4hgEKaBg0+mUjg+zfAA0bkM3Exw3KyNLQGPg8bDrTlBwzo2MEO BrqJSpuQz0ccQHVOm8UkhmiD4oqd1vWWOkEHzpODVKFA/7nAvrZ/ccTy2ecqMcyEdg1H hF1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3z/iyI+v2Zmw3fFYrzQ7cAOr6a0tIbeBg/spWp0+5Vc=; b=gEjYO5aOMzjhzfp6TxWDSJxh9tKded5gPMoUmjLHHT1lKBMX9/OGGARxUH1D/In/HP iNsqEoRBubTbUrrksT0PxtRiKUcgmLJG1qtRg4JOC9HJUglPWf5MrdEMKF61SCxhGKEu O2zL77WevPURNI6yVehM2ONGch8aONXy3VkJGCgaZC0rS8WHRgTCGh7+V2rcnMXqI2Hm CV77hcPZ/fNx8M1DDWH52JqsPk4OSn2kiHYD35YrKqyrxVvw2ynJiHIIGd7Wz2k23BLM /pTFxbLqKakdNzBeVaXmjbvJ+FLuMBR+3fZ7czpvNp5iEyLg8V+yCOV7VJV4wzJXsUYT SlBQ== X-Gm-Message-State: AG10YORHb0fDfLXJ9bEx9rU3gB++qHPrCs3g8t+Pds8uwCRxgLttUTQwNEzKbJyfXyHDgA== X-Received: by 10.98.15.82 with SMTP id x79mr54109367pfi.52.1454479871738; Tue, 02 Feb 2016 22:11:11 -0800 (PST) Received: from localhost.localdomain ([106.51.31.224]) by smtp.gmail.com with ESMTPSA id kw10sm6817612pab.0.2016.02.02.22.11.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Feb 2016 22:11:11 -0800 (PST) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org Cc: Arnd Bergmann , Dave Chinner , "Theodore Ts'o" , linux-kernel@vger.kernel.org, Alexander Viro Subject: [PATCH 02/10] vfs: Replace CURRENT_TIME by current_fs_time() Date: Tue, 2 Feb 2016 22:07:42 -0800 Message-Id: <1454479670-8204-3-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com> References: <1454479670-8204-1-git-send-email-deepa.kernel@gmail.com> 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.2 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=unavailable 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 The CURRENT_TIME macro is not sufficient for filesystem timestamps since it does not truncate the values according to filesystem granularity. simple_link(), simple_unlink() and simple_rename() only need a single call to current_fs_time() since they do not span filesystems. Signed-off-by: Deepa Dinamani Cc: Alexander Viro Cc: linux-fsdevel@vger.kernel.org --- fs/libfs.c | 21 +++++++++++++-------- fs/nsfs.c | 3 ++- fs/pipe.c | 3 ++- fs/posix_acl.c | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 0ca80b2..e3a8ed5 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -237,7 +237,7 @@ struct dentry *mount_pseudo(struct file_system_type *fs_type, char *name, */ root->i_ino = 1; root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; - root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; + root->i_atime = root->i_mtime = root->i_ctime = current_fs_time(s); dentry = __d_alloc(s, &d_name); if (!dentry) { iput(root); @@ -267,7 +267,8 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den { struct inode *inode = d_inode(old_dentry); - inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inode->i_ctime = dir->i_ctime = + dir->i_mtime = current_fs_time(dir->i_sb); inc_nlink(inode); ihold(inode); dget(dentry); @@ -301,7 +302,8 @@ int simple_unlink(struct inode *dir, struct dentry *dentry) { struct inode *inode = d_inode(dentry); - inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; + inode->i_ctime = dir->i_ctime = + dir->i_mtime = current_fs_time(dir->i_sb); drop_nlink(inode); dput(dentry); return 0; @@ -340,8 +342,9 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry, inc_nlink(new_dir); } - old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = - new_dir->i_mtime = inode->i_ctime = CURRENT_TIME; + old_dir->i_ctime = old_dir->i_mtime = + new_dir->i_ctime = new_dir->i_mtime = + inode->i_ctime = current_fs_time(inode->i_sb); return 0; } @@ -492,7 +495,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic, */ inode->i_ino = 1; inode->i_mode = S_IFDIR | 0755; - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_mtime = inode->i_ctime = current_fs_time(s); inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; set_nlink(inode, 2); @@ -518,7 +521,8 @@ int simple_fill_super(struct super_block *s, unsigned long magic, goto out; } inode->i_mode = S_IFREG | files->mode; - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_mtime = + inode->i_ctime = current_fs_time(s); inode->i_fop = files->ops; inode->i_ino = i; d_add(dentry, inode); @@ -1064,7 +1068,8 @@ struct inode *alloc_anon_inode(struct super_block *s) inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); inode->i_flags |= S_PRIVATE; - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_mtime = + inode->i_ctime = current_fs_time(inode->i_sb); return inode; } EXPORT_SYMBOL(alloc_anon_inode); diff --git a/fs/nsfs.c b/fs/nsfs.c index 8f20d60..f0e18b2 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -82,7 +82,8 @@ slow: return ERR_PTR(-ENOMEM); } inode->i_ino = ns->inum; - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; + inode->i_mtime = inode->i_atime = + inode->i_ctime = current_fs_time(inode->i_sb); inode->i_flags |= S_IMMUTABLE; inode->i_mode = S_IFREG | S_IRUGO; inode->i_fop = &ns_file_operations; diff --git a/fs/pipe.c b/fs/pipe.c index c1c1b26..ad3fc8d 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -699,7 +699,8 @@ static struct inode * get_pipe_inode(void) inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_mtime = + inode->i_ctime = current_fs_time(inode->i_sb); return inode; diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 711dd51..778a27e 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -859,7 +859,7 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type) acl = NULL; } - inode->i_ctime = CURRENT_TIME; + inode->i_ctime = current_fs_time(inode->i_sb); set_cached_acl(inode, type, acl); return 0; }