summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-10-10 23:16:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-10 23:16:43 -0400
commit101105b1717f536ca741f940033996302d4ef191 (patch)
tree12ab41ae1b1b66105e9fa2ea763356d2be7e8b34 /fs
parent35ff96dfd3c9aaa921b3e8dcac76b7697f2dcec0 (diff)
parent3873691e5ab34fa26948643d038a2b98c4437298 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more vfs updates from Al Viro: ">rename2() work from Miklos + current_time() from Deepa" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: Replace current_fs_time() with current_time() fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps fs: Replace CURRENT_TIME with current_time() for inode timestamps fs: proc: Delete inode time initializations in proc_alloc_inode() vfs: Add current_time() api vfs: add note about i_op->rename changes to porting fs: rename "rename2" i_op to "rename" vfs: remove unused i_op->rename fs: make remaining filesystems use .rename2 libfs: support RENAME_NOREPLACE in simple_rename() fs: support RENAME_NOREPLACE for local filesystems ncpfs: fix unused variable warning
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/v9fs.h3
-rw-r--r--fs/9p/vfs_inode.c8
-rw-r--r--fs/adfs/inode.c2
-rw-r--r--fs/affs/affs.h3
-rw-r--r--fs/affs/amigaffs.c6
-rw-r--r--fs/affs/inode.c2
-rw-r--r--fs/affs/namei.c6
-rw-r--r--fs/afs/dir.c9
-rw-r--r--fs/attr.c2
-rw-r--r--fs/autofs4/inode.c2
-rw-r--r--fs/autofs4/root.c6
-rw-r--r--fs/bad_inode.c4
-rw-r--r--fs/bfs/dir.c20
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/btrfs/file.c6
-rw-r--r--fs/btrfs/inode.c24
-rw-r--r--fs/btrfs/ioctl.c8
-rw-r--r--fs/btrfs/transaction.c4
-rw-r--r--fs/btrfs/xattr.c2
-rw-r--r--fs/cachefiles/namei.c3
-rw-r--r--fs/ceph/dir.c6
-rw-r--r--fs/ceph/file.c4
-rw-r--r--fs/ceph/inode.c2
-rw-r--r--fs/ceph/xattr.c2
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/cifs/file.c4
-rw-r--r--fs/coda/dir.c8
-rw-r--r--fs/coda/file.c2
-rw-r--r--fs/coda/inode.c2
-rw-r--r--fs/configfs/inode.c6
-rw-r--r--fs/debugfs/inode.c4
-rw-r--r--fs/devpts/inode.c6
-rw-r--r--fs/ecryptfs/inode.c6
-rw-r--r--fs/efivarfs/inode.c2
-rw-r--r--fs/exofs/dir.c6
-rw-r--r--fs/exofs/inode.c4
-rw-r--r--fs/exofs/namei.c14
-rw-r--r--fs/ext2/acl.c2
-rw-r--r--fs/ext2/dir.c6
-rw-r--r--fs/ext2/ialloc.c2
-rw-r--r--fs/ext2/inode.c4
-rw-r--r--fs/ext2/ioctl.c4
-rw-r--r--fs/ext2/namei.c12
-rw-r--r--fs/ext2/super.c2
-rw-r--r--fs/ext2/xattr.c2
-rw-r--r--fs/ext4/namei.c2
-rw-r--r--fs/f2fs/dir.c8
-rw-r--r--fs/f2fs/file.c8
-rw-r--r--fs/f2fs/inline.c2
-rw-r--r--fs/f2fs/namei.c14
-rw-r--r--fs/f2fs/xattr.c2
-rw-r--r--fs/fat/dir.c2
-rw-r--r--fs/fat/file.c6
-rw-r--r--fs/fat/inode.c2
-rw-r--r--fs/fat/namei_msdos.c18
-rw-r--r--fs/fat/namei_vfat.c16
-rw-r--r--fs/fuse/control.c2
-rw-r--r--fs/fuse/dir.c4
-rw-r--r--fs/gfs2/bmap.c8
-rw-r--r--fs/gfs2/dir.c12
-rw-r--r--fs/gfs2/inode.c10
-rw-r--r--fs/gfs2/quota.c2
-rw-r--r--fs/gfs2/xattr.c8
-rw-r--r--fs/hfs/catalog.c8
-rw-r--r--fs/hfs/dir.c8
-rw-r--r--fs/hfs/inode.c2
-rw-r--r--fs/hfsplus/catalog.c8
-rw-r--r--fs/hfsplus/dir.c12
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hfsplus/ioctl.c2
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hpfs/namei.c6
-rw-r--r--fs/hugetlbfs/inode.c10
-rw-r--r--fs/inode.c29
-rw-r--r--fs/jffs2/acl.c2
-rw-r--r--fs/jffs2/dir.c9
-rw-r--r--fs/jffs2/fs.c2
-rw-r--r--fs/jfs/acl.c2
-rw-r--r--fs/jfs/inode.c2
-rw-r--r--fs/jfs/jfs_inode.c2
-rw-r--r--fs/jfs/namei.c29
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/jfs/xattr.c2
-rw-r--r--fs/kernfs/dir.c6
-rw-r--r--fs/kernfs/inode.c2
-rw-r--r--fs/libfs.c20
-rw-r--r--fs/locks.c2
-rw-r--r--fs/logfs/dir.c12
-rw-r--r--fs/logfs/file.c2
-rw-r--r--fs/logfs/inode.c4
-rw-r--r--fs/logfs/readwrite.c4
-rw-r--r--fs/minix/bitmap.c2
-rw-r--r--fs/minix/dir.c6
-rw-r--r--fs/minix/itree_common.c4
-rw-r--r--fs/minix/namei.c10
-rw-r--r--fs/namei.c15
-rw-r--r--fs/ncpfs/dir.c11
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/internal.h3
-rw-r--r--fs/nfsd/blocklayout.c2
-rw-r--r--fs/nilfs2/dir.c6
-rw-r--r--fs/nilfs2/inode.c4
-rw-r--r--fs/nilfs2/ioctl.c2
-rw-r--r--fs/nilfs2/namei.c12
-rw-r--r--fs/nsfs.c2
-rw-r--r--fs/ntfs/inode.c2
-rw-r--r--fs/ntfs/mft.c2
-rw-r--r--fs/ocfs2/acl.c2
-rw-r--r--fs/ocfs2/alloc.c2
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/dir.c4
-rw-r--r--fs/ocfs2/dlmfs/dlmfs.c4
-rw-r--r--fs/ocfs2/file.c12
-rw-r--r--fs/ocfs2/move_extents.c2
-rw-r--r--fs/ocfs2/namei.c16
-rw-r--r--fs/ocfs2/refcounttree.c4
-rw-r--r--fs/ocfs2/xattr.c2
-rw-r--r--fs/omfs/dir.c10
-rw-r--r--fs/omfs/inode.c2
-rw-r--r--fs/openpromfs/inode.c2
-rw-r--r--fs/orangefs/file.c2
-rw-r--r--fs/orangefs/inode.c2
-rw-r--r--fs/orangefs/namei.c16
-rw-r--r--fs/overlayfs/dir.c2
-rw-r--r--fs/overlayfs/overlayfs.h4
-rw-r--r--fs/pipe.c2
-rw-r--r--fs/posix_acl.c2
-rw-r--r--fs/proc/base.c2
-rw-r--r--fs/proc/inode.c3
-rw-r--r--fs/proc/proc_sysctl.c2
-rw-r--r--fs/proc/self.c2
-rw-r--r--fs/proc/thread_self.c2
-rw-r--r--fs/pstore/inode.c2
-rw-r--r--fs/ramfs/inode.c6
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/reiserfs/ioctl.c4
-rw-r--r--fs/reiserfs/namei.c18
-rw-r--r--fs/reiserfs/stree.c8
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--fs/reiserfs/xattr.c6
-rw-r--r--fs/reiserfs/xattr_acl.c2
-rw-r--r--fs/sysv/dir.c6
-rw-r--r--fs/sysv/ialloc.c2
-rw-r--r--fs/sysv/itree.c4
-rw-r--r--fs/sysv/namei.c10
-rw-r--r--fs/tracefs/inode.c2
-rw-r--r--fs/ubifs/dir.c8
-rw-r--r--fs/udf/ialloc.c2
-rw-r--r--fs/udf/inode.c4
-rw-r--r--fs/udf/namei.c26
-rw-r--r--fs/ufs/dir.c6
-rw-r--r--fs/ufs/ialloc.c2
-rw-r--r--fs/ufs/inode.c6
-rw-r--r--fs/ufs/namei.c12
-rw-r--r--fs/xfs/xfs_acl.c2
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_iops.c6
-rw-r--r--fs/xfs/xfs_trans_inode.c2
158 files changed, 520 insertions, 381 deletions
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 6877050384a1..443d12e02043 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -148,7 +148,8 @@ extern struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
148extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d); 148extern int v9fs_vfs_unlink(struct inode *i, struct dentry *d);
149extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d); 149extern int v9fs_vfs_rmdir(struct inode *i, struct dentry *d);
150extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, 150extern int v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
151 struct inode *new_dir, struct dentry *new_dentry); 151 struct inode *new_dir, struct dentry *new_dentry,
152 unsigned int flags);
152extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses, 153extern struct inode *v9fs_inode_from_fid(struct v9fs_session_info *v9ses,
153 struct p9_fid *fid, 154 struct p9_fid *fid,
154 struct super_block *sb, int new); 155 struct super_block *sb, int new);
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index aa639bb1f289..30ca770c5e0b 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -276,7 +276,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
276 inode_init_owner(inode, NULL, mode); 276 inode_init_owner(inode, NULL, mode);
277 inode->i_blocks = 0; 277 inode->i_blocks = 0;
278 inode->i_rdev = rdev; 278 inode->i_rdev = rdev;
279 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 279 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
280 inode->i_mapping->a_ops = &v9fs_addr_operations; 280 inode->i_mapping->a_ops = &v9fs_addr_operations;
281 281
282 switch (mode & S_IFMT) { 282 switch (mode & S_IFMT) {
@@ -955,7 +955,8 @@ int v9fs_vfs_rmdir(struct inode *i, struct dentry *d)
955 955
956int 956int
957v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, 957v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
958 struct inode *new_dir, struct dentry *new_dentry) 958 struct inode *new_dir, struct dentry *new_dentry,
959 unsigned int flags)
959{ 960{
960 int retval; 961 int retval;
961 struct inode *old_inode; 962 struct inode *old_inode;
@@ -966,6 +967,9 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
966 struct p9_fid *newdirfid; 967 struct p9_fid *newdirfid;
967 struct p9_wstat wstat; 968 struct p9_wstat wstat;
968 969
970 if (flags)
971 return -EINVAL;
972
969 p9_debug(P9_DEBUG_VFS, "\n"); 973 p9_debug(P9_DEBUG_VFS, "\n");
970 retval = 0; 974 retval = 0;
971 old_inode = d_inode(old_dentry); 975 old_inode = d_inode(old_dentry);
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index f57baaa511aa..8dbd36f5e581 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -199,7 +199,7 @@ adfs_adfs2unix_time(struct timespec *tv, struct inode *inode)
199 return; 199 return;
200 200
201 cur_time: 201 cur_time:
202 *tv = CURRENT_TIME; 202 *tv = current_time(inode);
203 return; 203 return;
204 204
205 too_early: 205 too_early:
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index cc2b2efc9211..2f088773f1c0 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -173,7 +173,8 @@ extern int affs_link(struct dentry *olddentry, struct inode *dir,
173extern int affs_symlink(struct inode *dir, struct dentry *dentry, 173extern int affs_symlink(struct inode *dir, struct dentry *dentry,
174 const char *symname); 174 const char *symname);
175extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry, 175extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry,
176 struct inode *new_dir, struct dentry *new_dentry); 176 struct inode *new_dir, struct dentry *new_dentry,
177 unsigned int flags);
177 178
178/* inode.c */ 179/* inode.c */
179 180
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index d8f217c711d3..0ec65c133b93 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -58,7 +58,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
58 mark_buffer_dirty_inode(dir_bh, dir); 58 mark_buffer_dirty_inode(dir_bh, dir);
59 affs_brelse(dir_bh); 59 affs_brelse(dir_bh);
60 60
61 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 61 dir->i_mtime = dir->i_ctime = current_time(dir);
62 dir->i_version++; 62 dir->i_version++;
63 mark_inode_dirty(dir); 63 mark_inode_dirty(dir);
64 64
@@ -112,7 +112,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
112 112
113 affs_brelse(bh); 113 affs_brelse(bh);
114 114
115 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 115 dir->i_mtime = dir->i_ctime = current_time(dir);
116 dir->i_version++; 116 dir->i_version++;
117 mark_inode_dirty(dir); 117 mark_inode_dirty(dir);
118 118
@@ -313,7 +313,7 @@ affs_remove_header(struct dentry *dentry)
313 else 313 else
314 clear_nlink(inode); 314 clear_nlink(inode);
315 affs_unlock_link(inode); 315 affs_unlock_link(inode);
316 inode->i_ctime = CURRENT_TIME_SEC; 316 inode->i_ctime = current_time(inode);
317 mark_inode_dirty(inode); 317 mark_inode_dirty(inode);
318 318
319done: 319done:
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 1aa243502c7f..fe4e1290dbb5 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -309,7 +309,7 @@ affs_new_inode(struct inode *dir)
309 inode->i_gid = current_fsgid(); 309 inode->i_gid = current_fsgid();
310 inode->i_ino = block; 310 inode->i_ino = block;
311 set_nlink(inode, 1); 311 set_nlink(inode, 1);
312 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 312 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
313 atomic_set(&AFFS_I(inode)->i_opencnt, 0); 313 atomic_set(&AFFS_I(inode)->i_opencnt, 0);
314 AFFS_I(inode)->i_blkcnt = 0; 314 AFFS_I(inode)->i_blkcnt = 0;
315 AFFS_I(inode)->i_lc = NULL; 315 AFFS_I(inode)->i_lc = NULL;
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index a2d68f828d53..29186d29a3b6 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -414,12 +414,16 @@ affs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
414 414
415int 415int
416affs_rename(struct inode *old_dir, struct dentry *old_dentry, 416affs_rename(struct inode *old_dir, struct dentry *old_dentry,
417 struct inode *new_dir, struct dentry *new_dentry) 417 struct inode *new_dir, struct dentry *new_dentry,
418 unsigned int flags)
418{ 419{
419 struct super_block *sb = old_dir->i_sb; 420 struct super_block *sb = old_dir->i_sb;
420 struct buffer_head *bh = NULL; 421 struct buffer_head *bh = NULL;
421 int retval; 422 int retval;
422 423
424 if (flags & ~RENAME_NOREPLACE)
425 return -EINVAL;
426
423 pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__, 427 pr_debug("%s(old=%lu,\"%pd\" to new=%lu,\"%pd\")\n", __func__,
424 old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry); 428 old_dir->i_ino, old_dentry, new_dir->i_ino, new_dentry);
425 429
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index eba541004d90..51a241e09fbb 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -38,7 +38,8 @@ static int afs_link(struct dentry *from, struct inode *dir,
38static int afs_symlink(struct inode *dir, struct dentry *dentry, 38static int afs_symlink(struct inode *dir, struct dentry *dentry,
39 const char *content); 39 const char *content);
40static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, 40static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
41 struct inode *new_dir, struct dentry *new_dentry); 41 struct inode *new_dir, struct dentry *new_dentry,
42 unsigned int flags);
42 43
43const struct file_operations afs_dir_file_operations = { 44const struct file_operations afs_dir_file_operations = {
44 .open = afs_dir_open, 45 .open = afs_dir_open,
@@ -1083,12 +1084,16 @@ error:
1083 * rename a file in an AFS filesystem and/or move it between directories 1084 * rename a file in an AFS filesystem and/or move it between directories
1084 */ 1085 */
1085static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, 1086static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
1086 struct inode *new_dir, struct dentry *new_dentry) 1087 struct inode *new_dir, struct dentry *new_dentry,
1088 unsigned int flags)
1087{ 1089{
1088 struct afs_vnode *orig_dvnode, *new_dvnode, *vnode; 1090 struct afs_vnode *orig_dvnode, *new_dvnode, *vnode;
1089 struct key *key; 1091 struct key *key;
1090 int ret; 1092 int ret;
1091 1093
1094 if (flags)
1095 return -EINVAL;
1096
1092 vnode = AFS_FS_I(d_inode(old_dentry)); 1097 vnode = AFS_FS_I(d_inode(old_dentry));
1093 orig_dvnode = AFS_FS_I(old_dir); 1098 orig_dvnode = AFS_FS_I(old_dir);
1094 new_dvnode = AFS_FS_I(new_dir); 1099 new_dvnode = AFS_FS_I(new_dir);
diff --git a/fs/attr.c b/fs/attr.c
index a19a64d41e7e..c902b3d53508 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -237,7 +237,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de
237 inode->i_flags &= ~S_NOSEC; 237 inode->i_flags &= ~S_NOSEC;
238 } 238 }
239 239
240 now = current_fs_time(inode->i_sb); 240 now = current_time(inode);
241 241
242 attr->ia_ctime = now; 242 attr->ia_ctime = now;
243 if (!(ia_valid & ATTR_ATIME_SET)) 243 if (!(ia_valid & ATTR_ATIME_SET))
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 61b21051bd5a..ca9cbd6362e0 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -359,7 +359,7 @@ struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode)
359 inode->i_uid = d_inode(sb->s_root)->i_uid; 359 inode->i_uid = d_inode(sb->s_root)->i_uid;
360 inode->i_gid = d_inode(sb->s_root)->i_gid; 360 inode->i_gid = d_inode(sb->s_root)->i_gid;
361 } 361 }
362 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 362 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
363 inode->i_ino = get_next_ino(); 363 inode->i_ino = get_next_ino();
364 364
365 if (S_ISDIR(mode)) { 365 if (S_ISDIR(mode)) {
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index fa84bb8832e0..623510e84c96 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -591,7 +591,7 @@ static int autofs4_dir_symlink(struct inode *dir,
591 if (p_ino && !IS_ROOT(dentry)) 591 if (p_ino && !IS_ROOT(dentry))
592 atomic_inc(&p_ino->count); 592 atomic_inc(&p_ino->count);
593 593
594 dir->i_mtime = CURRENT_TIME; 594 dir->i_mtime = current_time(dir);
595 595
596 return 0; 596 return 0;
597} 597}
@@ -631,7 +631,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
631 d_inode(dentry)->i_size = 0; 631 d_inode(dentry)->i_size = 0;
632 clear_nlink(d_inode(dentry)); 632 clear_nlink(d_inode(dentry));
633 633
634 dir->i_mtime = CURRENT_TIME; 634 dir->i_mtime = current_time(dir);
635 635
636 spin_lock(&sbi->lookup_lock); 636 spin_lock(&sbi->lookup_lock);
637 __autofs4_add_expiring(dentry); 637 __autofs4_add_expiring(dentry);
@@ -762,7 +762,7 @@ static int autofs4_dir_mkdir(struct inode *dir,
762 if (p_ino && !IS_ROOT(dentry)) 762 if (p_ino && !IS_ROOT(dentry))
763 atomic_inc(&p_ino->count); 763 atomic_inc(&p_ino->count);
764 inc_nlink(dir); 764 inc_nlink(dir);
765 dir->i_mtime = CURRENT_TIME; 765 dir->i_mtime = current_time(dir);
766 766
767 return 0; 767 return 0;
768} 768}
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 7bb153c33459..8712062275b8 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -116,7 +116,7 @@ static const struct inode_operations bad_inode_ops =
116 .mkdir = bad_inode_mkdir, 116 .mkdir = bad_inode_mkdir,
117 .rmdir = bad_inode_rmdir, 117 .rmdir = bad_inode_rmdir,
118 .mknod = bad_inode_mknod, 118 .mknod = bad_inode_mknod,
119 .rename2 = bad_inode_rename2, 119 .rename = bad_inode_rename2,
120 .readlink = bad_inode_readlink, 120 .readlink = bad_inode_readlink,
121 /* follow_link must be no-op, otherwise unmounting this inode 121 /* follow_link must be no-op, otherwise unmounting this inode
122 won't work */ 122 won't work */
@@ -153,7 +153,7 @@ void make_bad_inode(struct inode *inode)
153 153
154 inode->i_mode = S_IFREG; 154 inode->i_mode = S_IFREG;
155 inode->i_atime = inode->i_mtime = inode->i_ctime = 155 inode->i_atime = inode->i_mtime = inode->i_ctime =
156 current_fs_time(inode->i_sb); 156 current_time(inode);
157 inode->i_op = &bad_inode_ops; 157 inode->i_op = &bad_inode_ops;
158 inode->i_opflags &= ~IOP_XATTR; 158 inode->i_opflags &= ~IOP_XATTR;
159 inode->i_fop = &bad_file_ops; 159 inode->i_fop = &bad_file_ops;
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 34a5bc2f1290..3e5ac30e8b6f 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
97 set_bit(ino, info->si_imap); 97 set_bit(ino, info->si_imap);
98 info->si_freei--; 98 info->si_freei--;
99 inode_init_owner(inode, dir, mode); 99 inode_init_owner(inode, dir, mode);
100 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 100 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
101 inode->i_blocks = 0; 101 inode->i_blocks = 0;
102 inode->i_op = &bfs_file_inops; 102 inode->i_op = &bfs_file_inops;
103 inode->i_fop = &bfs_file_operations; 103 inode->i_fop = &bfs_file_operations;
@@ -165,7 +165,7 @@ static int bfs_link(struct dentry *old, struct inode *dir,
165 return err; 165 return err;
166 } 166 }
167 inc_nlink(inode); 167 inc_nlink(inode);
168 inode->i_ctime = CURRENT_TIME_SEC; 168 inode->i_ctime = current_time(inode);
169 mark_inode_dirty(inode); 169 mark_inode_dirty(inode);
170 ihold(inode); 170 ihold(inode);
171 d_instantiate(new, inode); 171 d_instantiate(new, inode);
@@ -194,7 +194,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
194 } 194 }
195 de->ino = 0; 195 de->ino = 0;
196 mark_buffer_dirty_inode(bh, dir); 196 mark_buffer_dirty_inode(bh, dir);
197 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 197 dir->i_ctime = dir->i_mtime = current_time(dir);
198 mark_inode_dirty(dir); 198 mark_inode_dirty(dir);
199 inode->i_ctime = dir->i_ctime; 199 inode->i_ctime = dir->i_ctime;
200 inode_dec_link_count(inode); 200 inode_dec_link_count(inode);
@@ -207,7 +207,8 @@ out_brelse:
207} 207}
208 208
209static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry, 209static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
210 struct inode *new_dir, struct dentry *new_dentry) 210 struct inode *new_dir, struct dentry *new_dentry,
211 unsigned int flags)
211{ 212{
212 struct inode *old_inode, *new_inode; 213 struct inode *old_inode, *new_inode;
213 struct buffer_head *old_bh, *new_bh; 214 struct buffer_head *old_bh, *new_bh;
@@ -215,6 +216,9 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
215 struct bfs_sb_info *info; 216 struct bfs_sb_info *info;
216 int error = -ENOENT; 217 int error = -ENOENT;
217 218
219 if (flags & ~RENAME_NOREPLACE)
220 return -EINVAL;
221
218 old_bh = new_bh = NULL; 222 old_bh = new_bh = NULL;
219 old_inode = d_inode(old_dentry); 223 old_inode = d_inode(old_dentry);
220 if (S_ISDIR(old_inode->i_mode)) 224 if (S_ISDIR(old_inode->i_mode))
@@ -249,10 +253,10 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
249 goto end_rename; 253 goto end_rename;
250 } 254 }
251 old_de->ino = 0; 255 old_de->ino = 0;
252 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; 256 old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
253 mark_inode_dirty(old_dir); 257 mark_inode_dirty(old_dir);
254 if (new_inode) { 258 if (new_inode) {
255 new_inode->i_ctime = CURRENT_TIME_SEC; 259 new_inode->i_ctime = current_time(new_inode);
256 inode_dec_link_count(new_inode); 260 inode_dec_link_count(new_inode);
257 } 261 }
258 mark_buffer_dirty_inode(old_bh, old_dir); 262 mark_buffer_dirty_inode(old_bh, old_dir);
@@ -300,9 +304,9 @@ static int bfs_add_entry(struct inode *dir, const unsigned char *name,
300 pos = (block - sblock) * BFS_BSIZE + off; 304 pos = (block - sblock) * BFS_BSIZE + off;
301 if (pos >= dir->i_size) { 305 if (pos >= dir->i_size) {
302 dir->i_size += BFS_DIRENT_SIZE; 306 dir->i_size += BFS_DIRENT_SIZE;
303 dir->i_ctime = CURRENT_TIME_SEC; 307 dir->i_ctime = current_time(dir);
304 } 308 }
305 dir->i_mtime = CURRENT_TIME_SEC; 309 dir->i_mtime = current_time(dir);
306 mark_inode_dirty(dir); 310 mark_inode_dirty(dir);
307 de->ino = cpu_to_le16((u16)ino); 311 de->ino = cpu_to_le16((u16)ino);
308 for (i = 0; i < BFS_NAMELEN; i++) 312 for (i = 0; i < BFS_NAMELEN; i++)
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 6103a6362ccd..9b4688ab1d8e 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -584,7 +584,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
584 inode->i_ino = get_next_ino(); 584 inode->i_ino = get_next_ino();
585 inode->i_mode = mode; 585 inode->i_mode = mode;
586 inode->i_atime = inode->i_mtime = inode->i_ctime = 586 inode->i_atime = inode->i_mtime = inode->i_ctime =
587 current_fs_time(inode->i_sb); 587 current_time(inode);
588 } 588 }
589 return inode; 589 return inode;
590} 590}
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 4843cb994835..36f4589e349c 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1757,7 +1757,7 @@ static void update_time_for_write(struct inode *inode)
1757 if (IS_NOCMTIME(inode)) 1757 if (IS_NOCMTIME(inode))
1758 return; 1758 return;
1759 1759
1760 now = current_fs_time(inode->i_sb); 1760 now = current_time(inode);
1761 if (!timespec_equal(&inode->i_mtime, &now)) 1761 if (!timespec_equal(&inode->i_mtime, &now))
1762 inode->i_mtime = now; 1762 inode->i_mtime = now;
1763 1763
@@ -2578,7 +2578,7 @@ out_trans:
2578 goto out_free; 2578 goto out_free;
2579 2579
2580 inode_inc_iversion(inode); 2580 inode_inc_iversion(inode);
2581 inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb); 2581 inode->i_mtime = inode->i_ctime = current_time(inode);
2582 2582
2583 trans->block_rsv = &root->fs_info->trans_block_rsv; 2583 trans->block_rsv = &root->fs_info->trans_block_rsv;
2584 ret = btrfs_update_inode(trans, root, inode); 2584 ret = btrfs_update_inode(trans, root, inode);
@@ -2842,7 +2842,7 @@ static long btrfs_fallocate(struct file *file, int mode,
2842 if (IS_ERR(trans)) { 2842 if (IS_ERR(trans)) {
2843 ret = PTR_ERR(trans); 2843 ret = PTR_ERR(trans);
2844 } else { 2844 } else {
2845 inode->i_ctime = current_fs_time(inode->i_sb); 2845 inode->i_ctime = current_time(inode);
2846 i_size_write(inode, actual_end); 2846 i_size_write(inode, actual_end);
2847 btrfs_ordered_update_i_size(inode, actual_end, NULL); 2847 btrfs_ordered_update_i_size(inode, actual_end, NULL);
2848 ret = btrfs_update_inode(trans, root, inode); 2848 ret = btrfs_update_inode(trans, root, inode);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 994fe5af160b..22a7ca43c7cd 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4059,7 +4059,7 @@ err:
4059 inode_inc_iversion(inode); 4059 inode_inc_iversion(inode);
4060 inode_inc_iversion(dir); 4060 inode_inc_iversion(dir);
4061 inode->i_ctime = dir->i_mtime = 4061 inode->i_ctime = dir->i_mtime =
4062 dir->i_ctime = current_fs_time(inode->i_sb); 4062 dir->i_ctime = current_time(inode);
4063 ret = btrfs_update_inode(trans, root, dir); 4063 ret = btrfs_update_inode(trans, root, dir);
4064out: 4064out:
4065 return ret; 4065 return ret;
@@ -4202,7 +4202,7 @@ int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,
4202 4202
4203 btrfs_i_size_write(dir, dir->i_size - name_len * 2); 4203 btrfs_i_size_write(dir, dir->i_size - name_len * 2);
4204 inode_inc_iversion(dir); 4204 inode_inc_iversion(dir);
4205 dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); 4205 dir->i_mtime = dir->i_ctime = current_time(dir);
4206 ret = btrfs_update_inode_fallback(trans, root, dir); 4206 ret = btrfs_update_inode_fallback(trans, root, dir);
4207 if (ret) 4207 if (ret)
4208 btrfs_abort_transaction(trans, ret); 4208 btrfs_abort_transaction(trans, ret);
@@ -4965,7 +4965,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
4965 inode_inc_iversion(inode); 4965 inode_inc_iversion(inode);
4966 if (!(mask & (ATTR_CTIME | ATTR_MTIME))) 4966 if (!(mask & (ATTR_CTIME | ATTR_MTIME)))
4967 inode->i_ctime = inode->i_mtime = 4967 inode->i_ctime = inode->i_mtime =
4968 current_fs_time(inode->i_sb); 4968 current_time(inode);
4969 } 4969 }
4970 4970
4971 if (newsize > oldsize) { 4971 if (newsize > oldsize) {
@@ -5672,7 +5672,7 @@ static struct inode *new_simple_dir(struct super_block *s,
5672 inode->i_op = &btrfs_dir_ro_inode_operations; 5672 inode->i_op = &btrfs_dir_ro_inode_operations;
5673 inode->i_fop = &simple_dir_operations; 5673 inode->i_fop = &simple_dir_operations;
5674 inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; 5674 inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO;
5675 inode->i_mtime = current_fs_time(inode->i_sb); 5675 inode->i_mtime = current_time(inode);
5676 inode->i_atime = inode->i_mtime; 5676 inode->i_atime = inode->i_mtime;
5677 inode->i_ctime = inode->i_mtime; 5677 inode->i_ctime = inode->i_mtime;
5678 BTRFS_I(inode)->i_otime = inode->i_mtime; 5678 BTRFS_I(inode)->i_otime = inode->i_mtime;
@@ -6258,7 +6258,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
6258 inode_init_owner(inode, dir, mode); 6258 inode_init_owner(inode, dir, mode);
6259 inode_set_bytes(inode, 0); 6259 inode_set_bytes(inode, 0);
6260 6260
6261 inode->i_mtime = current_fs_time(inode->i_sb); 6261 inode->i_mtime = current_time(inode);
6262 inode->i_atime = inode->i_mtime; 6262 inode->i_atime = inode->i_mtime;
6263 inode->i_ctime = inode->i_mtime; 6263 inode->i_ctime = inode->i_mtime;
6264 BTRFS_I(inode)->i_otime = inode->i_mtime; 6264 BTRFS_I(inode)->i_otime = inode->i_mtime;
@@ -6372,7 +6372,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
6372 name_len * 2); 6372 name_len * 2);
6373 inode_inc_iversion(parent_inode); 6373 inode_inc_iversion(parent_inode);
6374 parent_inode->i_mtime = parent_inode->i_ctime = 6374 parent_inode->i_mtime = parent_inode->i_ctime =
6375 current_fs_time(parent_inode->i_sb); 6375 current_time(parent_inode);
6376 ret = btrfs_update_inode(trans, root, parent_inode); 6376 ret = btrfs_update_inode(trans, root, parent_inode);
6377 if (ret) 6377 if (ret)
6378 btrfs_abort_transaction(trans, ret); 6378 btrfs_abort_transaction(trans, ret);
@@ -6590,7 +6590,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
6590 BTRFS_I(inode)->dir_index = 0ULL; 6590 BTRFS_I(inode)->dir_index = 0ULL;
6591 inc_nlink(inode); 6591 inc_nlink(inode);
6592 inode_inc_iversion(inode); 6592 inode_inc_iversion(inode);
6593 inode->i_ctime = current_fs_time(inode->i_sb); 6593 inode->i_ctime = current_time(inode);
6594 ihold(inode); 6594 ihold(inode);
6595 set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); 6595 set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
6596 6596
@@ -9493,7 +9493,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
9493 struct btrfs_root *dest = BTRFS_I(new_dir)->root; 9493 struct btrfs_root *dest = BTRFS_I(new_dir)->root;
9494 struct inode *new_inode = new_dentry->d_inode; 9494 struct inode *new_inode = new_dentry->d_inode;
9495 struct inode *old_inode = old_dentry->d_inode; 9495 struct inode *old_inode = old_dentry->d_inode;
9496 struct timespec ctime = CURRENT_TIME; 9496 struct timespec ctime = current_time(old_inode);
9497 struct dentry *parent; 9497 struct dentry *parent;
9498 u64 old_ino = btrfs_ino(old_inode); 9498 u64 old_ino = btrfs_ino(old_inode);
9499 u64 new_ino = btrfs_ino(new_inode); 9499 u64 new_ino = btrfs_ino(new_inode);
@@ -9861,7 +9861,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9861 inode_inc_iversion(old_inode); 9861 inode_inc_iversion(old_inode);
9862 old_dir->i_ctime = old_dir->i_mtime = 9862 old_dir->i_ctime = old_dir->i_mtime =
9863 new_dir->i_ctime = new_dir->i_mtime = 9863 new_dir->i_ctime = new_dir->i_mtime =
9864 old_inode->i_ctime = current_fs_time(old_dir->i_sb); 9864 old_inode->i_ctime = current_time(old_dir);
9865 9865
9866 if (old_dentry->d_parent != new_dentry->d_parent) 9866 if (old_dentry->d_parent != new_dentry->d_parent)
9867 btrfs_record_unlink_dir(trans, old_dir, old_inode, 1); 9867 btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
@@ -9886,7 +9886,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
9886 9886
9887 if (new_inode) { 9887 if (new_inode) {
9888 inode_inc_iversion(new_inode); 9888 inode_inc_iversion(new_inode);
9889 new_inode->i_ctime = current_fs_time(new_inode->i_sb); 9889 new_inode->i_ctime = current_time(new_inode);
9890 if (unlikely(btrfs_ino(new_inode) == 9890 if (unlikely(btrfs_ino(new_inode) ==
9891 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { 9891 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
9892 root_objectid = BTRFS_I(new_inode)->location.objectid; 9892 root_objectid = BTRFS_I(new_inode)->location.objectid;
@@ -10404,7 +10404,7 @@ next:
10404 *alloc_hint = ins.objectid + ins.offset; 10404 *alloc_hint = ins.objectid + ins.offset;
10405 10405
10406 inode_inc_iversion(inode); 10406 inode_inc_iversion(inode);
10407 inode->i_ctime = current_fs_time(inode->i_sb); 10407 inode->i_ctime = current_time(inode);
10408 BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; 10408 BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC;
10409 if (!(mode & FALLOC_FL_KEEP_SIZE) && 10409 if (!(mode & FALLOC_FL_KEEP_SIZE) &&
10410 (actual_len > inode->i_size) && 10410 (actual_len > inode->i_size) &&
@@ -10552,7 +10552,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {
10552 .link = btrfs_link, 10552 .link = btrfs_link,
10553 .mkdir = btrfs_mkdir, 10553 .mkdir = btrfs_mkdir,
10554 .rmdir = btrfs_rmdir, 10554 .rmdir = btrfs_rmdir,
10555 .rename2 = btrfs_rename2, 10555 .rename = btrfs_rename2,
10556 .symlink = btrfs_symlink, 10556 .symlink = btrfs_symlink,
10557 .setattr = btrfs_setattr, 10557 .setattr = btrfs_setattr,
10558 .mknod = btrfs_mknod, 10558 .mknod = btrfs_mknod,
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 7fd939bfbd99..b182197f7091 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -349,7 +349,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
349 349
350 btrfs_update_iflags(inode); 350 btrfs_update_iflags(inode);
351 inode_inc_iversion(inode); 351 inode_inc_iversion(inode);
352 inode->i_ctime = current_fs_time(inode->i_sb); 352 inode->i_ctime = current_time(inode);
353 ret = btrfs_update_inode(trans, root, inode); 353 ret = btrfs_update_inode(trans, root, inode);
354 354
355 btrfs_end_transaction(trans, root); 355 btrfs_end_transaction(trans, root);
@@ -445,7 +445,7 @@ static noinline int create_subvol(struct inode *dir,
445 struct btrfs_root *root = BTRFS_I(dir)->root; 445 struct btrfs_root *root = BTRFS_I(dir)->root;
446 struct btrfs_root *new_root; 446 struct btrfs_root *new_root;
447 struct btrfs_block_rsv block_rsv; 447 struct btrfs_block_rsv block_rsv;
448 struct timespec cur_time = current_fs_time(dir->i_sb); 448 struct timespec cur_time = current_time(dir);
449 struct inode *inode; 449 struct inode *inode;
450 int ret; 450 int ret;
451 int err; 451 int err;
@@ -3291,7 +3291,7 @@ static int clone_finish_inode_update(struct btrfs_trans_handle *trans,
3291 3291
3292 inode_inc_iversion(inode); 3292 inode_inc_iversion(inode);
3293 if (!no_time_update) 3293 if (!no_time_update)
3294 inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb); 3294 inode->i_mtime = inode->i_ctime = current_time(inode);
3295 /* 3295 /*
3296 * We round up to the block size at eof when determining which 3296 * We round up to the block size at eof when determining which
3297 * extents to clone above, but shouldn't round up the file size. 3297 * extents to clone above, but shouldn't round up the file size.
@@ -5106,7 +5106,7 @@ static long _btrfs_ioctl_set_received_subvol(struct file *file,
5106 struct btrfs_root *root = BTRFS_I(inode)->root; 5106 struct btrfs_root *root = BTRFS_I(inode)->root;
5107 struct btrfs_root_item *root_item = &root->root_item; 5107 struct btrfs_root_item *root_item = &root->root_item;
5108 struct btrfs_trans_handle *trans; 5108 struct btrfs_trans_handle *trans;
5109 struct timespec ct = current_fs_time(inode->i_sb); 5109 struct timespec ct = current_time(inode);
5110 int ret = 0; 5110 int ret = 0;
5111 int received_uuid_changed; 5111 int received_uuid_changed;
5112 5112
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 95d41919d034..c294313ea2c8 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1474,7 +1474,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1474 parent_root = BTRFS_I(parent_inode)->root; 1474 parent_root = BTRFS_I(parent_inode)->root;
1475 record_root_in_trans(trans, parent_root, 0); 1475 record_root_in_trans(trans, parent_root, 0);
1476 1476
1477 cur_time = current_fs_time(parent_inode->i_sb); 1477 cur_time = current_time(parent_inode);
1478 1478
1479 /* 1479 /*
1480 * insert the directory item 1480 * insert the directory item
@@ -1630,7 +1630,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
1630 btrfs_i_size_write(parent_inode, parent_inode->i_size + 1630 btrfs_i_size_write(parent_inode, parent_inode->i_size +
1631 dentry->d_name.len * 2); 1631 dentry->d_name.len * 2);
1632 parent_inode->i_mtime = parent_inode->i_ctime = 1632 parent_inode->i_mtime = parent_inode->i_ctime =
1633 current_fs_time(parent_inode->i_sb); 1633 current_time(parent_inode);
1634 ret = btrfs_update_inode_fallback(trans, parent_root, parent_inode); 1634 ret = btrfs_update_inode_fallback(trans, parent_root, parent_inode);
1635 if (ret) { 1635 if (ret) {
1636 btrfs_abort_transaction(trans, ret); 1636 btrfs_abort_transaction(trans, ret);
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index d1a177a3dbe8..fccbf5567e78 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -252,7 +252,7 @@ int __btrfs_setxattr(struct btrfs_trans_handle *trans,
252 goto out; 252 goto out;
253 253
254 inode_inc_iversion(inode); 254 inode_inc_iversion(inode);
255 inode->i_ctime = current_fs_time(inode->i_sb); 255 inode->i_ctime = current_time(inode);
256 set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags); 256 set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
257 ret = btrfs_update_inode(trans, root, inode); 257 ret = btrfs_update_inode(trans, root, inode);
258 BUG_ON(ret); 258 BUG_ON(ret);
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c
index 339c910da916..41df8a27d7eb 100644
--- a/fs/cachefiles/namei.c
+++ b/fs/cachefiles/namei.c
@@ -804,8 +804,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache,
804 !d_backing_inode(subdir)->i_op->lookup || 804 !d_backing_inode(subdir)->i_op->lookup ||
805 !d_backing_inode(subdir)->i_op->mkdir || 805 !d_backing_inode(subdir)->i_op->mkdir ||
806 !d_backing_inode(subdir)->i_op->create || 806 !d_backing_inode(subdir)->i_op->create ||
807 (!d_backing_inode(subdir)->i_op->rename && 807 !d_backing_inode(subdir)->i_op->rename ||
808 !d_backing_inode(subdir)->i_op->rename2) ||
809 !d_backing_inode(subdir)->i_op->rmdir || 808 !d_backing_inode(subdir)->i_op->rmdir ||
810 !d_backing_inode(subdir)->i_op->unlink) 809 !d_backing_inode(subdir)->i_op->unlink)
811 goto check_error; 810 goto check_error;
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index e33bd0933396..78180d151730 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1061,7 +1061,8 @@ out:
1061} 1061}
1062 1062
1063static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry, 1063static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
1064 struct inode *new_dir, struct dentry *new_dentry) 1064 struct inode *new_dir, struct dentry *new_dentry,
1065 unsigned int flags)
1065{ 1066{
1066 struct ceph_fs_client *fsc = ceph_sb_to_client(old_dir->i_sb); 1067 struct ceph_fs_client *fsc = ceph_sb_to_client(old_dir->i_sb);
1067 struct ceph_mds_client *mdsc = fsc->mdsc; 1068 struct ceph_mds_client *mdsc = fsc->mdsc;
@@ -1069,6 +1070,9 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
1069 int op = CEPH_MDS_OP_RENAME; 1070 int op = CEPH_MDS_OP_RENAME;
1070 int err; 1071 int err;
1071 1072
1073 if (flags)
1074 return -EINVAL;
1075
1072 if (ceph_snap(old_dir) != ceph_snap(new_dir)) 1076 if (ceph_snap(old_dir) != ceph_snap(new_dir))
1073 return -EXDEV; 1077 return -EXDEV;
1074 if (ceph_snap(old_dir) != CEPH_NOSNAP) { 1078 if (ceph_snap(old_dir) != CEPH_NOSNAP) {
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 395c7fcb1cea..7bf08825cc11 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -886,7 +886,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
886 int num_pages = 0; 886 int num_pages = 0;
887 int flags; 887 int flags;
888 int ret; 888 int ret;
889 struct timespec mtime = current_fs_time(inode->i_sb); 889 struct timespec mtime = current_time(inode);
890 size_t count = iov_iter_count(iter); 890 size_t count = iov_iter_count(iter);
891 loff_t pos = iocb->ki_pos; 891 loff_t pos = iocb->ki_pos;
892 bool write = iov_iter_rw(iter) == WRITE; 892 bool write = iov_iter_rw(iter) == WRITE;
@@ -1091,7 +1091,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
1091 int flags; 1091 int flags;
1092 int check_caps = 0; 1092 int check_caps = 0;
1093 int ret; 1093 int ret;
1094 struct timespec mtime = current_fs_time(inode->i_sb); 1094 struct timespec mtime = current_time(inode);
1095 size_t count = iov_iter_count(from); 1095 size_t count = iov_iter_count(from);
1096 1096
1097 if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) 1097 if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index da00b11d4a7a..bca1b49c1c4b 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -2067,7 +2067,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
2067 if (dirtied) { 2067 if (dirtied) {
2068 inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied, 2068 inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
2069 &prealloc_cf); 2069 &prealloc_cf);
2070 inode->i_ctime = current_fs_time(inode->i_sb); 2070 inode->i_ctime = current_time(inode);
2071 } 2071 }
2072 2072
2073 release &= issued; 2073 release &= issued;
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index adc231892b0d..40b703217977 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -1034,7 +1034,7 @@ retry:
1034 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL, 1034 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL,
1035 &prealloc_cf); 1035 &prealloc_cf);
1036 ci->i_xattrs.dirty = true; 1036 ci->i_xattrs.dirty = true;
1037 inode->i_ctime = current_fs_time(inode->i_sb); 1037 inode->i_ctime = current_time(inode);
1038 } 1038 }
1039 1039
1040 spin_unlock(&ci->i_ceph_lock); 1040 spin_unlock(&ci->i_ceph_lock);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 34aac1c73ee1..cca04e710421 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -896,7 +896,7 @@ const struct inode_operations cifs_dir_inode_ops = {
896 .link = cifs_hardlink, 896 .link = cifs_hardlink,
897 .mkdir = cifs_mkdir, 897 .mkdir = cifs_mkdir,
898 .rmdir = cifs_rmdir, 898 .rmdir = cifs_rmdir,
899 .rename2 = cifs_rename2, 899 .rename = cifs_rename2,
900 .permission = cifs_permission, 900 .permission = cifs_permission,
901 .setattr = cifs_setattr, 901 .setattr = cifs_setattr,
902 .symlink = cifs_symlink, 902 .symlink = cifs_symlink,
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 42b99af74e0a..a95fe8b1afe9 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1878,7 +1878,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
1878 write_data, to - from, &offset); 1878 write_data, to - from, &offset);
1879 cifsFileInfo_put(open_file); 1879 cifsFileInfo_put(open_file);
1880 /* Does mm or vfs already set times? */ 1880 /* Does mm or vfs already set times? */
1881 inode->i_atime = inode->i_mtime = current_fs_time(inode->i_sb); 1881 inode->i_atime = inode->i_mtime = current_time(inode);
1882 if ((bytes_written > 0) && (offset)) 1882 if ((bytes_written > 0) && (offset))
1883 rc = 0; 1883 rc = 0;
1884 else if (bytes_written < 0) 1884 else if (bytes_written < 0)
@@ -3565,7 +3565,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
3565 cifs_dbg(FYI, "Bytes read %d\n", rc); 3565 cifs_dbg(FYI, "Bytes read %d\n", rc);
3566 3566
3567 file_inode(file)->i_atime = 3567 file_inode(file)->i_atime =
3568 current_fs_time(file_inode(file)->i_sb); 3568 current_time(file_inode(file));
3569 3569
3570 if (PAGE_SIZE > rc) 3570 if (PAGE_SIZE > rc)
3571 memset(read_data + rc, 0, PAGE_SIZE - rc); 3571 memset(read_data + rc, 0, PAGE_SIZE - rc);
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 6fb8672c0892..c0474ac6cbf2 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -109,7 +109,7 @@ static inline void coda_dir_update_mtime(struct inode *dir)
109 /* optimistically we can also act as if our nose bleeds. The 109 /* optimistically we can also act as if our nose bleeds. The
110 * granularity of the mtime is coarse anyways so we might actually be 110 * granularity of the mtime is coarse anyways so we might actually be
111 * right most of the time. Note: we only do this for directories. */ 111 * right most of the time. Note: we only do this for directories. */
112 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 112 dir->i_mtime = dir->i_ctime = current_time(dir);
113#endif 113#endif
114} 114}
115 115
@@ -291,7 +291,8 @@ static int coda_rmdir(struct inode *dir, struct dentry *de)
291 291
292/* rename */ 292/* rename */
293static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, 293static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
294 struct inode *new_dir, struct dentry *new_dentry) 294 struct inode *new_dir, struct dentry *new_dentry,
295 unsigned int flags)
295{ 296{
296 const char *old_name = old_dentry->d_name.name; 297 const char *old_name = old_dentry->d_name.name;
297 const char *new_name = new_dentry->d_name.name; 298 const char *new_name = new_dentry->d_name.name;
@@ -299,6 +300,9 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
299 int new_length = new_dentry->d_name.len; 300 int new_length = new_dentry->d_name.len;
300 int error; 301 int error;
301 302
303 if (flags)
304 return -EINVAL;
305
302 error = venus_rename(old_dir->i_sb, coda_i2f(old_dir), 306 error = venus_rename(old_dir->i_sb, coda_i2f(old_dir),
303 coda_i2f(new_dir), old_length, new_length, 307 coda_i2f(new_dir), old_length, new_length,
304 (const char *) old_name, (const char *)new_name); 308 (const char *) old_name, (const char *)new_name);
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 8415d4f8d1a1..6e0154eb6fcc 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -54,7 +54,7 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
54 ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos); 54 ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos);
55 coda_inode->i_size = file_inode(host_file)->i_size; 55 coda_inode->i_size = file_inode(host_file)->i_size;
56 coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; 56 coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9;
57 coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; 57 coda_inode->i_mtime = coda_inode->i_ctime = current_time(coda_inode);
58 inode_unlock(coda_inode); 58 inode_unlock(coda_inode);
59 file_end_write(host_file); 59 file_end_write(host_file);
60 return ret; 60 return ret;
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 57e81cbba0fa..71dbe7e287ce 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -271,7 +271,7 @@ int coda_setattr(struct dentry *de, struct iattr *iattr)
271 271
272 memset(&vattr, 0, sizeof(vattr)); 272 memset(&vattr, 0, sizeof(vattr));
273 273
274 inode->i_ctime = CURRENT_TIME_SEC; 274 inode->i_ctime = current_time(inode);
275 coda_iattr_to_vattr(iattr, &vattr); 275 coda_iattr_to_vattr(iattr, &vattr);
276 vattr.va_type = C_VNON; /* cannot set type */ 276 vattr.va_type = C_VNON; /* cannot set type */
277 277
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index 0387968e6f47..ad718e5e37bb 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -76,7 +76,7 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
76 sd_iattr->ia_uid = GLOBAL_ROOT_UID; 76 sd_iattr->ia_uid = GLOBAL_ROOT_UID;
77 sd_iattr->ia_gid = GLOBAL_ROOT_GID; 77 sd_iattr->ia_gid = GLOBAL_ROOT_GID;
78 sd_iattr->ia_atime = sd_iattr->ia_mtime = 78 sd_iattr->ia_atime = sd_iattr->ia_mtime =
79 sd_iattr->ia_ctime = current_fs_time(inode->i_sb); 79 sd_iattr->ia_ctime = current_time(inode);
80 sd->s_iattr = sd_iattr; 80 sd->s_iattr = sd_iattr;
81 } 81 }
82 /* attributes were changed atleast once in past */ 82 /* attributes were changed atleast once in past */
@@ -113,7 +113,7 @@ static inline void set_default_inode_attr(struct inode * inode, umode_t mode)
113{ 113{
114 inode->i_mode = mode; 114 inode->i_mode = mode;
115 inode->i_atime = inode->i_mtime = 115 inode->i_atime = inode->i_mtime =
116 inode->i_ctime = current_fs_time(inode->i_sb); 116 inode->i_ctime = current_time(inode);
117} 117}
118 118
119static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) 119static inline void set_inode_attr(struct inode * inode, struct iattr * iattr)
@@ -197,7 +197,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in
197 return -ENOMEM; 197 return -ENOMEM;
198 198
199 p_inode = d_inode(dentry->d_parent); 199 p_inode = d_inode(dentry->d_parent);
200 p_inode->i_mtime = p_inode->i_ctime = current_fs_time(p_inode->i_sb); 200 p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode);
201 configfs_set_inode_lock_class(sd, inode); 201 configfs_set_inode_lock_class(sd, inode);
202 202
203 init(inode); 203 init(inode);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 72361baf9da7..f17fcf89e18e 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -45,7 +45,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb)
45 if (inode) { 45 if (inode) {
46 inode->i_ino = get_next_ino(); 46 inode->i_ino = get_next_ino();
47 inode->i_atime = inode->i_mtime = 47 inode->i_atime = inode->i_mtime =
48 inode->i_ctime = current_fs_time(sb); 48 inode->i_ctime = current_time(inode);
49 } 49 }
50 return inode; 50 return inode;
51} 51}
@@ -748,7 +748,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
748 old_name = fsnotify_oldname_init(old_dentry->d_name.name); 748 old_name = fsnotify_oldname_init(old_dentry->d_name.name);
749 749
750 error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir), 750 error = simple_rename(d_inode(old_dir), old_dentry, d_inode(new_dir),
751 dentry); 751 dentry, 0);
752 if (error) { 752 if (error) {
753 fsnotify_oldname_free(old_name); 753 fsnotify_oldname_free(old_name);
754 goto exit; 754 goto exit;
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 442d1a7e671b..108df2e3602c 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -300,7 +300,7 @@ static int mknod_ptmx(struct super_block *sb)
300 } 300 }
301 301
302 inode->i_ino = 2; 302 inode->i_ino = 2;
303 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 303 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
304 304
305 mode = S_IFCHR|opts->ptmxmode; 305 mode = S_IFCHR|opts->ptmxmode;
306 init_special_inode(inode, mode, MKDEV(TTYAUX_MAJOR, 2)); 306 init_special_inode(inode, mode, MKDEV(TTYAUX_MAJOR, 2));
@@ -412,7 +412,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
412 if (!inode) 412 if (!inode)
413 goto fail; 413 goto fail;
414 inode->i_ino = 1; 414 inode->i_ino = 1;
415 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 415 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
416 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; 416 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
417 inode->i_op = &simple_dir_inode_operations; 417 inode->i_op = &simple_dir_inode_operations;
418 inode->i_fop = &simple_dir_operations; 418 inode->i_fop = &simple_dir_operations;
@@ -540,7 +540,7 @@ struct dentry *devpts_pty_new(struct pts_fs_info *fsi, int index, void *priv)
540 inode->i_ino = index + 3; 540 inode->i_ino = index + 3;
541 inode->i_uid = opts->setuid ? opts->uid : current_fsuid(); 541 inode->i_uid = opts->setuid ? opts->uid : current_fsuid();
542 inode->i_gid = opts->setgid ? opts->gid : current_fsgid(); 542 inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
543 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 543 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
544 init_special_inode(inode, S_IFCHR|opts->mode, MKDEV(UNIX98_PTY_SLAVE_MAJOR, index)); 544 init_special_inode(inode, S_IFCHR|opts->mode, MKDEV(UNIX98_PTY_SLAVE_MAJOR, index));
545 545
546 sprintf(s, "%d", index); 546 sprintf(s, "%d", index);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index ddccec3124d7..cf390dceddd2 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -577,7 +577,8 @@ out:
577 577
578static int 578static int
579ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, 579ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
580 struct inode *new_dir, struct dentry *new_dentry) 580 struct inode *new_dir, struct dentry *new_dentry,
581 unsigned int flags)
581{ 582{
582 int rc; 583 int rc;
583 struct dentry *lower_old_dentry; 584 struct dentry *lower_old_dentry;
@@ -587,6 +588,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry,
587 struct dentry *trap = NULL; 588 struct dentry *trap = NULL;
588 struct inode *target_inode; 589 struct inode *target_inode;
589 590
591 if (flags)
592 return -EINVAL;
593
590 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); 594 lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry);
591 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); 595 lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
592 dget(lower_old_dentry); 596 dget(lower_old_dentry);
diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c
index cbb50cadcffc..71fccccf317e 100644
--- a/fs/efivarfs/inode.c
+++ b/fs/efivarfs/inode.c
@@ -24,7 +24,7 @@ struct inode *efivarfs_get_inode(struct super_block *sb,
24 if (inode) { 24 if (inode) {
25 inode->i_ino = get_next_ino(); 25 inode->i_ino = get_next_ino();
26 inode->i_mode = mode; 26 inode->i_mode = mode;
27 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 27 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
28 inode->i_flags = is_removable ? 0 : S_IMMUTABLE; 28 inode->i_flags = is_removable ? 0 : S_IMMUTABLE;
29 switch (mode & S_IFMT) { 29 switch (mode & S_IFMT) {
30 case S_IFREG: 30 case S_IFREG:
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index f69a1b5826a5..79101651fe9e 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -416,7 +416,7 @@ int exofs_set_link(struct inode *dir, struct exofs_dir_entry *de,
416 if (likely(!err)) 416 if (likely(!err))
417 err = exofs_commit_chunk(page, pos, len); 417 err = exofs_commit_chunk(page, pos, len);
418 exofs_put_page(page); 418 exofs_put_page(page);
419 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 419 dir->i_mtime = dir->i_ctime = current_time(dir);
420 mark_inode_dirty(dir); 420 mark_inode_dirty(dir);
421 return err; 421 return err;
422} 422}
@@ -503,7 +503,7 @@ got_it:
503 de->inode_no = cpu_to_le64(inode->i_ino); 503 de->inode_no = cpu_to_le64(inode->i_ino);
504 exofs_set_de_type(de, inode); 504 exofs_set_de_type(de, inode);
505 err = exofs_commit_chunk(page, pos, rec_len); 505 err = exofs_commit_chunk(page, pos, rec_len);
506 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 506 dir->i_mtime = dir->i_ctime = current_time(dir);
507 mark_inode_dirty(dir); 507 mark_inode_dirty(dir);
508 sbi->s_numfiles++; 508 sbi->s_numfiles++;
509 509
@@ -554,7 +554,7 @@ int exofs_delete_entry(struct exofs_dir_entry *dir, struct page *page)
554 dir->inode_no = 0; 554 dir->inode_no = 0;
555 if (likely(!err)) 555 if (likely(!err))
556 err = exofs_commit_chunk(page, pos, to - from); 556 err = exofs_commit_chunk(page, pos, to - from);
557 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 557 inode->i_ctime = inode->i_mtime = current_time(inode);
558 mark_inode_dirty(inode); 558 mark_inode_dirty(inode);
559 sbi->s_numfiles--; 559 sbi->s_numfiles--;
560out: 560out:
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 5e68daee5fe4..d42ff527ab21 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -1007,7 +1007,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize)
1007 struct exofs_sb_info *sbi = inode->i_sb->s_fs_info; 1007 struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
1008 int ret; 1008 int ret;
1009 1009
1010 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1010 inode->i_mtime = inode->i_ctime = current_time(inode);
1011 1011
1012 ret = ore_truncate(&sbi->layout, &oi->oc, (u64)newsize); 1012 ret = ore_truncate(&sbi->layout, &oi->oc, (u64)newsize);
1013 if (likely(!ret)) 1013 if (likely(!ret))
@@ -1313,7 +1313,7 @@ struct inode *exofs_new_inode(struct inode *dir, umode_t mode)
1313 inode_init_owner(inode, dir, mode); 1313 inode_init_owner(inode, dir, mode);
1314 inode->i_ino = sbi->s_nextid++; 1314 inode->i_ino = sbi->s_nextid++;
1315 inode->i_blkbits = EXOFS_BLKSHIFT; 1315 inode->i_blkbits = EXOFS_BLKSHIFT;
1316 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 1316 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
1317 oi->i_commit_size = inode->i_size = 0; 1317 oi->i_commit_size = inode->i_size = 0;
1318 spin_lock(&sbi->s_next_gen_lock); 1318 spin_lock(&sbi->s_next_gen_lock);
1319 inode->i_generation = sbi->s_next_generation++; 1319 inode->i_generation = sbi->s_next_generation++;
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
index 622a686bb08b..7295cd722770 100644
--- a/fs/exofs/namei.c
+++ b/fs/exofs/namei.c
@@ -142,7 +142,7 @@ static int exofs_link(struct dentry *old_dentry, struct inode *dir,
142{ 142{
143 struct inode *inode = d_inode(old_dentry); 143 struct inode *inode = d_inode(old_dentry);
144 144
145 inode->i_ctime = CURRENT_TIME; 145 inode->i_ctime = current_time(inode);
146 inode_inc_link_count(inode); 146 inode_inc_link_count(inode);
147 ihold(inode); 147 ihold(inode);
148 148
@@ -227,7 +227,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry)
227} 227}
228 228
229static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, 229static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
230 struct inode *new_dir, struct dentry *new_dentry) 230 struct inode *new_dir, struct dentry *new_dentry,
231 unsigned int flags)
231{ 232{
232 struct inode *old_inode = d_inode(old_dentry); 233 struct inode *old_inode = d_inode(old_dentry);
233 struct inode *new_inode = d_inode(new_dentry); 234 struct inode *new_inode = d_inode(new_dentry);
@@ -237,6 +238,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
237 struct exofs_dir_entry *old_de; 238 struct exofs_dir_entry *old_de;
238 int err = -ENOENT; 239 int err = -ENOENT;
239 240
241 if (flags & ~RENAME_NOREPLACE)
242 return -EINVAL;
243
240 old_de = exofs_find_entry(old_dir, old_dentry, &old_page); 244 old_de = exofs_find_entry(old_dir, old_dentry, &old_page);
241 if (!old_de) 245 if (!old_de)
242 goto out; 246 goto out;
@@ -261,7 +265,7 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
261 if (!new_de) 265 if (!new_de)
262 goto out_dir; 266 goto out_dir;
263 err = exofs_set_link(new_dir, new_de, new_page, old_inode); 267 err = exofs_set_link(new_dir, new_de, new_page, old_inode);
264 new_inode->i_ctime = CURRENT_TIME; 268 new_inode->i_ctime = current_time(new_inode);
265 if (dir_de) 269 if (dir_de)
266 drop_nlink(new_inode); 270 drop_nlink(new_inode);
267 inode_dec_link_count(new_inode); 271 inode_dec_link_count(new_inode);
@@ -275,7 +279,7 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
275 inode_inc_link_count(new_dir); 279 inode_inc_link_count(new_dir);
276 } 280 }
277 281
278 old_inode->i_ctime = CURRENT_TIME; 282 old_inode->i_ctime = current_time(old_inode);
279 283
280 exofs_delete_entry(old_de, old_page); 284 exofs_delete_entry(old_de, old_page);
281 mark_inode_dirty(old_inode); 285 mark_inode_dirty(old_inode);
@@ -310,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = {
310 .mkdir = exofs_mkdir, 314 .mkdir = exofs_mkdir,
311 .rmdir = exofs_rmdir, 315 .rmdir = exofs_rmdir,
312 .mknod = exofs_mknod, 316 .mknod = exofs_mknod,
313 .rename = exofs_rename, 317 .rename = exofs_rename,
314 .setattr = exofs_setattr, 318 .setattr = exofs_setattr,
315}; 319};
316 320
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index e725aa0890e0..79dafa71effd 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -193,7 +193,7 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
193 error = posix_acl_update_mode(inode, &inode->i_mode, &acl); 193 error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
194 if (error) 194 if (error)
195 return error; 195 return error;
196 inode->i_ctime = CURRENT_TIME_SEC; 196 inode->i_ctime = current_time(inode);
197 mark_inode_dirty(inode); 197 mark_inode_dirty(inode);
198 } 198 }
199 break; 199 break;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 61ad490ed67b..d9650c9508e4 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -471,7 +471,7 @@ void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
471 err = ext2_commit_chunk(page, pos, len); 471 err = ext2_commit_chunk(page, pos, len);
472 ext2_put_page(page); 472 ext2_put_page(page);
473 if (update_times) 473 if (update_times)
474 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 474 dir->i_mtime = dir->i_ctime = current_time(dir);
475 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 475 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
476 mark_inode_dirty(dir); 476 mark_inode_dirty(dir);
477} 477}
@@ -561,7 +561,7 @@ got_it:
561 de->inode = cpu_to_le32(inode->i_ino); 561 de->inode = cpu_to_le32(inode->i_ino);
562 ext2_set_de_type (de, inode); 562 ext2_set_de_type (de, inode);
563 err = ext2_commit_chunk(page, pos, rec_len); 563 err = ext2_commit_chunk(page, pos, rec_len);
564 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 564 dir->i_mtime = dir->i_ctime = current_time(dir);
565 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL; 565 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
566 mark_inode_dirty(dir); 566 mark_inode_dirty(dir);
567 /* OFFSET_CACHE */ 567 /* OFFSET_CACHE */
@@ -610,7 +610,7 @@ int ext2_delete_entry (struct ext2_dir_entry_2 * dir, struct page * page )
610 pde->rec_len = ext2_rec_len_to_disk(to - from); 610 pde->rec_len = ext2_rec_len_to_disk(to - from);
611 dir->inode = 0; 611 dir->inode = 0;
612 err = ext2_commit_chunk(page, pos, to - from); 612 err = ext2_commit_chunk(page, pos, to - from);
613 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 613 inode->i_ctime = inode->i_mtime = current_time(inode);
614 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL; 614 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
615 mark_inode_dirty(inode); 615 mark_inode_dirty(inode);
616out: 616out:
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 04e73a99902b..395fc074c0db 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -556,7 +556,7 @@ got:
556 556
557 inode->i_ino = ino; 557 inode->i_ino = ino;
558 inode->i_blocks = 0; 558 inode->i_blocks = 0;
559 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 559 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
560 memset(ei->i_data, 0, sizeof(ei->i_data)); 560 memset(ei->i_data, 0, sizeof(ei->i_data));
561 ei->i_flags = 561 ei->i_flags =
562 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED); 562 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 6831534924e1..d831e24dc885 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -595,7 +595,7 @@ static void ext2_splice_branch(struct inode *inode,
595 if (where->bh) 595 if (where->bh)
596 mark_buffer_dirty_inode(where->bh, inode); 596 mark_buffer_dirty_inode(where->bh, inode);
597 597
598 inode->i_ctime = CURRENT_TIME_SEC; 598 inode->i_ctime = current_time(inode);
599 mark_inode_dirty(inode); 599 mark_inode_dirty(inode);
600} 600}
601 601
@@ -1308,7 +1308,7 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
1308 __ext2_truncate_blocks(inode, newsize); 1308 __ext2_truncate_blocks(inode, newsize);
1309 dax_sem_up_write(EXT2_I(inode)); 1309 dax_sem_up_write(EXT2_I(inode));
1310 1310
1311 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 1311 inode->i_mtime = inode->i_ctime = current_time(inode);
1312 if (inode_needs_sync(inode)) { 1312 if (inode_needs_sync(inode)) {
1313 sync_mapping_buffers(inode->i_mapping); 1313 sync_mapping_buffers(inode->i_mapping);
1314 sync_inode_metadata(inode, 1); 1314 sync_inode_metadata(inode, 1);
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c
index b386af2e45f4..9d617423e936 100644
--- a/fs/ext2/ioctl.c
+++ b/fs/ext2/ioctl.c
@@ -79,7 +79,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
79 ei->i_flags = flags; 79 ei->i_flags = flags;
80 80
81 ext2_set_inode_flags(inode); 81 ext2_set_inode_flags(inode);
82 inode->i_ctime = CURRENT_TIME_SEC; 82 inode->i_ctime = current_time(inode);
83 inode_unlock(inode); 83 inode_unlock(inode);
84 84
85 mark_inode_dirty(inode); 85 mark_inode_dirty(inode);
@@ -103,7 +103,7 @@ setflags_out:
103 } 103 }
104 104
105 inode_lock(inode); 105 inode_lock(inode);
106 inode->i_ctime = CURRENT_TIME_SEC; 106 inode->i_ctime = current_time(inode);
107 inode->i_generation = generation; 107 inode->i_generation = generation;
108 inode_unlock(inode); 108 inode_unlock(inode);
109 109
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index ff32ea799496..814e405a2da6 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -221,7 +221,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir,
221 if (err) 221 if (err)
222 return err; 222 return err;
223 223
224 inode->i_ctime = CURRENT_TIME_SEC; 224 inode->i_ctime = current_time(inode);
225 inode_inc_link_count(inode); 225 inode_inc_link_count(inode);
226 ihold(inode); 226 ihold(inode);
227 227
@@ -328,7 +328,8 @@ static int ext2_rmdir (struct inode * dir, struct dentry *dentry)
328} 328}
329 329
330static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, 330static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
331 struct inode * new_dir, struct dentry * new_dentry ) 331 struct inode * new_dir, struct dentry * new_dentry,
332 unsigned int flags)
332{ 333{
333 struct inode * old_inode = d_inode(old_dentry); 334 struct inode * old_inode = d_inode(old_dentry);
334 struct inode * new_inode = d_inode(new_dentry); 335 struct inode * new_inode = d_inode(new_dentry);
@@ -338,6 +339,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
338 struct ext2_dir_entry_2 * old_de; 339 struct ext2_dir_entry_2 * old_de;
339 int err; 340 int err;
340 341
342 if (flags & ~RENAME_NOREPLACE)
343 return -EINVAL;
344
341 err = dquot_initialize(old_dir); 345 err = dquot_initialize(old_dir);
342 if (err) 346 if (err)
343 goto out; 347 goto out;
@@ -372,7 +376,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
372 if (!new_de) 376 if (!new_de)
373 goto out_dir; 377 goto out_dir;
374 ext2_set_link(new_dir, new_de, new_page, old_inode, 1); 378 ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
375 new_inode->i_ctime = CURRENT_TIME_SEC; 379 new_inode->i_ctime = current_time(new_inode);
376 if (dir_de) 380 if (dir_de)
377 drop_nlink(new_inode); 381 drop_nlink(new_inode);
378 inode_dec_link_count(new_inode); 382 inode_dec_link_count(new_inode);
@@ -388,7 +392,7 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
388 * Like most other Unix systems, set the ctime for inodes on a 392 * Like most other Unix systems, set the ctime for inodes on a
389 * rename. 393 * rename.
390 */ 394 */
391 old_inode->i_ctime = CURRENT_TIME_SEC; 395 old_inode->i_ctime = current_time(old_inode);
392 mark_inode_dirty(old_inode); 396 mark_inode_dirty(old_inode);
393 397
394 ext2_delete_entry (old_de, old_page); 398 ext2_delete_entry (old_de, old_page);
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 1d9379568aa8..6cb042b53b5b 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1543,7 +1543,7 @@ out:
1543 if (inode->i_size < off+len-towrite) 1543 if (inode->i_size < off+len-towrite)
1544 i_size_write(inode, off+len-towrite); 1544 i_size_write(inode, off+len-towrite);
1545 inode->i_version++; 1545 inode->i_version++;
1546 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1546 inode->i_mtime = inode->i_ctime = current_time(inode);
1547 mark_inode_dirty(inode); 1547 mark_inode_dirty(inode);
1548 return len - towrite; 1548 return len - towrite;
1549} 1549}
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index b7f896f3f7a7..fbdb8f171893 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -691,7 +691,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
691 691
692 /* Update the inode. */ 692 /* Update the inode. */
693 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0; 693 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
694 inode->i_ctime = CURRENT_TIME_SEC; 694 inode->i_ctime = current_time(inode);
695 if (IS_SYNC(inode)) { 695 if (IS_SYNC(inode)) {
696 error = sync_inode_metadata(inode, 1); 696 error = sync_inode_metadata(inode, 1);
697 /* In case sync failed due to ENOSPC the inode was actually 697 /* In case sync failed due to ENOSPC the inode was actually
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index a73a9196b929..f92f10d4f66a 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3878,7 +3878,7 @@ const struct inode_operations ext4_dir_inode_operations = {
3878 .rmdir = ext4_rmdir, 3878 .rmdir = ext4_rmdir,
3879 .mknod = ext4_mknod, 3879 .mknod = ext4_mknod,
3880 .tmpfile = ext4_tmpfile, 3880 .tmpfile = ext4_tmpfile,
3881 .rename2 = ext4_rename2, 3881 .rename = ext4_rename2,
3882 .setattr = ext4_setattr, 3882 .setattr = ext4_setattr,
3883 .listxattr = ext4_listxattr, 3883 .listxattr = ext4_listxattr,
3884 .get_acl = ext4_get_acl, 3884 .get_acl = ext4_get_acl,
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 12b5836a1033..369f4513be37 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -312,7 +312,7 @@ void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de,
312 f2fs_dentry_kunmap(dir, page); 312 f2fs_dentry_kunmap(dir, page);
313 set_page_dirty(page); 313 set_page_dirty(page);
314 314
315 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 315 dir->i_mtime = dir->i_ctime = current_time(dir);
316 f2fs_mark_inode_dirty_sync(dir); 316 f2fs_mark_inode_dirty_sync(dir);
317 f2fs_put_page(page, 1); 317 f2fs_put_page(page, 1);
318} 318}
@@ -465,7 +465,7 @@ void update_parent_metadata(struct inode *dir, struct inode *inode,
465 f2fs_i_links_write(dir, true); 465 f2fs_i_links_write(dir, true);
466 clear_inode_flag(inode, FI_NEW_INODE); 466 clear_inode_flag(inode, FI_NEW_INODE);
467 } 467 }
468 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 468 dir->i_mtime = dir->i_ctime = current_time(dir);
469 f2fs_mark_inode_dirty_sync(dir); 469 f2fs_mark_inode_dirty_sync(dir);
470 470
471 if (F2FS_I(dir)->i_current_depth != current_depth) 471 if (F2FS_I(dir)->i_current_depth != current_depth)
@@ -683,7 +683,7 @@ void f2fs_drop_nlink(struct inode *dir, struct inode *inode)
683 683
684 if (S_ISDIR(inode->i_mode)) 684 if (S_ISDIR(inode->i_mode))
685 f2fs_i_links_write(dir, false); 685 f2fs_i_links_write(dir, false);
686 inode->i_ctime = CURRENT_TIME; 686 inode->i_ctime = current_time(inode);
687 687
688 f2fs_i_links_write(inode, false); 688 f2fs_i_links_write(inode, false);
689 if (S_ISDIR(inode->i_mode)) { 689 if (S_ISDIR(inode->i_mode)) {
@@ -730,7 +730,7 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page,
730 kunmap(page); /* kunmap - pair of f2fs_find_entry */ 730 kunmap(page); /* kunmap - pair of f2fs_find_entry */
731 set_page_dirty(page); 731 set_page_dirty(page);
732 732
733 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 733 dir->i_ctime = dir->i_mtime = current_time(dir);
734 f2fs_mark_inode_dirty_sync(dir); 734 f2fs_mark_inode_dirty_sync(dir);
735 735
736 if (inode) 736 if (inode)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index acdf4b929f97..c7865073cd26 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -631,7 +631,7 @@ int f2fs_truncate(struct inode *inode)
631 if (err) 631 if (err)
632 return err; 632 return err;
633 633
634 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 634 inode->i_mtime = inode->i_ctime = current_time(inode);
635 f2fs_mark_inode_dirty_sync(inode); 635 f2fs_mark_inode_dirty_sync(inode);
636 return 0; 636 return 0;
637} 637}
@@ -708,7 +708,7 @@ int f2fs_setattr(struct dentry *dentry, struct iattr *attr)
708 if (err) 708 if (err)
709 return err; 709 return err;
710 } 710 }
711 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 711 inode->i_mtime = inode->i_ctime = current_time(inode);
712 } 712 }
713 } 713 }
714 714
@@ -1392,7 +1392,7 @@ static long f2fs_fallocate(struct file *file, int mode,
1392 } 1392 }
1393 1393
1394 if (!ret) { 1394 if (!ret) {
1395 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1395 inode->i_mtime = inode->i_ctime = current_time(inode);
1396 f2fs_mark_inode_dirty_sync(inode); 1396 f2fs_mark_inode_dirty_sync(inode);
1397 f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); 1397 f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
1398 } 1398 }
@@ -1484,7 +1484,7 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg)
1484 fi->i_flags = flags; 1484 fi->i_flags = flags;
1485 inode_unlock(inode); 1485 inode_unlock(inode);
1486 1486
1487 inode->i_ctime = CURRENT_TIME; 1487 inode->i_ctime = current_time(inode);
1488 f2fs_set_inode_flags(inode); 1488 f2fs_set_inode_flags(inode);
1489out: 1489out:
1490 mnt_drop_write_file(filp); 1490 mnt_drop_write_file(filp);
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 34234d84a38b..5f1a67f756af 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -572,7 +572,7 @@ void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, struct page *page,
572 set_page_dirty(page); 572 set_page_dirty(page);
573 f2fs_put_page(page, 1); 573 f2fs_put_page(page, 1);
574 574
575 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 575 dir->i_ctime = dir->i_mtime = current_time(dir);
576 f2fs_mark_inode_dirty_sync(dir); 576 f2fs_mark_inode_dirty_sync(dir);
577 577
578 if (inode) 578 if (inode)
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index e80ed0302c22..489fa0d5f914 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -46,7 +46,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode)
46 46
47 inode->i_ino = ino; 47 inode->i_ino = ino;
48 inode->i_blocks = 0; 48 inode->i_blocks = 0;
49 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 49 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
50 inode->i_generation = sbi->s_next_generation++; 50 inode->i_generation = sbi->s_next_generation++;
51 51
52 err = insert_inode_locked(inode); 52 err = insert_inode_locked(inode);
@@ -182,7 +182,7 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
182 182
183 f2fs_balance_fs(sbi, true); 183 f2fs_balance_fs(sbi, true);
184 184
185 inode->i_ctime = CURRENT_TIME; 185 inode->i_ctime = current_time(inode);
186 ihold(inode); 186 ihold(inode);
187 187
188 set_inode_flag(inode, FI_INC_LINK); 188 set_inode_flag(inode, FI_INC_LINK);
@@ -723,7 +723,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
723 723
724 f2fs_set_link(new_dir, new_entry, new_page, old_inode); 724 f2fs_set_link(new_dir, new_entry, new_page, old_inode);
725 725
726 new_inode->i_ctime = CURRENT_TIME; 726 new_inode->i_ctime = current_time(new_inode);
727 down_write(&F2FS_I(new_inode)->i_sem); 727 down_write(&F2FS_I(new_inode)->i_sem);
728 if (old_dir_entry) 728 if (old_dir_entry)
729 f2fs_i_links_write(new_inode, false); 729 f2fs_i_links_write(new_inode, false);
@@ -777,7 +777,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
777 file_set_enc_name(old_inode); 777 file_set_enc_name(old_inode);
778 up_write(&F2FS_I(old_inode)->i_sem); 778 up_write(&F2FS_I(old_inode)->i_sem);
779 779
780 old_inode->i_ctime = CURRENT_TIME; 780 old_inode->i_ctime = current_time(old_inode);
781 f2fs_mark_inode_dirty_sync(old_inode); 781 f2fs_mark_inode_dirty_sync(old_inode);
782 782
783 f2fs_delete_entry(old_entry, old_page, old_dir, NULL); 783 f2fs_delete_entry(old_entry, old_page, old_dir, NULL);
@@ -932,7 +932,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
932 file_lost_pino(old_inode); 932 file_lost_pino(old_inode);
933 up_write(&F2FS_I(old_inode)->i_sem); 933 up_write(&F2FS_I(old_inode)->i_sem);
934 934
935 old_dir->i_ctime = CURRENT_TIME; 935 old_dir->i_ctime = current_time(old_dir);
936 if (old_nlink) { 936 if (old_nlink) {
937 down_write(&F2FS_I(old_dir)->i_sem); 937 down_write(&F2FS_I(old_dir)->i_sem);
938 f2fs_i_links_write(old_dir, old_nlink > 0); 938 f2fs_i_links_write(old_dir, old_nlink > 0);
@@ -947,7 +947,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
947 file_lost_pino(new_inode); 947 file_lost_pino(new_inode);
948 up_write(&F2FS_I(new_inode)->i_sem); 948 up_write(&F2FS_I(new_inode)->i_sem);
949 949
950 new_dir->i_ctime = CURRENT_TIME; 950 new_dir->i_ctime = current_time(new_dir);
951 if (new_nlink) { 951 if (new_nlink) {
952 down_write(&F2FS_I(new_dir)->i_sem); 952 down_write(&F2FS_I(new_dir)->i_sem);
953 f2fs_i_links_write(new_dir, new_nlink > 0); 953 f2fs_i_links_write(new_dir, new_nlink > 0);
@@ -1093,7 +1093,7 @@ const struct inode_operations f2fs_dir_inode_operations = {
1093 .mkdir = f2fs_mkdir, 1093 .mkdir = f2fs_mkdir,
1094 .rmdir = f2fs_rmdir, 1094 .rmdir = f2fs_rmdir,
1095 .mknod = f2fs_mknod, 1095 .mknod = f2fs_mknod,
1096 .rename2 = f2fs_rename2, 1096 .rename = f2fs_rename2,
1097 .tmpfile = f2fs_tmpfile, 1097 .tmpfile = f2fs_tmpfile,
1098 .getattr = f2fs_getattr, 1098 .getattr = f2fs_getattr,
1099 .setattr = f2fs_setattr, 1099 .setattr = f2fs_setattr,
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 1f74876233b6..3e1c0280f866 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -548,7 +548,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
548 548
549 if (is_inode_flag_set(inode, FI_ACL_MODE)) { 549 if (is_inode_flag_set(inode, FI_ACL_MODE)) {
550 inode->i_mode = F2FS_I(inode)->i_acl_mode; 550 inode->i_mode = F2FS_I(inode)->i_acl_mode;
551 inode->i_ctime = CURRENT_TIME; 551 inode->i_ctime = current_time(inode);
552 clear_inode_flag(inode, FI_ACL_MODE); 552 clear_inode_flag(inode, FI_ACL_MODE);
553 } 553 }
554 if (index == F2FS_XATTR_INDEX_ENCRYPTION && 554 if (index == F2FS_XATTR_INDEX_ENCRYPTION &&
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 663e428596c6..81cecbe6d7cf 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -1071,7 +1071,7 @@ int fat_remove_entries(struct inode *dir, struct fat_slot_info *sinfo)
1071 } 1071 }
1072 } 1072 }
1073 1073
1074 dir->i_mtime = dir->i_atime = CURRENT_TIME_SEC; 1074 dir->i_mtime = dir->i_atime = current_time(dir);
1075 if (IS_DIRSYNC(dir)) 1075 if (IS_DIRSYNC(dir))
1076 (void)fat_sync_inode(dir); 1076 (void)fat_sync_inode(dir);
1077 else 1077 else
diff --git a/fs/fat/file.c b/fs/fat/file.c
index c09ab4e108e5..3d04b124bce0 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -63,7 +63,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr)
63 63
64 /* Equivalent to a chmod() */ 64 /* Equivalent to a chmod() */
65 ia.ia_valid = ATTR_MODE | ATTR_CTIME; 65 ia.ia_valid = ATTR_MODE | ATTR_CTIME;
66 ia.ia_ctime = current_fs_time(inode->i_sb); 66 ia.ia_ctime = current_time(inode);
67 if (is_dir) 67 if (is_dir)
68 ia.ia_mode = fat_make_mode(sbi, attr, S_IRWXUGO); 68 ia.ia_mode = fat_make_mode(sbi, attr, S_IRWXUGO);
69 else { 69 else {
@@ -194,7 +194,7 @@ static int fat_cont_expand(struct inode *inode, loff_t size)
194 if (err) 194 if (err)
195 goto out; 195 goto out;
196 196
197 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 197 inode->i_ctime = inode->i_mtime = current_time(inode);
198 mark_inode_dirty(inode); 198 mark_inode_dirty(inode);
199 if (IS_SYNC(inode)) { 199 if (IS_SYNC(inode)) {
200 int err2; 200 int err2;
@@ -297,7 +297,7 @@ static int fat_free(struct inode *inode, int skip)
297 MSDOS_I(inode)->i_logstart = 0; 297 MSDOS_I(inode)->i_logstart = 0;
298 } 298 }
299 MSDOS_I(inode)->i_attrs |= ATTR_ARCH; 299 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
300 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 300 inode->i_ctime = inode->i_mtime = current_time(inode);
301 if (wait) { 301 if (wait) {
302 err = fat_sync_inode(inode); 302 err = fat_sync_inode(inode);
303 if (err) { 303 if (err) {
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index da04c0298fab..338d2f73eb29 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -237,7 +237,7 @@ static int fat_write_end(struct file *file, struct address_space *mapping,
237 if (err < len) 237 if (err < len)
238 fat_write_failed(mapping, pos + len); 238 fat_write_failed(mapping, pos + len);
239 if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) { 239 if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
240 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 240 inode->i_mtime = inode->i_ctime = current_time(inode);
241 MSDOS_I(inode)->i_attrs |= ATTR_ARCH; 241 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
242 mark_inode_dirty(inode); 242 mark_inode_dirty(inode);
243 } 243 }
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c
index 664655b2c55f..7d6a105d601b 100644
--- a/fs/fat/namei_msdos.c
+++ b/fs/fat/namei_msdos.c
@@ -283,7 +283,7 @@ static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode,
283 goto out; 283 goto out;
284 } 284 }
285 285
286 ts = CURRENT_TIME_SEC; 286 ts = current_time(dir);
287 err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo); 287 err = msdos_add_entry(dir, msdos_name, 0, is_hid, 0, &ts, &sinfo);
288 if (err) 288 if (err)
289 goto out; 289 goto out;
@@ -330,7 +330,7 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
330 drop_nlink(dir); 330 drop_nlink(dir);
331 331
332 clear_nlink(inode); 332 clear_nlink(inode);
333 inode->i_ctime = CURRENT_TIME_SEC; 333 inode->i_ctime = current_time(inode);
334 fat_detach(inode); 334 fat_detach(inode);
335out: 335out:
336 mutex_unlock(&MSDOS_SB(sb)->s_lock); 336 mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -364,7 +364,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
364 goto out; 364 goto out;
365 } 365 }
366 366
367 ts = CURRENT_TIME_SEC; 367 ts = current_time(dir);
368 cluster = fat_alloc_new_dir(dir, &ts); 368 cluster = fat_alloc_new_dir(dir, &ts);
369 if (cluster < 0) { 369 if (cluster < 0) {
370 err = cluster; 370 err = cluster;
@@ -416,7 +416,7 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
416 if (err) 416 if (err)
417 goto out; 417 goto out;
418 clear_nlink(inode); 418 clear_nlink(inode);
419 inode->i_ctime = CURRENT_TIME_SEC; 419 inode->i_ctime = current_time(inode);
420 fat_detach(inode); 420 fat_detach(inode);
421out: 421out:
422 mutex_unlock(&MSDOS_SB(sb)->s_lock); 422 mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -481,7 +481,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
481 mark_inode_dirty(old_inode); 481 mark_inode_dirty(old_inode);
482 482
483 old_dir->i_version++; 483 old_dir->i_version++;
484 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC; 484 old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
485 if (IS_DIRSYNC(old_dir)) 485 if (IS_DIRSYNC(old_dir))
486 (void)fat_sync_inode(old_dir); 486 (void)fat_sync_inode(old_dir);
487 else 487 else
@@ -490,7 +490,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
490 } 490 }
491 } 491 }
492 492
493 ts = CURRENT_TIME_SEC; 493 ts = current_time(old_inode);
494 if (new_inode) { 494 if (new_inode) {
495 if (err) 495 if (err)
496 goto out; 496 goto out;
@@ -596,12 +596,16 @@ error_inode:
596 596
597/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */ 597/***** Rename, a wrapper for rename_same_dir & rename_diff_dir */
598static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry, 598static int msdos_rename(struct inode *old_dir, struct dentry *old_dentry,
599 struct inode *new_dir, struct dentry *new_dentry) 599 struct inode *new_dir, struct dentry *new_dentry,
600 unsigned int flags)
600{ 601{
601 struct super_block *sb = old_dir->i_sb; 602 struct super_block *sb = old_dir->i_sb;
602 unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME]; 603 unsigned char old_msdos_name[MSDOS_NAME], new_msdos_name[MSDOS_NAME];
603 int err, is_hid; 604 int err, is_hid;
604 605
606 if (flags & ~RENAME_NOREPLACE)
607 return -EINVAL;
608
605 mutex_lock(&MSDOS_SB(sb)->s_lock); 609 mutex_lock(&MSDOS_SB(sb)->s_lock);
606 610
607 err = msdos_format_name(old_dentry->d_name.name, 611 err = msdos_format_name(old_dentry->d_name.name,
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 4afdc3f36470..6a7152d0c250 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -788,7 +788,7 @@ static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
788 788
789 mutex_lock(&MSDOS_SB(sb)->s_lock); 789 mutex_lock(&MSDOS_SB(sb)->s_lock);
790 790
791 ts = CURRENT_TIME_SEC; 791 ts = current_time(dir);
792 err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo); 792 err = vfat_add_entry(dir, &dentry->d_name, 0, 0, &ts, &sinfo);
793 if (err) 793 if (err)
794 goto out; 794 goto out;
@@ -832,7 +832,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
832 drop_nlink(dir); 832 drop_nlink(dir);
833 833
834 clear_nlink(inode); 834 clear_nlink(inode);
835 inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; 835 inode->i_mtime = inode->i_atime = current_time(inode);
836 fat_detach(inode); 836 fat_detach(inode);
837 vfat_d_version_set(dentry, dir->i_version); 837 vfat_d_version_set(dentry, dir->i_version);
838out: 838out:
@@ -858,7 +858,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry)
858 if (err) 858 if (err)
859 goto out; 859 goto out;
860 clear_nlink(inode); 860 clear_nlink(inode);
861 inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC; 861 inode->i_mtime = inode->i_atime = current_time(inode);
862 fat_detach(inode); 862 fat_detach(inode);
863 vfat_d_version_set(dentry, dir->i_version); 863 vfat_d_version_set(dentry, dir->i_version);
864out: 864out:
@@ -877,7 +877,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
877 877
878 mutex_lock(&MSDOS_SB(sb)->s_lock); 878 mutex_lock(&MSDOS_SB(sb)->s_lock);
879 879
880 ts = CURRENT_TIME_SEC; 880 ts = current_time(dir);
881 cluster = fat_alloc_new_dir(dir, &ts); 881 cluster = fat_alloc_new_dir(dir, &ts);
882 if (cluster < 0) { 882 if (cluster < 0) {
883 err = cluster; 883 err = cluster;
@@ -914,7 +914,8 @@ out:
914} 914}
915 915
916static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry, 916static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
917 struct inode *new_dir, struct dentry *new_dentry) 917 struct inode *new_dir, struct dentry *new_dentry,
918 unsigned int flags)
918{ 919{
919 struct buffer_head *dotdot_bh; 920 struct buffer_head *dotdot_bh;
920 struct msdos_dir_entry *dotdot_de; 921 struct msdos_dir_entry *dotdot_de;
@@ -925,6 +926,9 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
925 int err, is_dir, update_dotdot, corrupt = 0; 926 int err, is_dir, update_dotdot, corrupt = 0;
926 struct super_block *sb = old_dir->i_sb; 927 struct super_block *sb = old_dir->i_sb;
927 928
929 if (flags & ~RENAME_NOREPLACE)
930 return -EINVAL;
931
928 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL; 932 old_sinfo.bh = sinfo.bh = dotdot_bh = NULL;
929 old_inode = d_inode(old_dentry); 933 old_inode = d_inode(old_dentry);
930 new_inode = d_inode(new_dentry); 934 new_inode = d_inode(new_dentry);
@@ -942,7 +946,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
942 } 946 }
943 } 947 }
944 948
945 ts = CURRENT_TIME_SEC; 949 ts = current_time(old_dir);
946 if (new_inode) { 950 if (new_inode) {
947 if (is_dir) { 951 if (is_dir) {
948 err = fat_dir_empty(new_inode); 952 err = fat_dir_empty(new_inode);
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index f863ac6647ac..6e22748b0704 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -220,7 +220,7 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
220 inode->i_mode = mode; 220 inode->i_mode = mode;
221 inode->i_uid = fc->user_id; 221 inode->i_uid = fc->user_id;
222 inode->i_gid = fc->group_id; 222 inode->i_gid = fc->group_id;
223 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 223 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
224 /* setting ->i_op to NULL is not allowed */ 224 /* setting ->i_op to NULL is not allowed */
225 if (iop) 225 if (iop)
226 inode->i_op = iop; 226 inode->i_op = iop;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 572d12410c7c..6a4d0e5418a1 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -647,7 +647,7 @@ static int fuse_symlink(struct inode *dir, struct dentry *entry,
647void fuse_update_ctime(struct inode *inode) 647void fuse_update_ctime(struct inode *inode)
648{ 648{
649 if (!IS_NOCMTIME(inode)) { 649 if (!IS_NOCMTIME(inode)) {
650 inode->i_ctime = current_fs_time(inode->i_sb); 650 inode->i_ctime = current_time(inode);
651 mark_inode_dirty_sync(inode); 651 mark_inode_dirty_sync(inode);
652 } 652 }
653} 653}
@@ -1793,7 +1793,7 @@ static const struct inode_operations fuse_dir_inode_operations = {
1793 .symlink = fuse_symlink, 1793 .symlink = fuse_symlink,
1794 .unlink = fuse_unlink, 1794 .unlink = fuse_unlink,
1795 .rmdir = fuse_rmdir, 1795 .rmdir = fuse_rmdir,
1796 .rename2 = fuse_rename2, 1796 .rename = fuse_rename2,
1797 .link = fuse_link, 1797 .link = fuse_link,
1798 .setattr = fuse_setattr, 1798 .setattr = fuse_setattr,
1799 .create = fuse_create, 1799 .create = fuse_create,
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 645721f3ff00..fc5da4cbe88c 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -836,7 +836,7 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
836 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid, 836 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid,
837 ip->i_inode.i_gid); 837 ip->i_inode.i_gid);
838 838
839 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 839 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
840 840
841 gfs2_dinode_out(ip, dibh->b_data); 841 gfs2_dinode_out(ip, dibh->b_data);
842 842
@@ -1063,7 +1063,7 @@ static int trunc_start(struct inode *inode, u64 oldsize, u64 newsize)
1063 } 1063 }
1064 1064
1065 i_size_write(inode, newsize); 1065 i_size_write(inode, newsize);
1066 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1066 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
1067 gfs2_dinode_out(ip, dibh->b_data); 1067 gfs2_dinode_out(ip, dibh->b_data);
1068 1068
1069 if (journaled) 1069 if (journaled)
@@ -1142,7 +1142,7 @@ static int trunc_end(struct gfs2_inode *ip)
1142 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1142 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
1143 gfs2_ordered_del_inode(ip); 1143 gfs2_ordered_del_inode(ip);
1144 } 1144 }
1145 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1145 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
1146 ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG; 1146 ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
1147 1147
1148 gfs2_trans_add_meta(ip->i_gl, dibh); 1148 gfs2_trans_add_meta(ip->i_gl, dibh);
@@ -1252,7 +1252,7 @@ static int do_grow(struct inode *inode, u64 size)
1252 goto do_end_trans; 1252 goto do_end_trans;
1253 1253
1254 i_size_write(inode, size); 1254 i_size_write(inode, size);
1255 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1255 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
1256 gfs2_trans_add_meta(ip->i_gl, dibh); 1256 gfs2_trans_add_meta(ip->i_gl, dibh);
1257 gfs2_dinode_out(ip, dibh->b_data); 1257 gfs2_dinode_out(ip, dibh->b_data);
1258 brelse(dibh); 1258 brelse(dibh);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index db8fbeb62483..3cdde5f5d399 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -135,7 +135,7 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
135 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); 135 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
136 if (ip->i_inode.i_size < offset + size) 136 if (ip->i_inode.i_size < offset + size)
137 i_size_write(&ip->i_inode, offset + size); 137 i_size_write(&ip->i_inode, offset + size);
138 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 138 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
139 gfs2_dinode_out(ip, dibh->b_data); 139 gfs2_dinode_out(ip, dibh->b_data);
140 140
141 brelse(dibh); 141 brelse(dibh);
@@ -233,7 +233,7 @@ out:
233 233
234 if (ip->i_inode.i_size < offset + copied) 234 if (ip->i_inode.i_size < offset + copied)
235 i_size_write(&ip->i_inode, offset + copied); 235 i_size_write(&ip->i_inode, offset + copied);
236 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 236 ip->i_inode.i_mtime = ip->i_inode.i_ctime = current_time(&ip->i_inode);
237 237
238 gfs2_trans_add_meta(ip->i_gl, dibh); 238 gfs2_trans_add_meta(ip->i_gl, dibh);
239 gfs2_dinode_out(ip, dibh->b_data); 239 gfs2_dinode_out(ip, dibh->b_data);
@@ -872,7 +872,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
872 struct gfs2_leaf *leaf; 872 struct gfs2_leaf *leaf;
873 struct gfs2_dirent *dent; 873 struct gfs2_dirent *dent;
874 struct qstr name = { .name = "" }; 874 struct qstr name = { .name = "" };
875 struct timespec tv = CURRENT_TIME; 875 struct timespec tv = current_time(inode);
876 876
877 error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL); 877 error = gfs2_alloc_blocks(ip, &bn, &n, 0, NULL);
878 if (error) 878 if (error)
@@ -1816,7 +1816,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
1816 gfs2_inum_out(nip, dent); 1816 gfs2_inum_out(nip, dent);
1817 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode)); 1817 dent->de_type = cpu_to_be16(IF2DT(nip->i_inode.i_mode));
1818 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip)); 1818 dent->de_rahead = cpu_to_be16(gfs2_inode_ra_len(nip));
1819 tv = CURRENT_TIME; 1819 tv = current_time(&ip->i_inode);
1820 if (ip->i_diskflags & GFS2_DIF_EXHASH) { 1820 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
1821 leaf = (struct gfs2_leaf *)bh->b_data; 1821 leaf = (struct gfs2_leaf *)bh->b_data;
1822 be16_add_cpu(&leaf->lf_entries, 1); 1822 be16_add_cpu(&leaf->lf_entries, 1);
@@ -1878,7 +1878,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry)
1878 const struct qstr *name = &dentry->d_name; 1878 const struct qstr *name = &dentry->d_name;
1879 struct gfs2_dirent *dent, *prev = NULL; 1879 struct gfs2_dirent *dent, *prev = NULL;
1880 struct buffer_head *bh; 1880 struct buffer_head *bh;
1881 struct timespec tv = CURRENT_TIME; 1881 struct timespec tv = current_time(&dip->i_inode);
1882 1882
1883 /* Returns _either_ the entry (if its first in block) or the 1883 /* Returns _either_ the entry (if its first in block) or the
1884 previous entry otherwise */ 1884 previous entry otherwise */
@@ -1960,7 +1960,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1960 gfs2_trans_add_meta(dip->i_gl, bh); 1960 gfs2_trans_add_meta(dip->i_gl, bh);
1961 } 1961 }
1962 1962
1963 dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME; 1963 dip->i_inode.i_mtime = dip->i_inode.i_ctime = current_time(&dip->i_inode);
1964 gfs2_dinode_out(dip, bh->b_data); 1964 gfs2_dinode_out(dip, bh->b_data);
1965 brelse(bh); 1965 brelse(bh);
1966 return 0; 1966 return 0;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index f6c4f0058899..fe3f84995c48 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -656,7 +656,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
656 set_nlink(inode, S_ISDIR(mode) ? 2 : 1); 656 set_nlink(inode, S_ISDIR(mode) ? 2 : 1);
657 inode->i_rdev = dev; 657 inode->i_rdev = dev;
658 inode->i_size = size; 658 inode->i_size = size;
659 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 659 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
660 gfs2_set_inode_blocks(inode, 1); 660 gfs2_set_inode_blocks(inode, 1);
661 munge_mode_uid_gid(dip, inode); 661 munge_mode_uid_gid(dip, inode);
662 check_and_update_goal(dip); 662 check_and_update_goal(dip);
@@ -983,7 +983,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
983 983
984 gfs2_trans_add_meta(ip->i_gl, dibh); 984 gfs2_trans_add_meta(ip->i_gl, dibh);
985 inc_nlink(&ip->i_inode); 985 inc_nlink(&ip->i_inode);
986 ip->i_inode.i_ctime = CURRENT_TIME; 986 ip->i_inode.i_ctime = current_time(&ip->i_inode);
987 ihold(inode); 987 ihold(inode);
988 d_instantiate(dentry, inode); 988 d_instantiate(dentry, inode);
989 mark_inode_dirty(inode); 989 mark_inode_dirty(inode);
@@ -1067,7 +1067,7 @@ static int gfs2_unlink_inode(struct gfs2_inode *dip,
1067 return error; 1067 return error;
1068 1068
1069 ip->i_entries = 0; 1069 ip->i_entries = 0;
1070 inode->i_ctime = CURRENT_TIME; 1070 inode->i_ctime = current_time(inode);
1071 if (S_ISDIR(inode->i_mode)) 1071 if (S_ISDIR(inode->i_mode))
1072 clear_nlink(inode); 1072 clear_nlink(inode);
1073 else 1073 else
@@ -1330,7 +1330,7 @@ static int update_moved_ino(struct gfs2_inode *ip, struct gfs2_inode *ndip,
1330 error = gfs2_meta_inode_buffer(ip, &dibh); 1330 error = gfs2_meta_inode_buffer(ip, &dibh);
1331 if (error) 1331 if (error)
1332 return error; 1332 return error;
1333 ip->i_inode.i_ctime = CURRENT_TIME; 1333 ip->i_inode.i_ctime = current_time(&ip->i_inode);
1334 gfs2_trans_add_meta(ip->i_gl, dibh); 1334 gfs2_trans_add_meta(ip->i_gl, dibh);
1335 gfs2_dinode_out(ip, dibh->b_data); 1335 gfs2_dinode_out(ip, dibh->b_data);
1336 brelse(dibh); 1336 brelse(dibh);
@@ -2055,7 +2055,7 @@ const struct inode_operations gfs2_dir_iops = {
2055 .mkdir = gfs2_mkdir, 2055 .mkdir = gfs2_mkdir,
2056 .rmdir = gfs2_unlink, 2056 .rmdir = gfs2_unlink,
2057 .mknod = gfs2_mknod, 2057 .mknod = gfs2_mknod,
2058 .rename2 = gfs2_rename2, 2058 .rename = gfs2_rename2,
2059 .permission = gfs2_permission, 2059 .permission = gfs2_permission,
2060 .setattr = gfs2_setattr, 2060 .setattr = gfs2_setattr,
2061 .getattr = gfs2_getattr, 2061 .getattr = gfs2_getattr,
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 8af2dfa09236..c2ca9566b764 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -854,7 +854,7 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc,
854 size = loc + sizeof(struct gfs2_quota); 854 size = loc + sizeof(struct gfs2_quota);
855 if (size > inode->i_size) 855 if (size > inode->i_size)
856 i_size_write(inode, size); 856 i_size_write(inode, size);
857 inode->i_mtime = inode->i_atime = CURRENT_TIME; 857 inode->i_mtime = inode->i_atime = current_time(inode);
858 mark_inode_dirty(inode); 858 mark_inode_dirty(inode);
859 set_bit(QDF_REFRESH, &qd->qd_flags); 859 set_bit(QDF_REFRESH, &qd->qd_flags);
860 } 860 }
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 3a2853504084..a4a577088d19 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -309,7 +309,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
309 309
310 error = gfs2_meta_inode_buffer(ip, &dibh); 310 error = gfs2_meta_inode_buffer(ip, &dibh);
311 if (!error) { 311 if (!error) {
312 ip->i_inode.i_ctime = CURRENT_TIME; 312 ip->i_inode.i_ctime = current_time(&ip->i_inode);
313 gfs2_trans_add_meta(ip->i_gl, dibh); 313 gfs2_trans_add_meta(ip->i_gl, dibh);
314 gfs2_dinode_out(ip, dibh->b_data); 314 gfs2_dinode_out(ip, dibh->b_data);
315 brelse(dibh); 315 brelse(dibh);
@@ -775,7 +775,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
775 775
776 error = gfs2_meta_inode_buffer(ip, &dibh); 776 error = gfs2_meta_inode_buffer(ip, &dibh);
777 if (!error) { 777 if (!error) {
778 ip->i_inode.i_ctime = CURRENT_TIME; 778 ip->i_inode.i_ctime = current_time(&ip->i_inode);
779 gfs2_trans_add_meta(ip->i_gl, dibh); 779 gfs2_trans_add_meta(ip->i_gl, dibh);
780 gfs2_dinode_out(ip, dibh->b_data); 780 gfs2_dinode_out(ip, dibh->b_data);
781 brelse(dibh); 781 brelse(dibh);
@@ -910,7 +910,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
910 error = gfs2_meta_inode_buffer(ip, &dibh); 910 error = gfs2_meta_inode_buffer(ip, &dibh);
911 if (error) 911 if (error)
912 goto out; 912 goto out;
913 ip->i_inode.i_ctime = CURRENT_TIME; 913 ip->i_inode.i_ctime = current_time(&ip->i_inode);
914 gfs2_trans_add_meta(ip->i_gl, dibh); 914 gfs2_trans_add_meta(ip->i_gl, dibh);
915 gfs2_dinode_out(ip, dibh->b_data); 915 gfs2_dinode_out(ip, dibh->b_data);
916 brelse(dibh); 916 brelse(dibh);
@@ -1133,7 +1133,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1133 1133
1134 error = gfs2_meta_inode_buffer(ip, &dibh); 1134 error = gfs2_meta_inode_buffer(ip, &dibh);
1135 if (!error) { 1135 if (!error) {
1136 ip->i_inode.i_ctime = CURRENT_TIME; 1136 ip->i_inode.i_ctime = current_time(&ip->i_inode);
1137 gfs2_trans_add_meta(ip->i_gl, dibh); 1137 gfs2_trans_add_meta(ip->i_gl, dibh);
1138 gfs2_dinode_out(ip, dibh->b_data); 1138 gfs2_dinode_out(ip, dibh->b_data);
1139 brelse(dibh); 1139 brelse(dibh);
diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
index 8f4afd3f5108..8a66405b0f8b 100644
--- a/fs/hfs/catalog.c
+++ b/fs/hfs/catalog.c
@@ -125,7 +125,7 @@ int hfs_cat_create(u32 cnid, struct inode *dir, const struct qstr *str, struct i
125 goto err1; 125 goto err1;
126 126
127 dir->i_size++; 127 dir->i_size++;
128 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 128 dir->i_mtime = dir->i_ctime = current_time(dir);
129 mark_inode_dirty(dir); 129 mark_inode_dirty(dir);
130 hfs_find_exit(&fd); 130 hfs_find_exit(&fd);
131 return 0; 131 return 0;
@@ -261,7 +261,7 @@ int hfs_cat_delete(u32 cnid, struct inode *dir, const struct qstr *str)
261 } 261 }
262 262
263 dir->i_size--; 263 dir->i_size--;
264 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 264 dir->i_mtime = dir->i_ctime = current_time(dir);
265 mark_inode_dirty(dir); 265 mark_inode_dirty(dir);
266 res = 0; 266 res = 0;
267out: 267out:
@@ -321,7 +321,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,
321 if (err) 321 if (err)
322 goto out; 322 goto out;
323 dst_dir->i_size++; 323 dst_dir->i_size++;
324 dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; 324 dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir);
325 mark_inode_dirty(dst_dir); 325 mark_inode_dirty(dst_dir);
326 326
327 /* finally remove the old entry */ 327 /* finally remove the old entry */
@@ -333,7 +333,7 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, const struct qstr *src_name,
333 if (err) 333 if (err)
334 goto out; 334 goto out;
335 src_dir->i_size--; 335 src_dir->i_size--;
336 src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; 336 src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir);
337 mark_inode_dirty(src_dir); 337 mark_inode_dirty(src_dir);
338 338
339 type = entry.type; 339 type = entry.type;
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 163190ecc0d2..5de5c48b418d 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -268,7 +268,7 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
268 if (res) 268 if (res)
269 return res; 269 return res;
270 clear_nlink(inode); 270 clear_nlink(inode);
271 inode->i_ctime = CURRENT_TIME_SEC; 271 inode->i_ctime = current_time(inode);
272 hfs_delete_inode(inode); 272 hfs_delete_inode(inode);
273 mark_inode_dirty(inode); 273 mark_inode_dirty(inode);
274 return 0; 274 return 0;
@@ -286,10 +286,14 @@ static int hfs_remove(struct inode *dir, struct dentry *dentry)
286 * XXX: how do you handle must_be dir? 286 * XXX: how do you handle must_be dir?
287 */ 287 */
288static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, 288static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
289 struct inode *new_dir, struct dentry *new_dentry) 289 struct inode *new_dir, struct dentry *new_dentry,
290 unsigned int flags)
290{ 291{
291 int res; 292 int res;
292 293
294 if (flags & ~RENAME_NOREPLACE)
295 return -EINVAL;
296
293 /* Unlink destination if it already exists */ 297 /* Unlink destination if it already exists */
294 if (d_really_is_positive(new_dentry)) { 298 if (d_really_is_positive(new_dentry)) {
295 res = hfs_remove(new_dir, new_dentry); 299 res = hfs_remove(new_dir, new_dentry);
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index ed373261f26d..f776acf2378a 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -194,7 +194,7 @@ struct inode *hfs_new_inode(struct inode *dir, const struct qstr *name, umode_t
194 inode->i_uid = current_fsuid(); 194 inode->i_uid = current_fsuid();
195 inode->i_gid = current_fsgid(); 195 inode->i_gid = current_fsgid();
196 set_nlink(inode, 1); 196 set_nlink(inode, 1);
197 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 197 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
198 HFS_I(inode)->flags = 0; 198 HFS_I(inode)->flags = 0;
199 HFS_I(inode)->rsrc_inode = NULL; 199 HFS_I(inode)->rsrc_inode = NULL;
200 HFS_I(inode)->fs_blocks = 0; 200 HFS_I(inode)->fs_blocks = 0;
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
index 142534d3c2d5..a5e00f7a4c14 100644
--- a/fs/hfsplus/catalog.c
+++ b/fs/hfsplus/catalog.c
@@ -303,7 +303,7 @@ int hfsplus_create_cat(u32 cnid, struct inode *dir,
303 dir->i_size++; 303 dir->i_size++;
304 if (S_ISDIR(inode->i_mode)) 304 if (S_ISDIR(inode->i_mode))
305 hfsplus_subfolders_inc(dir); 305 hfsplus_subfolders_inc(dir);
306 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 306 dir->i_mtime = dir->i_ctime = current_time(dir);
307 hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); 307 hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
308 308
309 hfs_find_exit(&fd); 309 hfs_find_exit(&fd);
@@ -400,7 +400,7 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, const struct qstr *str)
400 dir->i_size--; 400 dir->i_size--;
401 if (type == HFSPLUS_FOLDER) 401 if (type == HFSPLUS_FOLDER)
402 hfsplus_subfolders_dec(dir); 402 hfsplus_subfolders_dec(dir);
403 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 403 dir->i_mtime = dir->i_ctime = current_time(dir);
404 hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); 404 hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY);
405 405
406 if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) { 406 if (type == HFSPLUS_FILE || type == HFSPLUS_FOLDER) {
@@ -469,7 +469,7 @@ int hfsplus_rename_cat(u32 cnid,
469 dst_dir->i_size++; 469 dst_dir->i_size++;
470 if (type == HFSPLUS_FOLDER) 470 if (type == HFSPLUS_FOLDER)
471 hfsplus_subfolders_inc(dst_dir); 471 hfsplus_subfolders_inc(dst_dir);
472 dst_dir->i_mtime = dst_dir->i_ctime = CURRENT_TIME_SEC; 472 dst_dir->i_mtime = dst_dir->i_ctime = current_time(dst_dir);
473 473
474 /* finally remove the old entry */ 474 /* finally remove the old entry */
475 err = hfsplus_cat_build_key(sb, src_fd.search_key, 475 err = hfsplus_cat_build_key(sb, src_fd.search_key,
@@ -486,7 +486,7 @@ int hfsplus_rename_cat(u32 cnid,
486 src_dir->i_size--; 486 src_dir->i_size--;
487 if (type == HFSPLUS_FOLDER) 487 if (type == HFSPLUS_FOLDER)
488 hfsplus_subfolders_dec(src_dir); 488 hfsplus_subfolders_dec(src_dir);
489 src_dir->i_mtime = src_dir->i_ctime = CURRENT_TIME_SEC; 489 src_dir->i_mtime = src_dir->i_ctime = current_time(src_dir);
490 490
491 /* remove old thread entry */ 491 /* remove old thread entry */
492 hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid); 492 hfsplus_cat_build_key_with_cnid(sb, src_fd.search_key, cnid);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 9cbe43075de5..31d5e3f1fe17 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -347,7 +347,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
347 inc_nlink(inode); 347 inc_nlink(inode);
348 hfsplus_instantiate(dst_dentry, inode, cnid); 348 hfsplus_instantiate(dst_dentry, inode, cnid);
349 ihold(inode); 349 ihold(inode);
350 inode->i_ctime = CURRENT_TIME_SEC; 350 inode->i_ctime = current_time(inode);
351 mark_inode_dirty(inode); 351 mark_inode_dirty(inode);
352 sbi->file_count++; 352 sbi->file_count++;
353 hfsplus_mark_mdb_dirty(dst_dir->i_sb); 353 hfsplus_mark_mdb_dirty(dst_dir->i_sb);
@@ -406,7 +406,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
406 hfsplus_delete_inode(inode); 406 hfsplus_delete_inode(inode);
407 } else 407 } else
408 sbi->file_count--; 408 sbi->file_count--;
409 inode->i_ctime = CURRENT_TIME_SEC; 409 inode->i_ctime = current_time(inode);
410 mark_inode_dirty(inode); 410 mark_inode_dirty(inode);
411out: 411out:
412 mutex_unlock(&sbi->vh_mutex); 412 mutex_unlock(&sbi->vh_mutex);
@@ -427,7 +427,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
427 if (res) 427 if (res)
428 goto out; 428 goto out;
429 clear_nlink(inode); 429 clear_nlink(inode);
430 inode->i_ctime = CURRENT_TIME_SEC; 430 inode->i_ctime = current_time(inode);
431 hfsplus_delete_inode(inode); 431 hfsplus_delete_inode(inode);
432 mark_inode_dirty(inode); 432 mark_inode_dirty(inode);
433out: 433out:
@@ -530,10 +530,14 @@ static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
530} 530}
531 531
532static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, 532static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry,
533 struct inode *new_dir, struct dentry *new_dentry) 533 struct inode *new_dir, struct dentry *new_dentry,
534 unsigned int flags)
534{ 535{
535 int res; 536 int res;
536 537
538 if (flags & ~RENAME_NOREPLACE)
539 return -EINVAL;
540
537 /* Unlink destination if it already exists */ 541 /* Unlink destination if it already exists */
538 if (d_really_is_positive(new_dentry)) { 542 if (d_really_is_positive(new_dentry)) {
539 if (d_is_dir(new_dentry)) 543 if (d_is_dir(new_dentry))
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 10827c912c4d..2e796f8302ff 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -366,7 +366,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode)
366 inode->i_uid = current_fsuid(); 366 inode->i_uid = current_fsuid();
367 inode->i_gid = current_fsgid(); 367 inode->i_gid = current_fsgid();
368 set_nlink(inode, 1); 368 set_nlink(inode, 1);
369 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 369 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
370 370
371 hip = HFSPLUS_I(inode); 371 hip = HFSPLUS_I(inode);
372 INIT_LIST_HEAD(&hip->open_dir_list); 372 INIT_LIST_HEAD(&hip->open_dir_list);
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index 32a49e292b6a..99627f8a0a18 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -122,7 +122,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
122 else 122 else
123 hip->userflags &= ~HFSPLUS_FLG_NODUMP; 123 hip->userflags &= ~HFSPLUS_FLG_NODUMP;
124 124
125 inode->i_ctime = CURRENT_TIME_SEC; 125 inode->i_ctime = current_time(inode);
126 mark_inode_dirty(inode); 126 mark_inode_dirty(inode);
127 127
128out_unlock_inode: 128out_unlock_inode:
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 44aa96ba1df8..23e15ea53e45 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -885,7 +885,7 @@ static const struct inode_operations hostfs_dir_iops = {
885 .mkdir = hostfs_mkdir, 885 .mkdir = hostfs_mkdir,
886 .rmdir = hostfs_rmdir, 886 .rmdir = hostfs_rmdir,
887 .mknod = hostfs_mknod, 887 .mknod = hostfs_mknod,
888 .rename2 = hostfs_rename2, 888 .rename = hostfs_rename2,
889 .permission = hostfs_permission, 889 .permission = hostfs_permission,
890 .setattr = hostfs_setattr, 890 .setattr = hostfs_setattr,
891}; 891};
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index bb8d67e2740a..f30c14414518 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -507,7 +507,8 @@ const struct address_space_operations hpfs_symlink_aops = {
507}; 507};
508 508
509static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, 509static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
510 struct inode *new_dir, struct dentry *new_dentry) 510 struct inode *new_dir, struct dentry *new_dentry,
511 unsigned int flags)
511{ 512{
512 const unsigned char *old_name = old_dentry->d_name.name; 513 const unsigned char *old_name = old_dentry->d_name.name;
513 unsigned old_len = old_dentry->d_name.len; 514 unsigned old_len = old_dentry->d_name.len;
@@ -524,6 +525,9 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
524 struct fnode *fnode; 525 struct fnode *fnode;
525 int err; 526 int err;
526 527
528 if (flags & ~RENAME_NOREPLACE)
529 return -EINVAL;
530
527 if ((err = hpfs_chk_name(new_name, &new_len))) return err; 531 if ((err = hpfs_chk_name(new_name, &new_len))) return err;
528 err = 0; 532 err = 0;
529 hpfs_adjust_length(old_name, &old_len); 533 hpfs_adjust_length(old_name, &old_len);
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 2c0c3a017a6a..4fb7b10f3a05 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -655,7 +655,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
655 655
656 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) 656 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size)
657 i_size_write(inode, offset + len); 657 i_size_write(inode, offset + len);
658 inode->i_ctime = CURRENT_TIME; 658 inode->i_ctime = current_time(inode);
659out: 659out:
660 inode_unlock(inode); 660 inode_unlock(inode);
661 return error; 661 return error;
@@ -700,7 +700,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
700 inode->i_mode = S_IFDIR | config->mode; 700 inode->i_mode = S_IFDIR | config->mode;
701 inode->i_uid = config->uid; 701 inode->i_uid = config->uid;
702 inode->i_gid = config->gid; 702 inode->i_gid = config->gid;
703 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 703 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
704 info = HUGETLBFS_I(inode); 704 info = HUGETLBFS_I(inode);
705 mpol_shared_policy_init(&info->policy, NULL); 705 mpol_shared_policy_init(&info->policy, NULL);
706 inode->i_op = &hugetlbfs_dir_inode_operations; 706 inode->i_op = &hugetlbfs_dir_inode_operations;
@@ -739,7 +739,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
739 lockdep_set_class(&inode->i_mapping->i_mmap_rwsem, 739 lockdep_set_class(&inode->i_mapping->i_mmap_rwsem,
740 &hugetlbfs_i_mmap_rwsem_key); 740 &hugetlbfs_i_mmap_rwsem_key);
741 inode->i_mapping->a_ops = &hugetlbfs_aops; 741 inode->i_mapping->a_ops = &hugetlbfs_aops;
742 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 742 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
743 inode->i_mapping->private_data = resv_map; 743 inode->i_mapping->private_data = resv_map;
744 info = HUGETLBFS_I(inode); 744 info = HUGETLBFS_I(inode);
745 /* 745 /*
@@ -788,7 +788,7 @@ static int hugetlbfs_mknod(struct inode *dir,
788 788
789 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev); 789 inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev);
790 if (inode) { 790 if (inode) {
791 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 791 dir->i_ctime = dir->i_mtime = current_time(dir);
792 d_instantiate(dentry, inode); 792 d_instantiate(dentry, inode);
793 dget(dentry); /* Extra count - pin the dentry in core */ 793 dget(dentry); /* Extra count - pin the dentry in core */
794 error = 0; 794 error = 0;
@@ -825,7 +825,7 @@ static int hugetlbfs_symlink(struct inode *dir,
825 } else 825 } else
826 iput(inode); 826 iput(inode);
827 } 827 }
828 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 828 dir->i_ctime = dir->i_mtime = current_time(dir);
829 829
830 return error; 830 return error;
831} 831}
diff --git a/fs/inode.c b/fs/inode.c
index 7d037591259d..88110fd0b282 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1686,7 +1686,7 @@ bool __atime_needs_update(const struct path *path, struct inode *inode,
1686 if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) 1686 if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
1687 return false; 1687 return false;
1688 1688
1689 now = current_fs_time(inode->i_sb); 1689 now = current_time(inode);
1690 1690
1691 if (!relatime_need_update(path, inode, now, rcu)) 1691 if (!relatime_need_update(path, inode, now, rcu))
1692 return false; 1692 return false;
@@ -1720,7 +1720,7 @@ void touch_atime(const struct path *path)
1720 * We may also fail on filesystems that have the ability to make parts 1720 * We may also fail on filesystems that have the ability to make parts
1721 * of the fs read only, e.g. subvolumes in Btrfs. 1721 * of the fs read only, e.g. subvolumes in Btrfs.
1722 */ 1722 */
1723 now = current_fs_time(inode->i_sb); 1723 now = current_time(inode);
1724 update_time(inode, &now, S_ATIME); 1724 update_time(inode, &now, S_ATIME);
1725 __mnt_drop_write(mnt); 1725 __mnt_drop_write(mnt);
1726skip_update: 1726skip_update:
@@ -1843,7 +1843,7 @@ int file_update_time(struct file *file)
1843 if (IS_NOCMTIME(inode)) 1843 if (IS_NOCMTIME(inode))
1844 return 0; 1844 return 0;
1845 1845
1846 now = current_fs_time(inode->i_sb); 1846 now = current_time(inode);
1847 if (!timespec_equal(&inode->i_mtime, &now)) 1847 if (!timespec_equal(&inode->i_mtime, &now))
1848 sync_it = S_MTIME; 1848 sync_it = S_MTIME;
1849 1849
@@ -2099,3 +2099,26 @@ void inode_nohighmem(struct inode *inode)
2099 mapping_set_gfp_mask(inode->i_mapping, GFP_USER); 2099 mapping_set_gfp_mask(inode->i_mapping, GFP_USER);
2100} 2100}
2101EXPORT_SYMBOL(inode_nohighmem); 2101EXPORT_SYMBOL(inode_nohighmem);
2102
2103/**
2104 * current_time - Return FS time
2105 * @inode: inode.
2106 *
2107 * Return the current time truncated to the time granularity supported by
2108 * the fs.
2109 *
2110 * Note that inode and inode->sb cannot be NULL.
2111 * Otherwise, the function warns and returns time without truncation.
2112 */
2113struct timespec current_time(struct inode *inode)
2114{
2115 struct timespec now = current_kernel_time();
2116
2117 if (unlikely(!inode->i_sb)) {
2118 WARN(1, "current_time() called with uninitialized super_block in the inode");
2119 return now;
2120 }
2121
2122 return timespec_trunc(now, inode->i_sb->s_time_gran);
2123}
2124EXPORT_SYMBOL(current_time);
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 2a0f2a1044c1..7ebacf14837f 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -243,7 +243,7 @@ int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
243 243
244 attr.ia_valid = ATTR_MODE | ATTR_CTIME; 244 attr.ia_valid = ATTR_MODE | ATTR_CTIME;
245 attr.ia_mode = mode; 245 attr.ia_mode = mode;
246 attr.ia_ctime = CURRENT_TIME_SEC; 246 attr.ia_ctime = current_time(inode);
247 rc = jffs2_do_setattr(inode, &attr); 247 rc = jffs2_do_setattr(inode, &attr);
248 if (rc < 0) 248 if (rc < 0)
249 return rc; 249 return rc;
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index 9b242434adf2..0a754f38462e 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -35,7 +35,8 @@ static int jffs2_mkdir (struct inode *,struct dentry *,umode_t);
35static int jffs2_rmdir (struct inode *,struct dentry *); 35static int jffs2_rmdir (struct inode *,struct dentry *);
36static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); 36static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t);
37static int jffs2_rename (struct inode *, struct dentry *, 37static int jffs2_rename (struct inode *, struct dentry *,
38 struct inode *, struct dentry *); 38 struct inode *, struct dentry *,
39 unsigned int);
39 40
40const struct file_operations jffs2_dir_operations = 41const struct file_operations jffs2_dir_operations =
41{ 42{
@@ -756,7 +757,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
756} 757}
757 758
758static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, 759static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
759 struct inode *new_dir_i, struct dentry *new_dentry) 760 struct inode *new_dir_i, struct dentry *new_dentry,
761 unsigned int flags)
760{ 762{
761 int ret; 763 int ret;
762 struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); 764 struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb);
@@ -764,6 +766,9 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
764 uint8_t type; 766 uint8_t type;
765 uint32_t now; 767 uint32_t now;
766 768
769 if (flags & ~RENAME_NOREPLACE)
770 return -EINVAL;
771
767 /* The VFS will check for us and prevent trying to rename a 772 /* The VFS will check for us and prevent trying to rename a
768 * file over a directory and vice versa, but if it's a directory, 773 * file over a directory and vice versa, but if it's a directory,
769 * the VFS can't check whether the victim is empty. The filesystem 774 * the VFS can't check whether the victim is empty. The filesystem
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 3773b24b4db0..567653f7c0ce 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -472,7 +472,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, umode_t mode, struct jffs2_r
472 inode->i_mode = jemode_to_cpu(ri->mode); 472 inode->i_mode = jemode_to_cpu(ri->mode);
473 i_gid_write(inode, je16_to_cpu(ri->gid)); 473 i_gid_write(inode, je16_to_cpu(ri->gid));
474 i_uid_write(inode, je16_to_cpu(ri->uid)); 474 i_uid_write(inode, je16_to_cpu(ri->uid));
475 inode->i_atime = inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 475 inode->i_atime = inode->i_ctime = inode->i_mtime = current_time(inode);
476 ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime)); 476 ri->atime = ri->mtime = ri->ctime = cpu_to_je32(I_SEC(inode->i_mtime));
477 477
478 inode->i_blocks = 0; 478 inode->i_blocks = 0;
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 3a1e1554a4e3..7bc186f4ed4d 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -81,7 +81,7 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
81 rc = posix_acl_update_mode(inode, &inode->i_mode, &acl); 81 rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
82 if (rc) 82 if (rc)
83 return rc; 83 return rc;
84 inode->i_ctime = CURRENT_TIME; 84 inode->i_ctime = current_time(inode);
85 mark_inode_dirty(inode); 85 mark_inode_dirty(inode);
86 } 86 }
87 break; 87 break;
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index ad3e7b1effc4..054cc761b426 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -403,7 +403,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
403 break; 403 break;
404 } 404 }
405 405
406 ip->i_mtime = ip->i_ctime = CURRENT_TIME; 406 ip->i_mtime = ip->i_ctime = current_time(ip);
407 mark_inode_dirty(ip); 407 mark_inode_dirty(ip);
408 408
409 txCommit(tid, 1, &ip, 0); 409 txCommit(tid, 1, &ip, 0);
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index 5e33cb9a190d..375dd257a34f 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -131,7 +131,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
131 jfs_inode->mode2 |= inode->i_mode; 131 jfs_inode->mode2 |= inode->i_mode;
132 132
133 inode->i_blocks = 0; 133 inode->i_blocks = 0;
134 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 134 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
135 jfs_inode->otime = inode->i_ctime.tv_sec; 135 jfs_inode->otime = inode->i_ctime.tv_sec;
136 inode->i_generation = JFS_SBI(sb)->gengen++; 136 inode->i_generation = JFS_SBI(sb)->gengen++;
137 137
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index e420c6088336..b41596d71858 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -162,7 +162,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
162 162
163 mark_inode_dirty(ip); 163 mark_inode_dirty(ip);
164 164
165 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 165 dip->i_ctime = dip->i_mtime = current_time(dip);
166 166
167 mark_inode_dirty(dip); 167 mark_inode_dirty(dip);
168 168
@@ -298,7 +298,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
298 298
299 /* update parent directory inode */ 299 /* update parent directory inode */
300 inc_nlink(dip); /* for '..' from child directory */ 300 inc_nlink(dip); /* for '..' from child directory */
301 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 301 dip->i_ctime = dip->i_mtime = current_time(dip);
302 mark_inode_dirty(dip); 302 mark_inode_dirty(dip);
303 303
304 rc = txCommit(tid, 2, &iplist[0], 0); 304 rc = txCommit(tid, 2, &iplist[0], 0);
@@ -406,7 +406,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
406 /* update parent directory's link count corresponding 406 /* update parent directory's link count corresponding
407 * to ".." entry of the target directory deleted 407 * to ".." entry of the target directory deleted
408 */ 408 */
409 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 409 dip->i_ctime = dip->i_mtime = current_time(dip);
410 inode_dec_link_count(dip); 410 inode_dec_link_count(dip);
411 411
412 /* 412 /*
@@ -528,7 +528,7 @@ static int jfs_unlink(struct inode *dip, struct dentry *dentry)
528 528
529 ASSERT(ip->i_nlink); 529 ASSERT(ip->i_nlink);
530 530
531 ip->i_ctime = dip->i_ctime = dip->i_mtime = CURRENT_TIME; 531 ip->i_ctime = dip->i_ctime = dip->i_mtime = current_time(ip);
532 mark_inode_dirty(dip); 532 mark_inode_dirty(dip);
533 533
534 /* update target's inode */ 534 /* update target's inode */
@@ -838,8 +838,8 @@ static int jfs_link(struct dentry *old_dentry,
838 838
839 /* update object inode */ 839 /* update object inode */
840 inc_nlink(ip); /* for new link */ 840 inc_nlink(ip); /* for new link */
841 ip->i_ctime = CURRENT_TIME; 841 ip->i_ctime = current_time(ip);
842 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 842 dir->i_ctime = dir->i_mtime = current_time(dir);
843 mark_inode_dirty(dir); 843 mark_inode_dirty(dir);
844 ihold(ip); 844 ihold(ip);
845 845
@@ -1039,7 +1039,7 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1039 1039
1040 mark_inode_dirty(ip); 1040 mark_inode_dirty(ip);
1041 1041
1042 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 1042 dip->i_ctime = dip->i_mtime = current_time(dip);
1043 mark_inode_dirty(dip); 1043 mark_inode_dirty(dip);
1044 /* 1044 /*
1045 * commit update of parent directory and link object 1045 * commit update of parent directory and link object
@@ -1078,7 +1078,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
1078 * FUNCTION: rename a file or directory 1078 * FUNCTION: rename a file or directory
1079 */ 1079 */
1080static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, 1080static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1081 struct inode *new_dir, struct dentry *new_dentry) 1081 struct inode *new_dir, struct dentry *new_dentry,
1082 unsigned int flags)
1082{ 1083{
1083 struct btstack btstack; 1084 struct btstack btstack;
1084 ino_t ino; 1085 ino_t ino;
@@ -1097,6 +1098,8 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1097 s64 new_size = 0; 1098 s64 new_size = 0;
1098 int commit_flag; 1099 int commit_flag;
1099 1100
1101 if (flags & ~RENAME_NOREPLACE)
1102 return -EINVAL;
1100 1103
1101 jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry); 1104 jfs_info("jfs_rename: %pd %pd", old_dentry, new_dentry);
1102 1105
@@ -1215,7 +1218,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1215 tblk->xflag |= COMMIT_DELETE; 1218 tblk->xflag |= COMMIT_DELETE;
1216 tblk->u.ip = new_ip; 1219 tblk->u.ip = new_ip;
1217 } else { 1220 } else {
1218 new_ip->i_ctime = CURRENT_TIME; 1221 new_ip->i_ctime = current_time(new_ip);
1219 mark_inode_dirty(new_ip); 1222 mark_inode_dirty(new_ip);
1220 } 1223 }
1221 } else { 1224 } else {
@@ -1278,10 +1281,10 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1278 /* 1281 /*
1279 * Update ctime on changed/moved inodes & mark dirty 1282 * Update ctime on changed/moved inodes & mark dirty
1280 */ 1283 */
1281 old_ip->i_ctime = CURRENT_TIME; 1284 old_ip->i_ctime = current_time(old_ip);
1282 mark_inode_dirty(old_ip); 1285 mark_inode_dirty(old_ip);
1283 1286
1284 new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb); 1287 new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir);
1285 mark_inode_dirty(new_dir); 1288 mark_inode_dirty(new_dir);
1286 1289
1287 /* Build list of inodes modified by this transaction */ 1290 /* Build list of inodes modified by this transaction */
@@ -1293,7 +1296,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1293 1296
1294 if (old_dir != new_dir) { 1297 if (old_dir != new_dir) {
1295 iplist[ipcount++] = new_dir; 1298 iplist[ipcount++] = new_dir;
1296 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; 1299 old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
1297 mark_inode_dirty(old_dir); 1300 mark_inode_dirty(old_dir);
1298 } 1301 }
1299 1302
@@ -1426,7 +1429,7 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
1426 1429
1427 mark_inode_dirty(ip); 1430 mark_inode_dirty(ip);
1428 1431
1429 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 1432 dir->i_ctime = dir->i_mtime = current_time(dir);
1430 1433
1431 mark_inode_dirty(dir); 1434 mark_inode_dirty(dir);
1432 1435
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index cec8814a3b8b..85671f7f8518 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -830,7 +830,7 @@ out:
830 if (inode->i_size < off+len-towrite) 830 if (inode->i_size < off+len-towrite)
831 i_size_write(inode, off+len-towrite); 831 i_size_write(inode, off+len-towrite);
832 inode->i_version++; 832 inode->i_version++;
833 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 833 inode->i_mtime = inode->i_ctime = current_time(inode);
834 mark_inode_dirty(inode); 834 mark_inode_dirty(inode);
835 inode_unlock(inode); 835 inode_unlock(inode);
836 return len - towrite; 836 return len - towrite;
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
index 0bf3c33aedff..c60f3d32ee91 100644
--- a/fs/jfs/xattr.c
+++ b/fs/jfs/xattr.c
@@ -658,7 +658,7 @@ static int ea_put(tid_t tid, struct inode *inode, struct ea_buffer *ea_buf,
658 if (old_blocks) 658 if (old_blocks)
659 dquot_free_block(inode, old_blocks); 659 dquot_free_block(inode, old_blocks);
660 660
661 inode->i_ctime = CURRENT_TIME; 661 inode->i_ctime = current_time(inode);
662 662
663 return 0; 663 return 0;
664} 664}
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 2b23ad91a464..dcd96aac02f5 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -1096,13 +1096,17 @@ static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry)
1096} 1096}
1097 1097
1098static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry, 1098static int kernfs_iop_rename(struct inode *old_dir, struct dentry *old_dentry,
1099 struct inode *new_dir, struct dentry *new_dentry) 1099 struct inode *new_dir, struct dentry *new_dentry,
1100 unsigned int flags)
1100{ 1101{
1101 struct kernfs_node *kn = old_dentry->d_fsdata; 1102 struct kernfs_node *kn = old_dentry->d_fsdata;
1102 struct kernfs_node *new_parent = new_dir->i_private; 1103 struct kernfs_node *new_parent = new_dir->i_private;
1103 struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops; 1104 struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops;
1104 int ret; 1105 int ret;
1105 1106
1107 if (flags)
1108 return -EINVAL;
1109
1106 if (!scops || !scops->rename) 1110 if (!scops || !scops->rename)
1107 return -EPERM; 1111 return -EPERM;
1108 1112
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 102b6f0bc7af..a1982118f92f 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -168,7 +168,7 @@ static inline void set_default_inode_attr(struct inode *inode, umode_t mode)
168{ 168{
169 inode->i_mode = mode; 169 inode->i_mode = mode;
170 inode->i_atime = inode->i_mtime = 170 inode->i_atime = inode->i_mtime =
171 inode->i_ctime = current_fs_time(inode->i_sb); 171 inode->i_ctime = current_time(inode);
172} 172}
173 173
174static inline void set_inode_attr(struct inode *inode, struct iattr *iattr) 174static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
diff --git a/fs/libfs.c b/fs/libfs.c
index a6d89f151771..48826d4da189 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -266,7 +266,7 @@ struct dentry *mount_pseudo_xattr(struct file_system_type *fs_type, char *name,
266 */ 266 */
267 root->i_ino = 1; 267 root->i_ino = 1;
268 root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; 268 root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
269 root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; 269 root->i_atime = root->i_mtime = root->i_ctime = current_time(root);
270 dentry = __d_alloc(s, &d_name); 270 dentry = __d_alloc(s, &d_name);
271 if (!dentry) { 271 if (!dentry) {
272 iput(root); 272 iput(root);
@@ -296,7 +296,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
296{ 296{
297 struct inode *inode = d_inode(old_dentry); 297 struct inode *inode = d_inode(old_dentry);
298 298
299 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 299 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
300 inc_nlink(inode); 300 inc_nlink(inode);
301 ihold(inode); 301 ihold(inode);
302 dget(dentry); 302 dget(dentry);
@@ -330,7 +330,7 @@ int simple_unlink(struct inode *dir, struct dentry *dentry)
330{ 330{
331 struct inode *inode = d_inode(dentry); 331 struct inode *inode = d_inode(dentry);
332 332
333 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 333 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
334 drop_nlink(inode); 334 drop_nlink(inode);
335 dput(dentry); 335 dput(dentry);
336 return 0; 336 return 0;
@@ -350,11 +350,15 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
350EXPORT_SYMBOL(simple_rmdir); 350EXPORT_SYMBOL(simple_rmdir);
351 351
352int simple_rename(struct inode *old_dir, struct dentry *old_dentry, 352int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
353 struct inode *new_dir, struct dentry *new_dentry) 353 struct inode *new_dir, struct dentry *new_dentry,
354 unsigned int flags)
354{ 355{
355 struct inode *inode = d_inode(old_dentry); 356 struct inode *inode = d_inode(old_dentry);
356 int they_are_dirs = d_is_dir(old_dentry); 357 int they_are_dirs = d_is_dir(old_dentry);
357 358
359 if (flags & ~RENAME_NOREPLACE)
360 return -EINVAL;
361
358 if (!simple_empty(new_dentry)) 362 if (!simple_empty(new_dentry))
359 return -ENOTEMPTY; 363 return -ENOTEMPTY;
360 364
@@ -370,7 +374,7 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
370 } 374 }
371 375
372 old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = 376 old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
373 new_dir->i_mtime = inode->i_ctime = CURRENT_TIME; 377 new_dir->i_mtime = inode->i_ctime = current_time(old_dir);
374 378
375 return 0; 379 return 0;
376} 380}
@@ -521,7 +525,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
521 */ 525 */
522 inode->i_ino = 1; 526 inode->i_ino = 1;
523 inode->i_mode = S_IFDIR | 0755; 527 inode->i_mode = S_IFDIR | 0755;
524 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 528 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
525 inode->i_op = &simple_dir_inode_operations; 529 inode->i_op = &simple_dir_inode_operations;
526 inode->i_fop = &simple_dir_operations; 530 inode->i_fop = &simple_dir_operations;
527 set_nlink(inode, 2); 531 set_nlink(inode, 2);
@@ -547,7 +551,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
547 goto out; 551 goto out;
548 } 552 }
549 inode->i_mode = S_IFREG | files->mode; 553 inode->i_mode = S_IFREG | files->mode;
550 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 554 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
551 inode->i_fop = files->ops; 555 inode->i_fop = files->ops;
552 inode->i_ino = i; 556 inode->i_ino = i;
553 d_add(dentry, inode); 557 d_add(dentry, inode);
@@ -1093,7 +1097,7 @@ struct inode *alloc_anon_inode(struct super_block *s)
1093 inode->i_uid = current_fsuid(); 1097 inode->i_uid = current_fsuid();
1094 inode->i_gid = current_fsgid(); 1098 inode->i_gid = current_fsgid();
1095 inode->i_flags |= S_PRIVATE; 1099 inode->i_flags |= S_PRIVATE;
1096 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1100 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
1097 return inode; 1101 return inode;
1098} 1102}
1099EXPORT_SYMBOL(alloc_anon_inode); 1103EXPORT_SYMBOL(alloc_anon_inode);
diff --git a/fs/locks.c b/fs/locks.c
index 8cc218d7a039..ce93b416b490 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1569,7 +1569,7 @@ void lease_get_mtime(struct inode *inode, struct timespec *time)
1569 } 1569 }
1570 1570
1571 if (has_lease) 1571 if (has_lease)
1572 *time = current_fs_time(inode->i_sb); 1572 *time = current_time(inode);
1573 else 1573 else
1574 *time = inode->i_mtime; 1574 *time = inode->i_mtime;
1575} 1575}
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index 9568064ecadf..c87ea52de3d9 100644
--- a/fs/logfs/dir.c
+++ b/fs/logfs/dir.c
@@ -226,7 +226,7 @@ static int logfs_unlink(struct inode *dir, struct dentry *dentry)
226 ta->state = UNLINK_1; 226 ta->state = UNLINK_1;
227 ta->ino = inode->i_ino; 227 ta->ino = inode->i_ino;
228 228
229 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 229 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
230 230
231 page = logfs_get_dd_page(dir, dentry); 231 page = logfs_get_dd_page(dir, dentry);
232 if (!page) { 232 if (!page) {
@@ -540,7 +540,7 @@ static int logfs_link(struct dentry *old_dentry, struct inode *dir,
540{ 540{
541 struct inode *inode = d_inode(old_dentry); 541 struct inode *inode = d_inode(old_dentry);
542 542
543 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 543 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
544 ihold(inode); 544 ihold(inode);
545 inc_nlink(inode); 545 inc_nlink(inode);
546 mark_inode_dirty_sync(inode); 546 mark_inode_dirty_sync(inode);
@@ -573,7 +573,7 @@ static int logfs_delete_dd(struct inode *dir, loff_t pos)
573 * (crc-protected) journal. 573 * (crc-protected) journal.
574 */ 574 */
575 BUG_ON(beyond_eof(dir, pos)); 575 BUG_ON(beyond_eof(dir, pos));
576 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 576 dir->i_ctime = dir->i_mtime = current_time(dir);
577 log_dir(" Delete dentry (%lx, %llx)\n", dir->i_ino, pos); 577 log_dir(" Delete dentry (%lx, %llx)\n", dir->i_ino, pos);
578 return logfs_delete(dir, pos, NULL); 578 return logfs_delete(dir, pos, NULL);
579} 579}
@@ -718,8 +718,12 @@ out:
718} 718}
719 719
720static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry, 720static int logfs_rename(struct inode *old_dir, struct dentry *old_dentry,
721 struct inode *new_dir, struct dentry *new_dentry) 721 struct inode *new_dir, struct dentry *new_dentry,
722 unsigned int flags)
722{ 723{
724 if (flags & ~RENAME_NOREPLACE)
725 return -EINVAL;
726
723 if (d_really_is_positive(new_dentry)) 727 if (d_really_is_positive(new_dentry))
724 return logfs_rename_target(old_dir, old_dentry, 728 return logfs_rename_target(old_dir, old_dentry,
725 new_dir, new_dentry); 729 new_dir, new_dentry);
diff --git a/fs/logfs/file.c b/fs/logfs/file.c
index 5d9fe466bbc9..1db04930ad57 100644
--- a/fs/logfs/file.c
+++ b/fs/logfs/file.c
@@ -211,7 +211,7 @@ long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
211 li->li_flags = flags; 211 li->li_flags = flags;
212 inode_unlock(inode); 212 inode_unlock(inode);
213 213
214 inode->i_ctime = CURRENT_TIME; 214 inode->i_ctime = current_time(inode);
215 mark_inode_dirty_sync(inode); 215 mark_inode_dirty_sync(inode);
216 return 0; 216 return 0;
217 217
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c
index db9cfc598883..f440a1525da8 100644
--- a/fs/logfs/inode.c
+++ b/fs/logfs/inode.c
@@ -213,8 +213,8 @@ static void logfs_init_inode(struct super_block *sb, struct inode *inode)
213 i_gid_write(inode, 0); 213 i_gid_write(inode, 0);
214 inode->i_size = 0; 214 inode->i_size = 0;
215 inode->i_blocks = 0; 215 inode->i_blocks = 0;
216 inode->i_ctime = CURRENT_TIME; 216 inode->i_ctime = current_time(inode);
217 inode->i_mtime = CURRENT_TIME; 217 inode->i_mtime = current_time(inode);
218 li->li_refcount = 1; 218 li->li_refcount = 1;
219 INIT_LIST_HEAD(&li->li_freeing_list); 219 INIT_LIST_HEAD(&li->li_freeing_list);
220 220
diff --git a/fs/logfs/readwrite.c b/fs/logfs/readwrite.c
index 3fb8c6d67303..bf19bf4a243f 100644
--- a/fs/logfs/readwrite.c
+++ b/fs/logfs/readwrite.c
@@ -1546,7 +1546,7 @@ static int __logfs_write_buf(struct inode *inode, struct page *page, long flags)
1546 int err; 1546 int err;
1547 1547
1548 flags |= WF_WRITE | WF_DELETE; 1548 flags |= WF_WRITE | WF_DELETE;
1549 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 1549 inode->i_ctime = inode->i_mtime = current_time(inode);
1550 1550
1551 logfs_unpack_index(index, &bix, &level); 1551 logfs_unpack_index(index, &bix, &level);
1552 if (logfs_block(page) && logfs_block(page)->reserved_bytes) 1552 if (logfs_block(page) && logfs_block(page)->reserved_bytes)
@@ -1578,7 +1578,7 @@ static int __logfs_delete(struct inode *inode, struct page *page)
1578 long flags = WF_DELETE; 1578 long flags = WF_DELETE;
1579 int err; 1579 int err;
1580 1580
1581 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 1581 inode->i_ctime = inode->i_mtime = current_time(inode);
1582 1582
1583 if (page->index < I0_BLOCKS) 1583 if (page->index < I0_BLOCKS)
1584 return logfs_write_direct(inode, page, flags); 1584 return logfs_write_direct(inode, page, flags);
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index 742942a983be..c2c3fd3277b5 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -253,7 +253,7 @@ struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error)
253 } 253 }
254 inode_init_owner(inode, dir, mode); 254 inode_init_owner(inode, dir, mode);
255 inode->i_ino = j; 255 inode->i_ino = j;
256 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 256 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
257 inode->i_blocks = 0; 257 inode->i_blocks = 0;
258 memset(&minix_i(inode)->u, 0, sizeof(minix_i(inode)->u)); 258 memset(&minix_i(inode)->u, 0, sizeof(minix_i(inode)->u));
259 insert_inode_hash(inode); 259 insert_inode_hash(inode);
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 31dcd515b9d5..7edc9b395700 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -274,7 +274,7 @@ got_it:
274 de->inode = inode->i_ino; 274 de->inode = inode->i_ino;
275 } 275 }
276 err = dir_commit_chunk(page, pos, sbi->s_dirsize); 276 err = dir_commit_chunk(page, pos, sbi->s_dirsize);
277 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 277 dir->i_mtime = dir->i_ctime = current_time(dir);
278 mark_inode_dirty(dir); 278 mark_inode_dirty(dir);
279out_put: 279out_put:
280 dir_put_page(page); 280 dir_put_page(page);
@@ -306,7 +306,7 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
306 unlock_page(page); 306 unlock_page(page);
307 } 307 }
308 dir_put_page(page); 308 dir_put_page(page);
309 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 309 inode->i_ctime = inode->i_mtime = current_time(inode);
310 mark_inode_dirty(inode); 310 mark_inode_dirty(inode);
311 return err; 311 return err;
312} 312}
@@ -430,7 +430,7 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page,
430 unlock_page(page); 430 unlock_page(page);
431 } 431 }
432 dir_put_page(page); 432 dir_put_page(page);
433 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 433 dir->i_mtime = dir->i_ctime = current_time(dir);
434 mark_inode_dirty(dir); 434 mark_inode_dirty(dir);
435} 435}
436 436
diff --git a/fs/minix/itree_common.c b/fs/minix/itree_common.c
index a731cabf1540..4c57c9af6946 100644
--- a/fs/minix/itree_common.c
+++ b/fs/minix/itree_common.c
@@ -124,7 +124,7 @@ static inline int splice_branch(struct inode *inode,
124 124
125 /* We are done with atomic stuff, now do the rest of housekeeping */ 125 /* We are done with atomic stuff, now do the rest of housekeeping */
126 126
127 inode->i_ctime = CURRENT_TIME_SEC; 127 inode->i_ctime = current_time(inode);
128 128
129 /* had we spliced it onto indirect block? */ 129 /* had we spliced it onto indirect block? */
130 if (where->bh) 130 if (where->bh)
@@ -343,7 +343,7 @@ do_indirects:
343 } 343 }
344 first_whole++; 344 first_whole++;
345 } 345 }
346 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 346 inode->i_mtime = inode->i_ctime = current_time(inode);
347 mark_inode_dirty(inode); 347 mark_inode_dirty(inode);
348} 348}
349 349
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 2887d1d95ce2..1e0f11f5dac9 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -106,7 +106,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir,
106{ 106{
107 struct inode *inode = d_inode(old_dentry); 107 struct inode *inode = d_inode(old_dentry);
108 108
109 inode->i_ctime = CURRENT_TIME_SEC; 109 inode->i_ctime = current_time(inode);
110 inode_inc_link_count(inode); 110 inode_inc_link_count(inode);
111 ihold(inode); 111 ihold(inode);
112 return add_nondir(dentry, inode); 112 return add_nondir(dentry, inode);
@@ -185,7 +185,8 @@ static int minix_rmdir(struct inode * dir, struct dentry *dentry)
185} 185}
186 186
187static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, 187static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
188 struct inode * new_dir, struct dentry *new_dentry) 188 struct inode * new_dir, struct dentry *new_dentry,
189 unsigned int flags)
189{ 190{
190 struct inode * old_inode = d_inode(old_dentry); 191 struct inode * old_inode = d_inode(old_dentry);
191 struct inode * new_inode = d_inode(new_dentry); 192 struct inode * new_inode = d_inode(new_dentry);
@@ -195,6 +196,9 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
195 struct minix_dir_entry * old_de; 196 struct minix_dir_entry * old_de;
196 int err = -ENOENT; 197 int err = -ENOENT;
197 198
199 if (flags & ~RENAME_NOREPLACE)
200 return -EINVAL;
201
198 old_de = minix_find_entry(old_dentry, &old_page); 202 old_de = minix_find_entry(old_dentry, &old_page);
199 if (!old_de) 203 if (!old_de)
200 goto out; 204 goto out;
@@ -219,7 +223,7 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
219 if (!new_de) 223 if (!new_de)
220 goto out_dir; 224 goto out_dir;
221 minix_set_link(new_de, new_page, old_inode); 225 minix_set_link(new_de, new_page, old_inode);
222 new_inode->i_ctime = CURRENT_TIME_SEC; 226 new_inode->i_ctime = current_time(new_inode);
223 if (dir_de) 227 if (dir_de)
224 drop_nlink(new_inode); 228 drop_nlink(new_inode);
225 inode_dec_link_count(new_inode); 229 inode_dec_link_count(new_inode);
diff --git a/fs/namei.c b/fs/namei.c
index 4bbcae1ba58e..a7f601cd521a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4369,12 +4369,9 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
4369 if (error) 4369 if (error)
4370 return error; 4370 return error;
4371 4371
4372 if (!old_dir->i_op->rename && !old_dir->i_op->rename2) 4372 if (!old_dir->i_op->rename)
4373 return -EPERM; 4373 return -EPERM;
4374 4374
4375 if (flags && !old_dir->i_op->rename2)
4376 return -EINVAL;
4377
4378 /* 4375 /*
4379 * If we are going to change the parent - check write permissions, 4376 * If we are going to change the parent - check write permissions,
4380 * we'll need to flip '..'. 4377 * we'll need to flip '..'.
@@ -4428,14 +4425,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
4428 if (error) 4425 if (error)
4429 goto out; 4426 goto out;
4430 } 4427 }
4431 if (!old_dir->i_op->rename2) { 4428 error = old_dir->i_op->rename(old_dir, old_dentry,
4432 error = old_dir->i_op->rename(old_dir, old_dentry, 4429 new_dir, new_dentry, flags);
4433 new_dir, new_dentry);
4434 } else {
4435 WARN_ON(old_dir->i_op->rename != NULL);
4436 error = old_dir->i_op->rename2(old_dir, old_dentry,
4437 new_dir, new_dentry, flags);
4438 }
4439 if (error) 4430 if (error)
4440 goto out; 4431 goto out;
4441 4432
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 17de5c13dfae..6df2a3827574 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -36,7 +36,7 @@ static int ncp_unlink(struct inode *, struct dentry *);
36static int ncp_mkdir(struct inode *, struct dentry *, umode_t); 36static int ncp_mkdir(struct inode *, struct dentry *, umode_t);
37static int ncp_rmdir(struct inode *, struct dentry *); 37static int ncp_rmdir(struct inode *, struct dentry *);
38static int ncp_rename(struct inode *, struct dentry *, 38static int ncp_rename(struct inode *, struct dentry *,
39 struct inode *, struct dentry *); 39 struct inode *, struct dentry *, unsigned int);
40static int ncp_mknod(struct inode * dir, struct dentry *dentry, 40static int ncp_mknod(struct inode * dir, struct dentry *dentry,
41 umode_t mode, dev_t rdev); 41 umode_t mode, dev_t rdev);
42#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) 42#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
@@ -133,12 +133,11 @@ ncp_hash_dentry(const struct dentry *dentry, struct qstr *this)
133 return 0; 133 return 0;
134 134
135 if (!ncp_case_sensitive(inode)) { 135 if (!ncp_case_sensitive(inode)) {
136 struct super_block *sb = dentry->d_sb;
137 struct nls_table *t; 136 struct nls_table *t;
138 unsigned long hash; 137 unsigned long hash;
139 int i; 138 int i;
140 139
141 t = NCP_IO_TABLE(sb); 140 t = NCP_IO_TABLE(dentry->d_sb);
142 hash = init_name_hash(dentry); 141 hash = init_name_hash(dentry);
143 for (i=0; i<this->len ; i++) 142 for (i=0; i<this->len ; i++)
144 hash = partial_name_hash(ncp_tolower(t, this->name[i]), 143 hash = partial_name_hash(ncp_tolower(t, this->name[i]),
@@ -1106,13 +1105,17 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry)
1106} 1105}
1107 1106
1108static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, 1107static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
1109 struct inode *new_dir, struct dentry *new_dentry) 1108 struct inode *new_dir, struct dentry *new_dentry,
1109 unsigned int flags)
1110{ 1110{
1111 struct ncp_server *server = NCP_SERVER(old_dir); 1111 struct ncp_server *server = NCP_SERVER(old_dir);
1112 int error; 1112 int error;
1113 int old_len, new_len; 1113 int old_len, new_len;
1114 __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; 1114 __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1];
1115 1115
1116 if (flags)
1117 return -EINVAL;
1118
1116 ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry); 1119 ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry);
1117 1120
1118 ncp_age_dentry(server, old_dentry); 1121 ncp_age_dentry(server, old_dentry);
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 177fefb26c18..06e0bf092ba9 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2013,7 +2013,8 @@ EXPORT_SYMBOL_GPL(nfs_link);
2013 * the rename. 2013 * the rename.
2014 */ 2014 */
2015int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, 2015int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2016 struct inode *new_dir, struct dentry *new_dentry) 2016 struct inode *new_dir, struct dentry *new_dentry,
2017 unsigned int flags)
2017{ 2018{
2018 struct inode *old_inode = d_inode(old_dentry); 2019 struct inode *old_inode = d_inode(old_dentry);
2019 struct inode *new_inode = d_inode(new_dentry); 2020 struct inode *new_inode = d_inode(new_dentry);
@@ -2021,6 +2022,9 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2021 struct rpc_task *task; 2022 struct rpc_task *task;
2022 int error = -EBUSY; 2023 int error = -EBUSY;
2023 2024
2025 if (flags)
2026 return -EINVAL;
2027
2024 dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n", 2028 dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n",
2025 old_dentry, new_dentry, 2029 old_dentry, new_dentry,
2026 d_count(new_dentry)); 2030 d_count(new_dentry));
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 4b308a1487a5..a6acce663219 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -359,7 +359,8 @@ int nfs_unlink(struct inode *, struct dentry *);
359int nfs_symlink(struct inode *, struct dentry *, const char *); 359int nfs_symlink(struct inode *, struct dentry *, const char *);
360int nfs_link(struct dentry *, struct inode *, struct dentry *); 360int nfs_link(struct dentry *, struct inode *, struct dentry *);
361int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); 361int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t);
362int nfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 362int nfs_rename(struct inode *, struct dentry *,
363 struct inode *, struct dentry *, unsigned int);
363 364
364/* file.c */ 365/* file.c */
365int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); 366int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
diff --git a/fs/nfsd/blocklayout.c b/fs/nfsd/blocklayout.c
index 5a1708441510..0780ff864539 100644
--- a/fs/nfsd/blocklayout.c
+++ b/fs/nfsd/blocklayout.c
@@ -123,7 +123,7 @@ nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp,
123 123
124 if (lcp->lc_mtime.tv_nsec == UTIME_NOW || 124 if (lcp->lc_mtime.tv_nsec == UTIME_NOW ||
125 timespec_compare(&lcp->lc_mtime, &inode->i_mtime) < 0) 125 timespec_compare(&lcp->lc_mtime, &inode->i_mtime) < 0)
126 lcp->lc_mtime = current_fs_time(inode->i_sb); 126 lcp->lc_mtime = current_time(inode);
127 iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME; 127 iattr.ia_valid |= ATTR_ATIME | ATTR_CTIME | ATTR_MTIME;
128 iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; 128 iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime;
129 129
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 908ebbf0ac7e..582831ab3eb9 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -438,7 +438,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
438 nilfs_set_de_type(de, inode); 438 nilfs_set_de_type(de, inode);
439 nilfs_commit_chunk(page, mapping, from, to); 439 nilfs_commit_chunk(page, mapping, from, to);
440 nilfs_put_page(page); 440 nilfs_put_page(page);
441 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 441 dir->i_mtime = dir->i_ctime = current_time(dir);
442} 442}
443 443
444/* 444/*
@@ -528,7 +528,7 @@ got_it:
528 de->inode = cpu_to_le64(inode->i_ino); 528 de->inode = cpu_to_le64(inode->i_ino);
529 nilfs_set_de_type(de, inode); 529 nilfs_set_de_type(de, inode);
530 nilfs_commit_chunk(page, page->mapping, from, to); 530 nilfs_commit_chunk(page, page->mapping, from, to);
531 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 531 dir->i_mtime = dir->i_ctime = current_time(dir);
532 nilfs_mark_inode_dirty(dir); 532 nilfs_mark_inode_dirty(dir);
533 /* OFFSET_CACHE */ 533 /* OFFSET_CACHE */
534out_put: 534out_put:
@@ -576,7 +576,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
576 pde->rec_len = nilfs_rec_len_to_disk(to - from); 576 pde->rec_len = nilfs_rec_len_to_disk(to - from);
577 dir->inode = 0; 577 dir->inode = 0;
578 nilfs_commit_chunk(page, mapping, from, to); 578 nilfs_commit_chunk(page, mapping, from, to);
579 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 579 inode->i_ctime = inode->i_mtime = current_time(inode);
580out: 580out:
581 nilfs_put_page(page); 581 nilfs_put_page(page);
582 return err; 582 return err;
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 402c325e0467..c7f4fef9ebf5 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -367,7 +367,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
367 atomic64_inc(&root->inodes_count); 367 atomic64_inc(&root->inodes_count);
368 inode_init_owner(inode, dir, mode); 368 inode_init_owner(inode, dir, mode);
369 inode->i_ino = ino; 369 inode->i_ino = ino;
370 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 370 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
371 371
372 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) { 372 if (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) {
373 err = nilfs_bmap_read(ii->i_bmap, NULL); 373 err = nilfs_bmap_read(ii->i_bmap, NULL);
@@ -749,7 +749,7 @@ void nilfs_truncate(struct inode *inode)
749 749
750 nilfs_truncate_bmap(ii, blkoff); 750 nilfs_truncate_bmap(ii, blkoff);
751 751
752 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 752 inode->i_mtime = inode->i_ctime = current_time(inode);
753 if (IS_SYNC(inode)) 753 if (IS_SYNC(inode))
754 nilfs_set_transaction_flag(NILFS_TI_SYNC); 754 nilfs_set_transaction_flag(NILFS_TI_SYNC);
755 755
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index f1d7989459fd..1d2c3d7711fe 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -174,7 +174,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp,
174 (flags & FS_FL_USER_MODIFIABLE); 174 (flags & FS_FL_USER_MODIFIABLE);
175 175
176 nilfs_set_inode_flags(inode); 176 nilfs_set_inode_flags(inode);
177 inode->i_ctime = CURRENT_TIME; 177 inode->i_ctime = current_time(inode);
178 if (IS_SYNC(inode)) 178 if (IS_SYNC(inode))
179 nilfs_set_transaction_flag(NILFS_TI_SYNC); 179 nilfs_set_transaction_flag(NILFS_TI_SYNC);
180 180
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index dbcf1dc93a51..2b71c60fe982 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -194,7 +194,7 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir,
194 if (err) 194 if (err)
195 return err; 195 return err;
196 196
197 inode->i_ctime = CURRENT_TIME; 197 inode->i_ctime = current_time(inode);
198 inode_inc_link_count(inode); 198 inode_inc_link_count(inode);
199 ihold(inode); 199 ihold(inode);
200 200
@@ -350,7 +350,8 @@ static int nilfs_rmdir(struct inode *dir, struct dentry *dentry)
350} 350}
351 351
352static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, 352static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
353 struct inode *new_dir, struct dentry *new_dentry) 353 struct inode *new_dir, struct dentry *new_dentry,
354 unsigned int flags)
354{ 355{
355 struct inode *old_inode = d_inode(old_dentry); 356 struct inode *old_inode = d_inode(old_dentry);
356 struct inode *new_inode = d_inode(new_dentry); 357 struct inode *new_inode = d_inode(new_dentry);
@@ -361,6 +362,9 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
361 struct nilfs_transaction_info ti; 362 struct nilfs_transaction_info ti;
362 int err; 363 int err;
363 364
365 if (flags & ~RENAME_NOREPLACE)
366 return -EINVAL;
367
364 err = nilfs_transaction_begin(old_dir->i_sb, &ti, 1); 368 err = nilfs_transaction_begin(old_dir->i_sb, &ti, 1);
365 if (unlikely(err)) 369 if (unlikely(err))
366 return err; 370 return err;
@@ -391,7 +395,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
391 goto out_dir; 395 goto out_dir;
392 nilfs_set_link(new_dir, new_de, new_page, old_inode); 396 nilfs_set_link(new_dir, new_de, new_page, old_inode);
393 nilfs_mark_inode_dirty(new_dir); 397 nilfs_mark_inode_dirty(new_dir);
394 new_inode->i_ctime = CURRENT_TIME; 398 new_inode->i_ctime = current_time(new_inode);
395 if (dir_de) 399 if (dir_de)
396 drop_nlink(new_inode); 400 drop_nlink(new_inode);
397 drop_nlink(new_inode); 401 drop_nlink(new_inode);
@@ -410,7 +414,7 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry,
410 * Like most other Unix systems, set the ctime for inodes on a 414 * Like most other Unix systems, set the ctime for inodes on a
411 * rename. 415 * rename.
412 */ 416 */
413 old_inode->i_ctime = CURRENT_TIME; 417 old_inode->i_ctime = current_time(old_inode);
414 418
415 nilfs_delete_entry(old_de, old_page); 419 nilfs_delete_entry(old_de, old_page);
416 420
diff --git a/fs/nsfs.c b/fs/nsfs.c
index 30bb10034120..8718af895eab 100644
--- a/fs/nsfs.c
+++ b/fs/nsfs.c
@@ -78,7 +78,7 @@ slow:
78 return ERR_PTR(-ENOMEM); 78 return ERR_PTR(-ENOMEM);
79 } 79 }
80 inode->i_ino = ns->inum; 80 inode->i_ino = ns->inum;
81 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 81 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
82 inode->i_flags |= S_IMMUTABLE; 82 inode->i_flags |= S_IMMUTABLE;
83 inode->i_mode = S_IFREG | S_IRUGO; 83 inode->i_mode = S_IFREG | S_IRUGO;
84 inode->i_fop = &ns_file_operations; 84 inode->i_fop = &ns_file_operations;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 9d7a44872df5..7c410f879412 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -2813,7 +2813,7 @@ done:
2813 * for real. 2813 * for real.
2814 */ 2814 */
2815 if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { 2815 if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) {
2816 struct timespec now = current_fs_time(VFS_I(base_ni)->i_sb); 2816 struct timespec now = current_time(VFS_I(base_ni));
2817 int sync_it = 0; 2817 int sync_it = 0;
2818 2818
2819 if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) || 2819 if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) ||
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index d15d492ce47b..d3c009626032 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -2692,7 +2692,7 @@ mft_rec_already_initialized:
2692 2692
2693 /* Set the inode times to the current time. */ 2693 /* Set the inode times to the current time. */
2694 vi->i_atime = vi->i_mtime = vi->i_ctime = 2694 vi->i_atime = vi->i_mtime = vi->i_ctime =
2695 current_fs_time(vi->i_sb); 2695 current_time(vi);
2696 /* 2696 /*
2697 * Set the file size to 0, the ntfs inode sizes are set to 0 by 2697 * Set the file size to 0, the ntfs inode sizes are set to 0 by
2698 * the call to ntfs_init_big_inode() below. 2698 * the call to ntfs_init_big_inode() below.
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 164307b99405..bed1fcb63088 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -201,7 +201,7 @@ static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh,
201 } 201 }
202 202
203 inode->i_mode = new_mode; 203 inode->i_mode = new_mode;
204 inode->i_ctime = CURRENT_TIME; 204 inode->i_ctime = current_time(inode);
205 di->i_mode = cpu_to_le16(inode->i_mode); 205 di->i_mode = cpu_to_le16(inode->i_mode);
206 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 206 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
207 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 207 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index f165f867f332..f72712f6c28d 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -7293,7 +7293,7 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
7293 } 7293 }
7294 7294
7295 inode->i_blocks = ocfs2_inode_sector_count(inode); 7295 inode->i_blocks = ocfs2_inode_sector_count(inode);
7296 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 7296 inode->i_ctime = inode->i_mtime = current_time(inode);
7297 7297
7298 di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec); 7298 di->i_ctime = di->i_mtime = cpu_to_le64(inode->i_ctime.tv_sec);
7299 di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 7299 di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index bbb4b3e5b4ff..c5c5b9748ea3 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2030,7 +2030,7 @@ out_write_size:
2030 } 2030 }
2031 inode->i_blocks = ocfs2_inode_sector_count(inode); 2031 inode->i_blocks = ocfs2_inode_sector_count(inode);
2032 di->i_size = cpu_to_le64((u64)i_size_read(inode)); 2032 di->i_size = cpu_to_le64((u64)i_size_read(inode));
2033 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 2033 inode->i_mtime = inode->i_ctime = current_time(inode);
2034 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); 2034 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
2035 di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 2035 di->i_mtime_nsec = di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
2036 ocfs2_update_inode_fsync_trans(handle, inode, 1); 2036 ocfs2_update_inode_fsync_trans(handle, inode, 1);
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index e1adf285fc31..e7054e2ac922 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -1677,7 +1677,7 @@ int __ocfs2_add_entry(handle_t *handle,
1677 offset, ocfs2_dir_trailer_blk_off(dir->i_sb)); 1677 offset, ocfs2_dir_trailer_blk_off(dir->i_sb));
1678 1678
1679 if (ocfs2_dirent_would_fit(de, rec_len)) { 1679 if (ocfs2_dirent_would_fit(de, rec_len)) {
1680 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 1680 dir->i_mtime = dir->i_ctime = current_time(dir);
1681 retval = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh); 1681 retval = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh);
1682 if (retval < 0) { 1682 if (retval < 0) {
1683 mlog_errno(retval); 1683 mlog_errno(retval);
@@ -2990,7 +2990,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
2990 ocfs2_dinode_new_extent_list(dir, di); 2990 ocfs2_dinode_new_extent_list(dir, di);
2991 2991
2992 i_size_write(dir, sb->s_blocksize); 2992 i_size_write(dir, sb->s_blocksize);
2993 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 2993 dir->i_mtime = dir->i_ctime = current_time(dir);
2994 2994
2995 di->i_size = cpu_to_le64(sb->s_blocksize); 2995 di->i_size = cpu_to_le64(sb->s_blocksize);
2996 di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); 2996 di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec);
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index a0c3e03f9cd3..1079fae5aa12 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -398,7 +398,7 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb)
398 if (inode) { 398 if (inode) {
399 inode->i_ino = get_next_ino(); 399 inode->i_ino = get_next_ino();
400 inode_init_owner(inode, NULL, mode); 400 inode_init_owner(inode, NULL, mode);
401 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 401 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
402 inc_nlink(inode); 402 inc_nlink(inode);
403 403
404 inode->i_fop = &simple_dir_operations; 404 inode->i_fop = &simple_dir_operations;
@@ -421,7 +421,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
421 421
422 inode->i_ino = get_next_ino(); 422 inode->i_ino = get_next_ino();
423 inode_init_owner(inode, parent, mode); 423 inode_init_owner(inode, parent, mode);
424 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 424 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
425 425
426 ip = DLMFS_I(inode); 426 ip = DLMFS_I(inode);
427 ip->ip_conn = DLMFS_I(parent)->ip_conn; 427 ip->ip_conn = DLMFS_I(parent)->ip_conn;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index ba5c177d0ed6..000c234d7bbd 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -253,7 +253,7 @@ int ocfs2_should_update_atime(struct inode *inode,
253 return 0; 253 return 0;
254 } 254 }
255 255
256 now = CURRENT_TIME; 256 now = current_time(inode);
257 if ((now.tv_sec - inode->i_atime.tv_sec <= osb->s_atime_quantum)) 257 if ((now.tv_sec - inode->i_atime.tv_sec <= osb->s_atime_quantum))
258 return 0; 258 return 0;
259 else 259 else
@@ -287,7 +287,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
287 * have i_mutex to guard against concurrent changes to other 287 * have i_mutex to guard against concurrent changes to other
288 * inode fields. 288 * inode fields.
289 */ 289 */
290 inode->i_atime = CURRENT_TIME; 290 inode->i_atime = current_time(inode);
291 di->i_atime = cpu_to_le64(inode->i_atime.tv_sec); 291 di->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
292 di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); 292 di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
293 ocfs2_update_inode_fsync_trans(handle, inode, 0); 293 ocfs2_update_inode_fsync_trans(handle, inode, 0);
@@ -308,7 +308,7 @@ int ocfs2_set_inode_size(handle_t *handle,
308 308
309 i_size_write(inode, new_i_size); 309 i_size_write(inode, new_i_size);
310 inode->i_blocks = ocfs2_inode_sector_count(inode); 310 inode->i_blocks = ocfs2_inode_sector_count(inode);
311 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 311 inode->i_ctime = inode->i_mtime = current_time(inode);
312 312
313 status = ocfs2_mark_inode_dirty(handle, inode, fe_bh); 313 status = ocfs2_mark_inode_dirty(handle, inode, fe_bh);
314 if (status < 0) { 314 if (status < 0) {
@@ -429,7 +429,7 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
429 } 429 }
430 430
431 i_size_write(inode, new_i_size); 431 i_size_write(inode, new_i_size);
432 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 432 inode->i_ctime = inode->i_mtime = current_time(inode);
433 433
434 di = (struct ocfs2_dinode *) fe_bh->b_data; 434 di = (struct ocfs2_dinode *) fe_bh->b_data;
435 di->i_size = cpu_to_le64(new_i_size); 435 di->i_size = cpu_to_le64(new_i_size);
@@ -840,7 +840,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
840 i_size_write(inode, abs_to); 840 i_size_write(inode, abs_to);
841 inode->i_blocks = ocfs2_inode_sector_count(inode); 841 inode->i_blocks = ocfs2_inode_sector_count(inode);
842 di->i_size = cpu_to_le64((u64)i_size_read(inode)); 842 di->i_size = cpu_to_le64((u64)i_size_read(inode));
843 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 843 inode->i_mtime = inode->i_ctime = current_time(inode);
844 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec); 844 di->i_mtime = di->i_ctime = cpu_to_le64(inode->i_mtime.tv_sec);
845 di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 845 di->i_ctime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
846 di->i_mtime_nsec = di->i_ctime_nsec; 846 di->i_mtime_nsec = di->i_ctime_nsec;
@@ -1950,7 +1950,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
1950 if (change_size && i_size_read(inode) < size) 1950 if (change_size && i_size_read(inode) < size)
1951 i_size_write(inode, size); 1951 i_size_write(inode, size);
1952 1952
1953 inode->i_ctime = inode->i_mtime = CURRENT_TIME; 1953 inode->i_ctime = inode->i_mtime = current_time(inode);
1954 ret = ocfs2_mark_inode_dirty(handle, inode, di_bh); 1954 ret = ocfs2_mark_inode_dirty(handle, inode, di_bh);
1955 if (ret < 0) 1955 if (ret < 0)
1956 mlog_errno(ret); 1956 mlog_errno(ret);
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index e3d05d9901a3..4e8f32eb0bdb 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -953,7 +953,7 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context)
953 } 953 }
954 954
955 di = (struct ocfs2_dinode *)di_bh->b_data; 955 di = (struct ocfs2_dinode *)di_bh->b_data;
956 inode->i_ctime = CURRENT_TIME; 956 inode->i_ctime = current_time(inode);
957 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 957 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
958 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 958 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
959 ocfs2_update_inode_fsync_trans(handle, inode, 0); 959 ocfs2_update_inode_fsync_trans(handle, inode, 0);
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 6cc043ebb9fa..8d887c75765c 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -798,7 +798,7 @@ static int ocfs2_link(struct dentry *old_dentry,
798 } 798 }
799 799
800 inc_nlink(inode); 800 inc_nlink(inode);
801 inode->i_ctime = CURRENT_TIME; 801 inode->i_ctime = current_time(inode);
802 ocfs2_set_links_count(fe, inode->i_nlink); 802 ocfs2_set_links_count(fe, inode->i_nlink);
803 fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 803 fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
804 fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 804 fe->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
@@ -1000,7 +1000,7 @@ static int ocfs2_unlink(struct inode *dir,
1000 ocfs2_set_links_count(fe, inode->i_nlink); 1000 ocfs2_set_links_count(fe, inode->i_nlink);
1001 ocfs2_journal_dirty(handle, fe_bh); 1001 ocfs2_journal_dirty(handle, fe_bh);
1002 1002
1003 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 1003 dir->i_ctime = dir->i_mtime = current_time(dir);
1004 if (S_ISDIR(inode->i_mode)) 1004 if (S_ISDIR(inode->i_mode))
1005 drop_nlink(dir); 1005 drop_nlink(dir);
1006 1006
@@ -1203,7 +1203,8 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2)
1203static int ocfs2_rename(struct inode *old_dir, 1203static int ocfs2_rename(struct inode *old_dir,
1204 struct dentry *old_dentry, 1204 struct dentry *old_dentry,
1205 struct inode *new_dir, 1205 struct inode *new_dir,
1206 struct dentry *new_dentry) 1206 struct dentry *new_dentry,
1207 unsigned int flags)
1207{ 1208{
1208 int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; 1209 int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0;
1209 int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; 1210 int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0;
@@ -1228,6 +1229,9 @@ static int ocfs2_rename(struct inode *old_dir,
1228 struct ocfs2_dir_lookup_result target_insert = { NULL, }; 1229 struct ocfs2_dir_lookup_result target_insert = { NULL, };
1229 bool should_add_orphan = false; 1230 bool should_add_orphan = false;
1230 1231
1232 if (flags)
1233 return -EINVAL;
1234
1231 /* At some point it might be nice to break this function up a 1235 /* At some point it might be nice to break this function up a
1232 * bit. */ 1236 * bit. */
1233 1237
@@ -1537,7 +1541,7 @@ static int ocfs2_rename(struct inode *old_dir,
1537 new_dir_bh, &target_insert); 1541 new_dir_bh, &target_insert);
1538 } 1542 }
1539 1543
1540 old_inode->i_ctime = CURRENT_TIME; 1544 old_inode->i_ctime = current_time(old_inode);
1541 mark_inode_dirty(old_inode); 1545 mark_inode_dirty(old_inode);
1542 1546
1543 status = ocfs2_journal_access_di(handle, INODE_CACHE(old_inode), 1547 status = ocfs2_journal_access_di(handle, INODE_CACHE(old_inode),
@@ -1586,9 +1590,9 @@ static int ocfs2_rename(struct inode *old_dir,
1586 1590
1587 if (new_inode) { 1591 if (new_inode) {
1588 drop_nlink(new_inode); 1592 drop_nlink(new_inode);
1589 new_inode->i_ctime = CURRENT_TIME; 1593 new_inode->i_ctime = current_time(new_inode);
1590 } 1594 }
1591 old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; 1595 old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
1592 1596
1593 if (update_dot_dot) { 1597 if (update_dot_dot) {
1594 status = ocfs2_update_entry(old_inode, handle, 1598 status = ocfs2_update_entry(old_inode, handle,
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index 92bbe93bfe10..19238512a324 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -3778,7 +3778,7 @@ static int ocfs2_change_ctime(struct inode *inode,
3778 goto out_commit; 3778 goto out_commit;
3779 } 3779 }
3780 3780
3781 inode->i_ctime = CURRENT_TIME; 3781 inode->i_ctime = current_time(inode);
3782 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 3782 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
3783 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 3783 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
3784 3784
@@ -4094,7 +4094,7 @@ static int ocfs2_complete_reflink(struct inode *s_inode,
4094 * we want mtime to appear identical to the source and 4094 * we want mtime to appear identical to the source and
4095 * update ctime. 4095 * update ctime.
4096 */ 4096 */
4097 t_inode->i_ctime = CURRENT_TIME; 4097 t_inode->i_ctime = current_time(t_inode);
4098 4098
4099 di->i_ctime = cpu_to_le64(t_inode->i_ctime.tv_sec); 4099 di->i_ctime = cpu_to_le64(t_inode->i_ctime.tv_sec);
4100 di->i_ctime_nsec = cpu_to_le32(t_inode->i_ctime.tv_nsec); 4100 di->i_ctime_nsec = cpu_to_le32(t_inode->i_ctime.tv_nsec);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 5bb44f7a78ee..cb157a34a656 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -3431,7 +3431,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
3431 goto out; 3431 goto out;
3432 } 3432 }
3433 3433
3434 inode->i_ctime = CURRENT_TIME; 3434 inode->i_ctime = current_time(inode);
3435 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 3435 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
3436 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 3436 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
3437 ocfs2_journal_dirty(ctxt->handle, xis->inode_bh); 3437 ocfs2_journal_dirty(ctxt->handle, xis->inode_bh);
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index c8cbf3b60645..b7146526afff 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -143,7 +143,7 @@ static int omfs_add_link(struct dentry *dentry, struct inode *inode)
143 mark_buffer_dirty(bh); 143 mark_buffer_dirty(bh);
144 brelse(bh); 144 brelse(bh);
145 145
146 dir->i_ctime = CURRENT_TIME_SEC; 146 dir->i_ctime = current_time(dir);
147 147
148 /* mark affected inodes dirty to rebuild checksums */ 148 /* mark affected inodes dirty to rebuild checksums */
149 mark_inode_dirty(dir); 149 mark_inode_dirty(dir);
@@ -371,12 +371,16 @@ static bool omfs_fill_chain(struct inode *dir, struct dir_context *ctx,
371} 371}
372 372
373static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry, 373static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
374 struct inode *new_dir, struct dentry *new_dentry) 374 struct inode *new_dir, struct dentry *new_dentry,
375 unsigned int flags)
375{ 376{
376 struct inode *new_inode = d_inode(new_dentry); 377 struct inode *new_inode = d_inode(new_dentry);
377 struct inode *old_inode = d_inode(old_dentry); 378 struct inode *old_inode = d_inode(old_dentry);
378 int err; 379 int err;
379 380
381 if (flags & ~RENAME_NOREPLACE)
382 return -EINVAL;
383
380 if (new_inode) { 384 if (new_inode) {
381 /* overwriting existing file/dir */ 385 /* overwriting existing file/dir */
382 err = omfs_remove(new_dir, new_dentry); 386 err = omfs_remove(new_dir, new_dentry);
@@ -395,7 +399,7 @@ static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
395 if (err) 399 if (err)
396 goto out; 400 goto out;
397 401
398 old_inode->i_ctime = CURRENT_TIME_SEC; 402 old_inode->i_ctime = current_time(old_inode);
399 mark_inode_dirty(old_inode); 403 mark_inode_dirty(old_inode);
400out: 404out:
401 return err; 405 return err;
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 3d935c81789a..df7ea8543a2e 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -49,7 +49,7 @@ struct inode *omfs_new_inode(struct inode *dir, umode_t mode)
49 inode_init_owner(inode, NULL, mode); 49 inode_init_owner(inode, NULL, mode);
50 inode->i_mapping->a_ops = &omfs_aops; 50 inode->i_mapping->a_ops = &omfs_aops;
51 51
52 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 52 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
53 switch (mode & S_IFMT) { 53 switch (mode & S_IFMT) {
54 case S_IFDIR: 54 case S_IFDIR:
55 inode->i_op = &omfs_dir_inops; 55 inode->i_op = &omfs_dir_inops;
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index c7a86993d97e..c003a667ed1a 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -355,7 +355,7 @@ static struct inode *openprom_iget(struct super_block *sb, ino_t ino)
355 if (!inode) 355 if (!inode)
356 return ERR_PTR(-ENOMEM); 356 return ERR_PTR(-ENOMEM);
357 if (inode->i_state & I_NEW) { 357 if (inode->i_state & I_NEW) {
358 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 358 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
359 if (inode->i_ino == OPENPROM_ROOT_INO) { 359 if (inode->i_ino == OPENPROM_ROOT_INO) {
360 inode->i_op = &openprom_inode_operations; 360 inode->i_op = &openprom_inode_operations;
361 inode->i_fop = &openprom_operations; 361 inode->i_fop = &openprom_operations;
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 2aa088ab713b..66ea0cc37b18 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -384,7 +384,7 @@ out:
384 file_accessed(file); 384 file_accessed(file);
385 } else { 385 } else {
386 SetMtimeFlag(orangefs_inode); 386 SetMtimeFlag(orangefs_inode);
387 inode->i_mtime = CURRENT_TIME; 387 inode->i_mtime = current_time(inode);
388 mark_inode_dirty_sync(inode); 388 mark_inode_dirty_sync(inode);
389 } 389 }
390 } 390 }
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 0e3bd7e07f88..ef3b4eb54cf2 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -435,7 +435,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir,
435 inode->i_mode = mode; 435 inode->i_mode = mode;
436 inode->i_uid = current_fsuid(); 436 inode->i_uid = current_fsuid();
437 inode->i_gid = current_fsgid(); 437 inode->i_gid = current_fsgid();
438 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 438 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
439 inode->i_size = PAGE_SIZE; 439 inode->i_size = PAGE_SIZE;
440 inode->i_rdev = dev; 440 inode->i_rdev = dev;
441 441
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c
index 4d5576a21c82..d15d3d2dba62 100644
--- a/fs/orangefs/namei.c
+++ b/fs/orangefs/namei.c
@@ -81,7 +81,7 @@ static int orangefs_create(struct inode *dir,
81 dentry); 81 dentry);
82 82
83 SetMtimeFlag(parent); 83 SetMtimeFlag(parent);
84 dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); 84 dir->i_mtime = dir->i_ctime = current_time(dir);
85 mark_inode_dirty_sync(dir); 85 mark_inode_dirty_sync(dir);
86 ret = 0; 86 ret = 0;
87out: 87out:
@@ -254,7 +254,7 @@ static int orangefs_unlink(struct inode *dir, struct dentry *dentry)
254 drop_nlink(inode); 254 drop_nlink(inode);
255 255
256 SetMtimeFlag(parent); 256 SetMtimeFlag(parent);
257 dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); 257 dir->i_mtime = dir->i_ctime = current_time(dir);
258 mark_inode_dirty_sync(dir); 258 mark_inode_dirty_sync(dir);
259 } 259 }
260 return ret; 260 return ret;
@@ -331,7 +331,7 @@ static int orangefs_symlink(struct inode *dir,
331 dentry); 331 dentry);
332 332
333 SetMtimeFlag(parent); 333 SetMtimeFlag(parent);
334 dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); 334 dir->i_mtime = dir->i_ctime = current_time(dir);
335 mark_inode_dirty_sync(dir); 335 mark_inode_dirty_sync(dir);
336 ret = 0; 336 ret = 0;
337out: 337out:
@@ -399,7 +399,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
399 * across clients; keep constant at 1. 399 * across clients; keep constant at 1.
400 */ 400 */
401 SetMtimeFlag(parent); 401 SetMtimeFlag(parent);
402 dir->i_mtime = dir->i_ctime = current_fs_time(dir->i_sb); 402 dir->i_mtime = dir->i_ctime = current_time(dir);
403 mark_inode_dirty_sync(dir); 403 mark_inode_dirty_sync(dir);
404out: 404out:
405 op_release(new_op); 405 op_release(new_op);
@@ -409,11 +409,15 @@ out:
409static int orangefs_rename(struct inode *old_dir, 409static int orangefs_rename(struct inode *old_dir,
410 struct dentry *old_dentry, 410 struct dentry *old_dentry,
411 struct inode *new_dir, 411 struct inode *new_dir,
412 struct dentry *new_dentry) 412 struct dentry *new_dentry,
413 unsigned int flags)
413{ 414{
414 struct orangefs_kernel_op_s *new_op; 415 struct orangefs_kernel_op_s *new_op;
415 int ret; 416 int ret;
416 417
418 if (flags)
419 return -EINVAL;
420
417 gossip_debug(GOSSIP_NAME_DEBUG, 421 gossip_debug(GOSSIP_NAME_DEBUG,
418 "orangefs_rename: called (%pd2 => %pd2) ct=%d\n", 422 "orangefs_rename: called (%pd2 => %pd2) ct=%d\n",
419 old_dentry, new_dentry, d_count(new_dentry)); 423 old_dentry, new_dentry, d_count(new_dentry));
@@ -443,7 +447,7 @@ static int orangefs_rename(struct inode *old_dir,
443 ret); 447 ret);
444 448
445 if (new_dentry->d_inode) 449 if (new_dentry->d_inode)
446 new_dentry->d_inode->i_ctime = CURRENT_TIME; 450 new_dentry->d_inode->i_ctime = current_time(new_dentry->d_inode);
447 451
448 op_release(new_op); 452 op_release(new_op);
449 return ret; 453 return ret;
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
index 3a60e68ec965..5f90ddf778ba 100644
--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -1006,7 +1006,7 @@ const struct inode_operations ovl_dir_inode_operations = {
1006 .symlink = ovl_symlink, 1006 .symlink = ovl_symlink,
1007 .unlink = ovl_unlink, 1007 .unlink = ovl_unlink,
1008 .rmdir = ovl_rmdir, 1008 .rmdir = ovl_rmdir,
1009 .rename2 = ovl_rename2, 1009 .rename = ovl_rename2,
1010 .link = ovl_link, 1010 .link = ovl_link,
1011 .setattr = ovl_setattr, 1011 .setattr = ovl_setattr,
1012 .create = ovl_create, 1012 .create = ovl_create,
diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h
index 5813ccff8cd9..e218e741cb99 100644
--- a/fs/overlayfs/overlayfs.h
+++ b/fs/overlayfs/overlayfs.h
@@ -114,13 +114,13 @@ static inline int ovl_do_rename(struct inode *olddir, struct dentry *olddentry,
114{ 114{
115 int err; 115 int err;
116 116
117 pr_debug("rename2(%pd2, %pd2, 0x%x)\n", 117 pr_debug("rename(%pd2, %pd2, 0x%x)\n",
118 olddentry, newdentry, flags); 118 olddentry, newdentry, flags);
119 119
120 err = vfs_rename(olddir, olddentry, newdir, newdentry, NULL, flags); 120 err = vfs_rename(olddir, olddentry, newdir, newdentry, NULL, flags);
121 121
122 if (err) { 122 if (err) {
123 pr_debug("...rename2(%pd2, %pd2, ...) = %i\n", 123 pr_debug("...rename(%pd2, %pd2, ...) = %i\n",
124 olddentry, newdentry, err); 124 olddentry, newdentry, err);
125 } 125 }
126 return err; 126 return err;
diff --git a/fs/pipe.c b/fs/pipe.c
index 4fc422f0dea8..1f559f0608e1 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -713,7 +713,7 @@ static struct inode * get_pipe_inode(void)
713 inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR; 713 inode->i_mode = S_IFIFO | S_IRUSR | S_IWUSR;
714 inode->i_uid = current_fsuid(); 714 inode->i_uid = current_fsuid();
715 inode->i_gid = current_fsgid(); 715 inode->i_gid = current_fsgid();
716 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 716 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
717 717
718 return inode; 718 return inode;
719 719
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index da3f760a7e88..595522022aca 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -929,7 +929,7 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
929 acl = NULL; 929 acl = NULL;
930 } 930 }
931 931
932 inode->i_ctime = CURRENT_TIME; 932 inode->i_ctime = current_time(inode);
933 set_cached_acl(inode, type, acl); 933 set_cached_acl(inode, type, acl);
934 return 0; 934 return 0;
935} 935}
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 29fd7ef97be9..c2964d890c9a 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1671,7 +1671,7 @@ struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *t
1671 /* Common stuff */ 1671 /* Common stuff */
1672 ei = PROC_I(inode); 1672 ei = PROC_I(inode);
1673 inode->i_ino = get_next_ino(); 1673 inode->i_ino = get_next_ino();
1674 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 1674 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
1675 inode->i_op = &proc_def_inode_operations; 1675 inode->i_op = &proc_def_inode_operations;
1676 1676
1677 /* 1677 /*
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index c1b72388e571..e69ebe648a34 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -68,7 +68,6 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
68 ei->sysctl_entry = NULL; 68 ei->sysctl_entry = NULL;
69 ei->ns_ops = NULL; 69 ei->ns_ops = NULL;
70 inode = &ei->vfs_inode; 70 inode = &ei->vfs_inode;
71 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
72 return inode; 71 return inode;
73} 72}
74 73
@@ -421,7 +420,7 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
421 420
422 if (inode) { 421 if (inode) {
423 inode->i_ino = de->low_ino; 422 inode->i_ino = de->low_ino;
424 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 423 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
425 PROC_I(inode)->pde = de; 424 PROC_I(inode)->pde = de;
426 425
427 if (is_empty_pde(de)) { 426 if (is_empty_pde(de)) {
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index f908b78bce55..55313d994895 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -445,7 +445,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
445 ei->sysctl = head; 445 ei->sysctl = head;
446 ei->sysctl_entry = table; 446 ei->sysctl_entry = table;
447 447
448 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 448 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
449 inode->i_mode = table->mode; 449 inode->i_mode = table->mode;
450 if (!S_ISDIR(table->mode)) { 450 if (!S_ISDIR(table->mode)) {
451 inode->i_mode |= S_IFREG; 451 inode->i_mode |= S_IFREG;
diff --git a/fs/proc/self.c b/fs/proc/self.c
index b6a8d3529fea..40245954c450 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
@@ -56,7 +56,7 @@ int proc_setup_self(struct super_block *s)
56 struct inode *inode = new_inode_pseudo(s); 56 struct inode *inode = new_inode_pseudo(s);
57 if (inode) { 57 if (inode) {
58 inode->i_ino = self_inum; 58 inode->i_ino = self_inum;
59 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 59 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
60 inode->i_mode = S_IFLNK | S_IRWXUGO; 60 inode->i_mode = S_IFLNK | S_IRWXUGO;
61 inode->i_uid = GLOBAL_ROOT_UID; 61 inode->i_uid = GLOBAL_ROOT_UID;
62 inode->i_gid = GLOBAL_ROOT_GID; 62 inode->i_gid = GLOBAL_ROOT_GID;
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c
index e58a31e8fb2a..595b90a9766c 100644
--- a/fs/proc/thread_self.c
+++ b/fs/proc/thread_self.c
@@ -58,7 +58,7 @@ int proc_setup_thread_self(struct super_block *s)
58 struct inode *inode = new_inode_pseudo(s); 58 struct inode *inode = new_inode_pseudo(s);
59 if (inode) { 59 if (inode) {
60 inode->i_ino = thread_self_inum; 60 inode->i_ino = thread_self_inum;
61 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 61 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
62 inode->i_mode = S_IFLNK | S_IRWXUGO; 62 inode->i_mode = S_IFLNK | S_IRWXUGO;
63 inode->i_uid = GLOBAL_ROOT_UID; 63 inode->i_uid = GLOBAL_ROOT_UID;
64 inode->i_gid = GLOBAL_ROOT_GID; 64 inode->i_gid = GLOBAL_ROOT_GID;
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index ec9ddef5ae75..1781dc50762e 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -230,7 +230,7 @@ static struct inode *pstore_get_inode(struct super_block *sb)
230 struct inode *inode = new_inode(sb); 230 struct inode *inode = new_inode(sb);
231 if (inode) { 231 if (inode) {
232 inode->i_ino = get_next_ino(); 232 inode->i_ino = get_next_ino();
233 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 233 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
234 } 234 }
235 return inode; 235 return inode;
236} 236}
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 1ab6e6c2e60e..8621c039b536 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -61,7 +61,7 @@ struct inode *ramfs_get_inode(struct super_block *sb,
61 inode->i_mapping->a_ops = &ramfs_aops; 61 inode->i_mapping->a_ops = &ramfs_aops;
62 mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER); 62 mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
63 mapping_set_unevictable(inode->i_mapping); 63 mapping_set_unevictable(inode->i_mapping);
64 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 64 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
65 switch (mode & S_IFMT) { 65 switch (mode & S_IFMT) {
66 default: 66 default:
67 init_special_inode(inode, mode, dev); 67 init_special_inode(inode, mode, dev);
@@ -100,7 +100,7 @@ ramfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
100 d_instantiate(dentry, inode); 100 d_instantiate(dentry, inode);
101 dget(dentry); /* Extra count - pin the dentry in core */ 101 dget(dentry); /* Extra count - pin the dentry in core */
102 error = 0; 102 error = 0;
103 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 103 dir->i_mtime = dir->i_ctime = current_time(dir);
104 } 104 }
105 return error; 105 return error;
106} 106}
@@ -130,7 +130,7 @@ static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
130 if (!error) { 130 if (!error) {
131 d_instantiate(dentry, inode); 131 d_instantiate(dentry, inode);
132 dget(dentry); 132 dget(dentry);
133 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 133 dir->i_mtime = dir->i_ctime = current_time(dir);
134 } else 134 } else
135 iput(inode); 135 iput(inode);
136 } 136 }
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index cb7f518d37ae..58b2dedb2a3a 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2005,7 +2005,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
2005 if (S_ISLNK(inode->i_mode)) 2005 if (S_ISLNK(inode->i_mode))
2006 inode->i_flags &= ~(S_IMMUTABLE | S_APPEND); 2006 inode->i_flags &= ~(S_IMMUTABLE | S_APPEND);
2007 2007
2008 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 2008 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
2009 inode->i_size = i_size; 2009 inode->i_size = i_size;
2010 inode->i_blocks = 0; 2010 inode->i_blocks = 0;
2011 inode->i_bytes = 0; 2011 inode->i_bytes = 0;
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c
index 2f1ddc908013..1f4692a505a0 100644
--- a/fs/reiserfs/ioctl.c
+++ b/fs/reiserfs/ioctl.c
@@ -94,7 +94,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
94 } 94 }
95 sd_attrs_to_i_attrs(flags, inode); 95 sd_attrs_to_i_attrs(flags, inode);
96 REISERFS_I(inode)->i_attrs = flags; 96 REISERFS_I(inode)->i_attrs = flags;
97 inode->i_ctime = CURRENT_TIME_SEC; 97 inode->i_ctime = current_time(inode);
98 mark_inode_dirty(inode); 98 mark_inode_dirty(inode);
99setflags_out: 99setflags_out:
100 mnt_drop_write_file(filp); 100 mnt_drop_write_file(filp);
@@ -115,7 +115,7 @@ setflags_out:
115 err = -EFAULT; 115 err = -EFAULT;
116 goto setversion_out; 116 goto setversion_out;
117 } 117 }
118 inode->i_ctime = CURRENT_TIME_SEC; 118 inode->i_ctime = current_time(inode);
119 mark_inode_dirty(inode); 119 mark_inode_dirty(inode);
120setversion_out: 120setversion_out:
121 mnt_drop_write_file(filp); 121 mnt_drop_write_file(filp);
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index fd7d0606aa96..e6a2b406af36 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -570,7 +570,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th,
570 } 570 }
571 571
572 dir->i_size += paste_size; 572 dir->i_size += paste_size;
573 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 573 dir->i_mtime = dir->i_ctime = current_time(dir);
574 if (!S_ISDIR(inode->i_mode) && visible) 574 if (!S_ISDIR(inode->i_mode) && visible)
575 /* reiserfs_mkdir or reiserfs_rename will do that by itself */ 575 /* reiserfs_mkdir or reiserfs_rename will do that by itself */
576 reiserfs_update_sd(th, dir); 576 reiserfs_update_sd(th, dir);
@@ -963,7 +963,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
963 inode->i_nlink); 963 inode->i_nlink);
964 964
965 clear_nlink(inode); 965 clear_nlink(inode);
966 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 966 inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(dir);
967 reiserfs_update_sd(&th, inode); 967 reiserfs_update_sd(&th, inode);
968 968
969 DEC_DIR_INODE_NLINK(dir) 969 DEC_DIR_INODE_NLINK(dir)
@@ -1067,11 +1067,11 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
1067 inc_nlink(inode); 1067 inc_nlink(inode);
1068 goto end_unlink; 1068 goto end_unlink;
1069 } 1069 }
1070 inode->i_ctime = CURRENT_TIME_SEC; 1070 inode->i_ctime = current_time(inode);
1071 reiserfs_update_sd(&th, inode); 1071 reiserfs_update_sd(&th, inode);
1072 1072
1073 dir->i_size -= (de.de_entrylen + DEH_SIZE); 1073 dir->i_size -= (de.de_entrylen + DEH_SIZE);
1074 dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; 1074 dir->i_ctime = dir->i_mtime = current_time(dir);
1075 reiserfs_update_sd(&th, dir); 1075 reiserfs_update_sd(&th, dir);
1076 1076
1077 if (!savelink) 1077 if (!savelink)
@@ -1246,7 +1246,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1246 return err ? err : retval; 1246 return err ? err : retval;
1247 } 1247 }
1248 1248
1249 inode->i_ctime = CURRENT_TIME_SEC; 1249 inode->i_ctime = current_time(inode);
1250 reiserfs_update_sd(&th, inode); 1250 reiserfs_update_sd(&th, inode);
1251 1251
1252 ihold(inode); 1252 ihold(inode);
@@ -1306,7 +1306,8 @@ static void set_ino_in_dir_entry(struct reiserfs_dir_entry *de,
1306 * get_empty_nodes or its clones 1306 * get_empty_nodes or its clones
1307 */ 1307 */
1308static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry, 1308static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1309 struct inode *new_dir, struct dentry *new_dentry) 1309 struct inode *new_dir, struct dentry *new_dentry,
1310 unsigned int flags)
1310{ 1311{
1311 int retval; 1312 int retval;
1312 INITIALIZE_PATH(old_entry_path); 1313 INITIALIZE_PATH(old_entry_path);
@@ -1321,6 +1322,9 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1321 unsigned long savelink = 1; 1322 unsigned long savelink = 1;
1322 struct timespec ctime; 1323 struct timespec ctime;
1323 1324
1325 if (flags & ~RENAME_NOREPLACE)
1326 return -EINVAL;
1327
1324 /* 1328 /*
1325 * three balancings: (1) old name removal, (2) new name insertion 1329 * three balancings: (1) old name removal, (2) new name insertion
1326 * and (3) maybe "save" link insertion 1330 * and (3) maybe "save" link insertion
@@ -1567,7 +1571,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1567 1571
1568 mark_de_hidden(old_de.de_deh + old_de.de_entry_num); 1572 mark_de_hidden(old_de.de_deh + old_de.de_entry_num);
1569 journal_mark_dirty(&th, old_de.de_bh); 1573 journal_mark_dirty(&th, old_de.de_bh);
1570 ctime = CURRENT_TIME_SEC; 1574 ctime = current_time(old_dir);
1571 old_dir->i_ctime = old_dir->i_mtime = ctime; 1575 old_dir->i_ctime = old_dir->i_mtime = ctime;
1572 new_dir->i_ctime = new_dir->i_mtime = ctime; 1576 new_dir->i_ctime = new_dir->i_mtime = ctime;
1573 /* 1577 /*
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 4032d1e87c8f..a97e352d05d3 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1987,8 +1987,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
1987 pathrelse(&s_search_path); 1987 pathrelse(&s_search_path);
1988 1988
1989 if (update_timestamps) { 1989 if (update_timestamps) {
1990 inode->i_mtime = CURRENT_TIME_SEC; 1990 inode->i_mtime = current_time(inode);
1991 inode->i_ctime = CURRENT_TIME_SEC; 1991 inode->i_ctime = current_time(inode);
1992 } 1992 }
1993 reiserfs_update_sd(th, inode); 1993 reiserfs_update_sd(th, inode);
1994 1994
@@ -2012,8 +2012,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th,
2012update_and_out: 2012update_and_out:
2013 if (update_timestamps) { 2013 if (update_timestamps) {
2014 /* this is truncate, not file closing */ 2014 /* this is truncate, not file closing */
2015 inode->i_mtime = CURRENT_TIME_SEC; 2015 inode->i_mtime = current_time(inode);
2016 inode->i_ctime = CURRENT_TIME_SEC; 2016 inode->i_ctime = current_time(inode);
2017 } 2017 }
2018 reiserfs_update_sd(th, inode); 2018 reiserfs_update_sd(th, inode);
2019 2019
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 74d5ddd26296..0a6ad4e71e88 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2522,7 +2522,7 @@ out:
2522 if (inode->i_size < off + len - towrite) 2522 if (inode->i_size < off + len - towrite)
2523 i_size_write(inode, off + len - towrite); 2523 i_size_write(inode, off + len - towrite);
2524 inode->i_version++; 2524 inode->i_version++;
2525 inode->i_mtime = inode->i_ctime = CURRENT_TIME; 2525 inode->i_mtime = inode->i_ctime = current_time(inode);
2526 mark_inode_dirty(inode); 2526 mark_inode_dirty(inode);
2527 return len - towrite; 2527 return len - towrite;
2528} 2528}
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index a33812ae9fad..e87aa21c30de 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -450,13 +450,13 @@ int reiserfs_commit_write(struct file *f, struct page *page,
450 450
451static void update_ctime(struct inode *inode) 451static void update_ctime(struct inode *inode)
452{ 452{
453 struct timespec now = current_fs_time(inode->i_sb); 453 struct timespec now = current_time(inode);
454 454
455 if (inode_unhashed(inode) || !inode->i_nlink || 455 if (inode_unhashed(inode) || !inode->i_nlink ||
456 timespec_equal(&inode->i_ctime, &now)) 456 timespec_equal(&inode->i_ctime, &now))
457 return; 457 return;
458 458
459 inode->i_ctime = CURRENT_TIME_SEC; 459 inode->i_ctime = current_time(inode);
460 mark_inode_dirty(inode); 460 mark_inode_dirty(inode);
461} 461}
462 462
@@ -575,7 +575,7 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
575 new_size = buffer_size + sizeof(struct reiserfs_xattr_header); 575 new_size = buffer_size + sizeof(struct reiserfs_xattr_header);
576 if (!err && new_size < i_size_read(d_inode(dentry))) { 576 if (!err && new_size < i_size_read(d_inode(dentry))) {
577 struct iattr newattrs = { 577 struct iattr newattrs = {
578 .ia_ctime = current_fs_time(inode->i_sb), 578 .ia_ctime = current_time(inode),
579 .ia_size = new_size, 579 .ia_size = new_size,
580 .ia_valid = ATTR_SIZE | ATTR_CTIME, 580 .ia_valid = ATTR_SIZE | ATTR_CTIME,
581 }; 581 };
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
index 27376681c640..3d2256a425ee 100644
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -273,7 +273,7 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
273 if (error == -ENODATA) { 273 if (error == -ENODATA) {
274 error = 0; 274 error = 0;
275 if (type == ACL_TYPE_ACCESS) { 275 if (type == ACL_TYPE_ACCESS) {
276 inode->i_ctime = CURRENT_TIME_SEC; 276 inode->i_ctime = current_time(inode);
277 mark_inode_dirty(inode); 277 mark_inode_dirty(inode);
278 } 278 }
279 } 279 }
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index 2661b77fc8a7..5bdae85ceef7 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -215,7 +215,7 @@ got_it:
215 memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2); 215 memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2);
216 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); 216 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
217 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE); 217 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
218 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 218 dir->i_mtime = dir->i_ctime = current_time(dir);
219 mark_inode_dirty(dir); 219 mark_inode_dirty(dir);
220out_page: 220out_page:
221 dir_put_page(page); 221 dir_put_page(page);
@@ -239,7 +239,7 @@ int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page)
239 de->inode = 0; 239 de->inode = 0;
240 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE); 240 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
241 dir_put_page(page); 241 dir_put_page(page);
242 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 242 inode->i_ctime = inode->i_mtime = current_time(inode);
243 mark_inode_dirty(inode); 243 mark_inode_dirty(inode);
244 return err; 244 return err;
245} 245}
@@ -337,7 +337,7 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page,
337 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); 337 de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino);
338 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE); 338 err = dir_commit_chunk(page, pos, SYSV_DIRSIZE);
339 dir_put_page(page); 339 dir_put_page(page);
340 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 340 dir->i_mtime = dir->i_ctime = current_time(dir);
341 mark_inode_dirty(dir); 341 mark_inode_dirty(dir);
342} 342}
343 343
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index f9db4eb31db4..53f1b78996dd 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -164,7 +164,7 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
164 dirty_sb(sb); 164 dirty_sb(sb);
165 inode_init_owner(inode, dir, mode); 165 inode_init_owner(inode, dir, mode);
166 inode->i_ino = fs16_to_cpu(sbi, ino); 166 inode->i_ino = fs16_to_cpu(sbi, ino);
167 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 167 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
168 inode->i_blocks = 0; 168 inode->i_blocks = 0;
169 memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data)); 169 memset(SYSV_I(inode)->i_data, 0, sizeof(SYSV_I(inode)->i_data));
170 SYSV_I(inode)->i_dir_start_lookup = 0; 170 SYSV_I(inode)->i_dir_start_lookup = 0;
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 2fde40acf024..08d3e630b49c 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -178,7 +178,7 @@ static inline int splice_branch(struct inode *inode,
178 *where->p = where->key; 178 *where->p = where->key;
179 write_unlock(&pointers_lock); 179 write_unlock(&pointers_lock);
180 180
181 inode->i_ctime = CURRENT_TIME_SEC; 181 inode->i_ctime = current_time(inode);
182 182
183 /* had we spliced it onto indirect block? */ 183 /* had we spliced it onto indirect block? */
184 if (where->bh) 184 if (where->bh)
@@ -418,7 +418,7 @@ do_indirects:
418 } 418 }
419 n++; 419 n++;
420 } 420 }
421 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 421 inode->i_mtime = inode->i_ctime = current_time(inode);
422 if (IS_SYNC(inode)) 422 if (IS_SYNC(inode))
423 sysv_sync_inode (inode); 423 sysv_sync_inode (inode);
424 else 424 else
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c
index a42de45ce40d..d8817f139763 100644
--- a/fs/sysv/namei.c
+++ b/fs/sysv/namei.c
@@ -120,7 +120,7 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir,
120{ 120{
121 struct inode *inode = d_inode(old_dentry); 121 struct inode *inode = d_inode(old_dentry);
122 122
123 inode->i_ctime = CURRENT_TIME_SEC; 123 inode->i_ctime = current_time(inode);
124 inode_inc_link_count(inode); 124 inode_inc_link_count(inode);
125 ihold(inode); 125 ihold(inode);
126 126
@@ -206,7 +206,8 @@ static int sysv_rmdir(struct inode * dir, struct dentry * dentry)
206 * higher-level routines. 206 * higher-level routines.
207 */ 207 */
208static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, 208static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,
209 struct inode * new_dir, struct dentry * new_dentry) 209 struct inode * new_dir, struct dentry * new_dentry,
210 unsigned int flags)
210{ 211{
211 struct inode * old_inode = d_inode(old_dentry); 212 struct inode * old_inode = d_inode(old_dentry);
212 struct inode * new_inode = d_inode(new_dentry); 213 struct inode * new_inode = d_inode(new_dentry);
@@ -216,6 +217,9 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,
216 struct sysv_dir_entry * old_de; 217 struct sysv_dir_entry * old_de;
217 int err = -ENOENT; 218 int err = -ENOENT;
218 219
220 if (flags & ~RENAME_NOREPLACE)
221 return -EINVAL;
222
219 old_de = sysv_find_entry(old_dentry, &old_page); 223 old_de = sysv_find_entry(old_dentry, &old_page);
220 if (!old_de) 224 if (!old_de)
221 goto out; 225 goto out;
@@ -240,7 +244,7 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry,
240 if (!new_de) 244 if (!new_de)
241 goto out_dir; 245 goto out_dir;
242 sysv_set_link(new_de, new_page, old_inode); 246 sysv_set_link(new_de, new_page, old_inode);
243 new_inode->i_ctime = CURRENT_TIME_SEC; 247 new_inode->i_ctime = current_time(new_inode);
244 if (dir_de) 248 if (dir_de)
245 drop_nlink(new_inode); 249 drop_nlink(new_inode);
246 inode_dec_link_count(new_inode); 250 inode_dec_link_count(new_inode);
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index ad40b64c5e2f..21d36d284735 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -133,7 +133,7 @@ static struct inode *tracefs_get_inode(struct super_block *sb)
133 struct inode *inode = new_inode(sb); 133 struct inode *inode = new_inode(sb);
134 if (inode) { 134 if (inode) {
135 inode->i_ino = get_next_ino(); 135 inode->i_ino = get_next_ino();
136 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 136 inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
137 } 137 }
138 return inode; 138 return inode;
139} 139}
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 1d55aeaebf23..64902702b17d 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -966,7 +966,8 @@ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2,
966} 966}
967 967
968static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, 968static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
969 struct inode *new_dir, struct dentry *new_dentry) 969 struct inode *new_dir, struct dentry *new_dentry,
970 unsigned int flags)
970{ 971{
971 struct ubifs_info *c = old_dir->i_sb->s_fs_info; 972 struct ubifs_info *c = old_dir->i_sb->s_fs_info;
972 struct inode *old_inode = d_inode(old_dentry); 973 struct inode *old_inode = d_inode(old_dentry);
@@ -984,6 +985,9 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
984 struct timespec time; 985 struct timespec time;
985 unsigned int uninitialized_var(saved_nlink); 986 unsigned int uninitialized_var(saved_nlink);
986 987
988 if (flags & ~RENAME_NOREPLACE)
989 return -EINVAL;
990
987 /* 991 /*
988 * Budget request settings: deletion direntry, new direntry, removing 992 * Budget request settings: deletion direntry, new direntry, removing
989 * the old inode, and changing old and new parent directory inodes. 993 * the old inode, and changing old and new parent directory inodes.
@@ -1179,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
1179 .mkdir = ubifs_mkdir, 1183 .mkdir = ubifs_mkdir,
1180 .rmdir = ubifs_rmdir, 1184 .rmdir = ubifs_rmdir,
1181 .mknod = ubifs_mknod, 1185 .mknod = ubifs_mknod,
1182 .rename = ubifs_rename, 1186 .rename = ubifs_rename,
1183 .setattr = ubifs_setattr, 1187 .setattr = ubifs_setattr,
1184 .getattr = ubifs_getattr, 1188 .getattr = ubifs_getattr,
1185 .listxattr = ubifs_listxattr, 1189 .listxattr = ubifs_listxattr,
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index e77db621ec89..c1ed18a10ce4 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -121,7 +121,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
121 else 121 else
122 iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; 122 iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
123 inode->i_mtime = inode->i_atime = inode->i_ctime = 123 inode->i_mtime = inode->i_atime = inode->i_ctime =
124 iinfo->i_crtime = current_fs_time(inode->i_sb); 124 iinfo->i_crtime = current_time(inode);
125 if (unlikely(insert_inode_locked(inode) < 0)) { 125 if (unlikely(insert_inode_locked(inode) < 0)) {
126 make_bad_inode(inode); 126 make_bad_inode(inode);
127 iput(inode); 127 iput(inode);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 55aa587bbc38..aad46401ede5 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -886,7 +886,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
886 *new = 1; 886 *new = 1;
887 iinfo->i_next_alloc_block = block; 887 iinfo->i_next_alloc_block = block;
888 iinfo->i_next_alloc_goal = newblocknum; 888 iinfo->i_next_alloc_goal = newblocknum;
889 inode->i_ctime = current_fs_time(inode->i_sb); 889 inode->i_ctime = current_time(inode);
890 890
891 if (IS_SYNC(inode)) 891 if (IS_SYNC(inode))
892 udf_sync_inode(inode); 892 udf_sync_inode(inode);
@@ -1268,7 +1268,7 @@ set_size:
1268 up_write(&iinfo->i_data_sem); 1268 up_write(&iinfo->i_data_sem);
1269 } 1269 }
1270update_time: 1270update_time:
1271 inode->i_mtime = inode->i_ctime = current_fs_time(inode->i_sb); 1271 inode->i_mtime = inode->i_ctime = current_time(inode);
1272 if (IS_SYNC(inode)) 1272 if (IS_SYNC(inode))
1273 udf_sync_inode(inode); 1273 udf_sync_inode(inode);
1274 else 1274 else
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index c3e5c9679371..2d65e280748b 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -616,7 +616,7 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode)
616 *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse = 616 *(__le32 *)((struct allocDescImpUse *)cfi.icb.impUse)->impUse =
617 cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL); 617 cpu_to_le32(iinfo->i_unique & 0x00000000FFFFFFFFUL);
618 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); 618 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
619 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); 619 dir->i_ctime = dir->i_mtime = current_time(dir);
620 mark_inode_dirty(dir); 620 mark_inode_dirty(dir);
621 if (fibh.sbh != fibh.ebh) 621 if (fibh.sbh != fibh.ebh)
622 brelse(fibh.ebh); 622 brelse(fibh.ebh);
@@ -730,7 +730,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
730 cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; 730 cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY;
731 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); 731 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
732 inc_nlink(dir); 732 inc_nlink(dir);
733 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); 733 dir->i_ctime = dir->i_mtime = current_time(dir);
734 mark_inode_dirty(dir); 734 mark_inode_dirty(dir);
735 unlock_new_inode(inode); 735 unlock_new_inode(inode);
736 d_instantiate(dentry, inode); 736 d_instantiate(dentry, inode);
@@ -845,7 +845,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
845 inode->i_size = 0; 845 inode->i_size = 0;
846 inode_dec_link_count(dir); 846 inode_dec_link_count(dir);
847 inode->i_ctime = dir->i_ctime = dir->i_mtime = 847 inode->i_ctime = dir->i_ctime = dir->i_mtime =
848 current_fs_time(dir->i_sb); 848 current_time(inode);
849 mark_inode_dirty(dir); 849 mark_inode_dirty(dir);
850 850
851end_rmdir: 851end_rmdir:
@@ -888,7 +888,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
888 retval = udf_delete_entry(dir, fi, &fibh, &cfi); 888 retval = udf_delete_entry(dir, fi, &fibh, &cfi);
889 if (retval) 889 if (retval)
890 goto end_unlink; 890 goto end_unlink;
891 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); 891 dir->i_ctime = dir->i_mtime = current_time(dir);
892 mark_inode_dirty(dir); 892 mark_inode_dirty(dir);
893 inode_dec_link_count(inode); 893 inode_dec_link_count(inode);
894 inode->i_ctime = dir->i_ctime; 894 inode->i_ctime = dir->i_ctime;
@@ -1079,9 +1079,9 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1079 brelse(fibh.ebh); 1079 brelse(fibh.ebh);
1080 brelse(fibh.sbh); 1080 brelse(fibh.sbh);
1081 inc_nlink(inode); 1081 inc_nlink(inode);
1082 inode->i_ctime = current_fs_time(inode->i_sb); 1082 inode->i_ctime = current_time(inode);
1083 mark_inode_dirty(inode); 1083 mark_inode_dirty(inode);
1084 dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb); 1084 dir->i_ctime = dir->i_mtime = current_time(dir);
1085 mark_inode_dirty(dir); 1085 mark_inode_dirty(dir);
1086 ihold(inode); 1086 ihold(inode);
1087 d_instantiate(dentry, inode); 1087 d_instantiate(dentry, inode);
@@ -1093,7 +1093,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
1093 * higher-level routines. 1093 * higher-level routines.
1094 */ 1094 */
1095static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, 1095static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1096 struct inode *new_dir, struct dentry *new_dentry) 1096 struct inode *new_dir, struct dentry *new_dentry,
1097 unsigned int flags)
1097{ 1098{
1098 struct inode *old_inode = d_inode(old_dentry); 1099 struct inode *old_inode = d_inode(old_dentry);
1099 struct inode *new_inode = d_inode(new_dentry); 1100 struct inode *new_inode = d_inode(new_dentry);
@@ -1105,6 +1106,9 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1105 struct kernel_lb_addr tloc; 1106 struct kernel_lb_addr tloc;
1106 struct udf_inode_info *old_iinfo = UDF_I(old_inode); 1107 struct udf_inode_info *old_iinfo = UDF_I(old_inode);
1107 1108
1109 if (flags & ~RENAME_NOREPLACE)
1110 return -EINVAL;
1111
1108 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi); 1112 ofi = udf_find_entry(old_dir, &old_dentry->d_name, &ofibh, &ocfi);
1109 if (IS_ERR(ofi)) { 1113 if (IS_ERR(ofi)) {
1110 retval = PTR_ERR(ofi); 1114 retval = PTR_ERR(ofi);
@@ -1172,7 +1176,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1172 * Like most other Unix systems, set the ctime for inodes on a 1176 * Like most other Unix systems, set the ctime for inodes on a
1173 * rename. 1177 * rename.
1174 */ 1178 */
1175 old_inode->i_ctime = current_fs_time(old_inode->i_sb); 1179 old_inode->i_ctime = current_time(old_inode);
1176 mark_inode_dirty(old_inode); 1180 mark_inode_dirty(old_inode);
1177 1181
1178 /* 1182 /*
@@ -1188,11 +1192,11 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry,
1188 udf_delete_entry(old_dir, ofi, &ofibh, &ocfi); 1192 udf_delete_entry(old_dir, ofi, &ofibh, &ocfi);
1189 1193
1190 if (new_inode) { 1194 if (new_inode) {
1191 new_inode->i_ctime = current_fs_time(new_inode->i_sb); 1195 new_inode->i_ctime = current_time(new_inode);
1192 inode_dec_link_count(new_inode); 1196 inode_dec_link_count(new_inode);
1193 } 1197 }
1194 old_dir->i_ctime = old_dir->i_mtime = current_fs_time(old_dir->i_sb); 1198 old_dir->i_ctime = old_dir->i_mtime = current_time(old_dir);
1195 new_dir->i_ctime = new_dir->i_mtime = current_fs_time(new_dir->i_sb); 1199 new_dir->i_ctime = new_dir->i_mtime = current_time(new_dir);
1196 mark_inode_dirty(old_dir); 1200 mark_inode_dirty(old_dir);
1197 mark_inode_dirty(new_dir); 1201 mark_inode_dirty(new_dir);
1198 1202
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index fa3bda1a860f..de01b8f2aa78 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -100,7 +100,7 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
100 err = ufs_commit_chunk(page, pos, len); 100 err = ufs_commit_chunk(page, pos, len);
101 ufs_put_page(page); 101 ufs_put_page(page);
102 if (update_times) 102 if (update_times)
103 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 103 dir->i_mtime = dir->i_ctime = current_time(dir);
104 mark_inode_dirty(dir); 104 mark_inode_dirty(dir);
105} 105}
106 106
@@ -389,7 +389,7 @@ got_it:
389 ufs_set_de_type(sb, de, inode->i_mode); 389 ufs_set_de_type(sb, de, inode->i_mode);
390 390
391 err = ufs_commit_chunk(page, pos, rec_len); 391 err = ufs_commit_chunk(page, pos, rec_len);
392 dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; 392 dir->i_mtime = dir->i_ctime = current_time(dir);
393 393
394 mark_inode_dirty(dir); 394 mark_inode_dirty(dir);
395 /* OFFSET_CACHE */ 395 /* OFFSET_CACHE */
@@ -530,7 +530,7 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir,
530 pde->d_reclen = cpu_to_fs16(sb, to - from); 530 pde->d_reclen = cpu_to_fs16(sb, to - from);
531 dir->d_ino = 0; 531 dir->d_ino = 0;
532 err = ufs_commit_chunk(page, pos, to - from); 532 err = ufs_commit_chunk(page, pos, to - from);
533 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 533 inode->i_ctime = inode->i_mtime = current_time(inode);
534 mark_inode_dirty(inode); 534 mark_inode_dirty(inode);
535out: 535out:
536 ufs_put_page(page); 536 ufs_put_page(page);
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index fd0203ce1f7f..9774555b3721 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -290,7 +290,7 @@ cg_found:
290 inode_init_owner(inode, dir, mode); 290 inode_init_owner(inode, dir, mode);
291 inode->i_blocks = 0; 291 inode->i_blocks = 0;
292 inode->i_generation = 0; 292 inode->i_generation = 0;
293 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 293 inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
294 ufsi->i_flags = UFS_I(dir)->i_flags; 294 ufsi->i_flags = UFS_I(dir)->i_flags;
295 ufsi->i_lastfrag = 0; 295 ufsi->i_lastfrag = 0;
296 ufsi->i_shadow = 0; 296 ufsi->i_shadow = 0;
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index e4a4d248a0f5..190d64be22ed 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -293,7 +293,7 @@ ufs_inode_getfrag(struct inode *inode, unsigned index,
293 293
294 if (new) 294 if (new)
295 *new = 1; 295 *new = 1;
296 inode->i_ctime = CURRENT_TIME_SEC; 296 inode->i_ctime = current_time(inode);
297 if (IS_SYNC(inode)) 297 if (IS_SYNC(inode))
298 ufs_sync_inode (inode); 298 ufs_sync_inode (inode);
299 mark_inode_dirty(inode); 299 mark_inode_dirty(inode);
@@ -375,7 +375,7 @@ ufs_inode_getblock(struct inode *inode, u64 ind_block,
375 mark_buffer_dirty(bh); 375 mark_buffer_dirty(bh);
376 if (IS_SYNC(inode)) 376 if (IS_SYNC(inode))
377 sync_dirty_buffer(bh); 377 sync_dirty_buffer(bh);
378 inode->i_ctime = CURRENT_TIME_SEC; 378 inode->i_ctime = current_time(inode);
379 mark_inode_dirty(inode); 379 mark_inode_dirty(inode);
380out: 380out:
381 brelse (bh); 381 brelse (bh);
@@ -1185,7 +1185,7 @@ static int ufs_truncate(struct inode *inode, loff_t size)
1185 truncate_setsize(inode, size); 1185 truncate_setsize(inode, size);
1186 1186
1187 __ufs_truncate_blocks(inode); 1187 __ufs_truncate_blocks(inode);
1188 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 1188 inode->i_mtime = inode->i_ctime = current_time(inode);
1189 mark_inode_dirty(inode); 1189 mark_inode_dirty(inode);
1190out: 1190out:
1191 UFSD("EXIT: err %d\n", err); 1191 UFSD("EXIT: err %d\n", err);
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index a1559f762805..8eca4eda8450 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -153,7 +153,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir,
153 struct inode *inode = d_inode(old_dentry); 153 struct inode *inode = d_inode(old_dentry);
154 int error; 154 int error;
155 155
156 inode->i_ctime = CURRENT_TIME_SEC; 156 inode->i_ctime = current_time(inode);
157 inode_inc_link_count(inode); 157 inode_inc_link_count(inode);
158 ihold(inode); 158 ihold(inode);
159 159
@@ -245,7 +245,8 @@ static int ufs_rmdir (struct inode * dir, struct dentry *dentry)
245} 245}
246 246
247static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, 247static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
248 struct inode *new_dir, struct dentry *new_dentry) 248 struct inode *new_dir, struct dentry *new_dentry,
249 unsigned int flags)
249{ 250{
250 struct inode *old_inode = d_inode(old_dentry); 251 struct inode *old_inode = d_inode(old_dentry);
251 struct inode *new_inode = d_inode(new_dentry); 252 struct inode *new_inode = d_inode(new_dentry);
@@ -255,6 +256,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
255 struct ufs_dir_entry *old_de; 256 struct ufs_dir_entry *old_de;
256 int err = -ENOENT; 257 int err = -ENOENT;
257 258
259 if (flags & ~RENAME_NOREPLACE)
260 return -EINVAL;
261
258 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page); 262 old_de = ufs_find_entry(old_dir, &old_dentry->d_name, &old_page);
259 if (!old_de) 263 if (!old_de)
260 goto out; 264 goto out;
@@ -279,7 +283,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
279 if (!new_de) 283 if (!new_de)
280 goto out_dir; 284 goto out_dir;
281 ufs_set_link(new_dir, new_de, new_page, old_inode, 1); 285 ufs_set_link(new_dir, new_de, new_page, old_inode, 1);
282 new_inode->i_ctime = CURRENT_TIME_SEC; 286 new_inode->i_ctime = current_time(new_inode);
283 if (dir_de) 287 if (dir_de)
284 drop_nlink(new_inode); 288 drop_nlink(new_inode);
285 inode_dec_link_count(new_inode); 289 inode_dec_link_count(new_inode);
@@ -295,7 +299,7 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry,
295 * Like most other Unix systems, set the ctime for inodes on a 299 * Like most other Unix systems, set the ctime for inodes on a
296 * rename. 300 * rename.
297 */ 301 */
298 old_inode->i_ctime = CURRENT_TIME_SEC; 302 old_inode->i_ctime = current_time(old_inode);
299 303
300 ufs_delete_entry(old_dir, old_de, old_page); 304 ufs_delete_entry(old_dir, old_de, old_page);
301 mark_inode_dirty(old_inode); 305 mark_inode_dirty(old_inode);
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 8a0dec89ca56..b468e041f207 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -236,7 +236,7 @@ xfs_set_mode(struct inode *inode, umode_t mode)
236 236
237 iattr.ia_valid = ATTR_MODE | ATTR_CTIME; 237 iattr.ia_valid = ATTR_MODE | ATTR_CTIME;
238 iattr.ia_mode = mode; 238 iattr.ia_mode = mode;
239 iattr.ia_ctime = current_fs_time(inode->i_sb); 239 iattr.ia_ctime = current_time(inode);
240 240
241 error = xfs_setattr_nonsize(XFS_I(inode), &iattr, XFS_ATTR_NOACL); 241 error = xfs_setattr_nonsize(XFS_I(inode), &iattr, XFS_ATTR_NOACL);
242 } 242 }
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index df22e1254c98..624e1dfa716b 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -821,7 +821,7 @@ xfs_ialloc(
821 ip->i_d.di_nextents = 0; 821 ip->i_d.di_nextents = 0;
822 ASSERT(ip->i_d.di_nblocks == 0); 822 ASSERT(ip->i_d.di_nblocks == 0);
823 823
824 tv = current_fs_time(mp->m_super); 824 tv = current_time(inode);
825 inode->i_mtime = tv; 825 inode->i_mtime = tv;
826 inode->i_atime = tv; 826 inode->i_atime = tv;
827 inode->i_ctime = tv; 827 inode->i_ctime = tv;
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index a7404c5aafe2..c5da95eb79b8 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -896,7 +896,7 @@ xfs_setattr_size(
896 if (newsize != oldsize && 896 if (newsize != oldsize &&
897 !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { 897 !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {
898 iattr->ia_ctime = iattr->ia_mtime = 898 iattr->ia_ctime = iattr->ia_mtime =
899 current_fs_time(inode->i_sb); 899 current_time(inode);
900 iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; 900 iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;
901 } 901 }
902 902
@@ -1086,7 +1086,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
1086 */ 1086 */
1087 .rmdir = xfs_vn_unlink, 1087 .rmdir = xfs_vn_unlink,
1088 .mknod = xfs_vn_mknod, 1088 .mknod = xfs_vn_mknod,
1089 .rename2 = xfs_vn_rename, 1089 .rename = xfs_vn_rename,
1090 .get_acl = xfs_get_acl, 1090 .get_acl = xfs_get_acl,
1091 .set_acl = xfs_set_acl, 1091 .set_acl = xfs_set_acl,
1092 .getattr = xfs_vn_getattr, 1092 .getattr = xfs_vn_getattr,
@@ -1111,7 +1111,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
1111 */ 1111 */
1112 .rmdir = xfs_vn_unlink, 1112 .rmdir = xfs_vn_unlink,
1113 .mknod = xfs_vn_mknod, 1113 .mknod = xfs_vn_mknod,
1114 .rename2 = xfs_vn_rename, 1114 .rename = xfs_vn_rename,
1115 .get_acl = xfs_get_acl, 1115 .get_acl = xfs_get_acl,
1116 .set_acl = xfs_set_acl, 1116 .set_acl = xfs_set_acl,
1117 .getattr = xfs_vn_getattr, 1117 .getattr = xfs_vn_getattr,
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index 11a3af08b5c7..dab8daa676f9 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -73,7 +73,7 @@ xfs_trans_ichgtime(
73 ASSERT(tp); 73 ASSERT(tp);
74 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 74 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
75 75
76 tv = current_fs_time(inode->i_sb); 76 tv = current_time(inode);
77 77
78 if (flags & XFS_ICHGTIME_MOD) 78 if (flags & XFS_ICHGTIME_MOD)
79 inode->i_mtime = tv; 79 inode->i_mtime = tv;