Re: [PATCH v2 06/24] fs: ext4: Use current_time() for inode timestamps

From: Arnd Bergmann
Date: Wed Jun 22 2016 - 09:38:16 EST


On Sunday, June 19, 2016 5:27:05 PM CEST Deepa Dinamani wrote:
> @@ -3727,6 +3727,7 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
> };
> u8 new_file_type;
> int retval;
> + struct timespec ctime;
>
> if ((ext4_encrypted_inode(old_dir) ||
> ext4_encrypted_inode(new_dir)) &&
> @@ -3829,8 +3830,9 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,
> * Like most other Unix systems, set the ctime for inodes on a
> * rename.
> */
> - old.inode->i_ctime = ext4_current_time(old.inode);
> - new.inode->i_ctime = ext4_current_time(new.inode);
> + ctime = current_time(old.inode);
> + old.inode->i_ctime = ctime;
> + new.inode->i_ctime = ctime;
> ext4_mark_inode_dirty(handle, old.inode);
> ext4_mark_inode_dirty(handle, new.inode);
>

Adding a local variable here looks like it is going to cause us trouble when we
change the return type of current_time() to timespec64.

I'd write this as

new.inode->i_ctime = old.inode->i_ctime;

instead.

Arnd