diff options
| author | Li Zefan <lizf@cn.fujitsu.com> | 2011-12-14 20:12:02 -0500 |
|---|---|---|
| committer | Chris Mason <chris.mason@oracle.com> | 2011-12-15 10:50:37 -0500 |
| commit | 306424cc880a0fbbdc99eee1f43d056a301a180f (patch) | |
| tree | 7c6b3b851fcd325c65724f3a7875311407998a6d | |
| parent | f8e9e0b07be0464e12366631da3da73a1a62449c (diff) | |
Btrfs: fix ctime update of on-disk inode
To reproduce the bug:
# touch /mnt/tmp
# stat /mnt/tmp | grep Change
Change: 2011-12-09 09:32:23.412105981 +0800
# chattr +i /mnt/tmp
# stat /mnt/tmp | grep Change
Change: 2011-12-09 09:32:43.198105295 +0800
# umount /mnt
# mount /dev/loop1 /mnt
# stat /mnt/tmp | grep Change
Change: 2011-12-09 09:32:23.412105981 +0800
We should update ctime of in-memory inode before calling
btrfs_update_inode().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
| -rw-r--r-- | fs/btrfs/ioctl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 72d461656f60..40eaa9fdf07c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -252,11 +252,11 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
| 252 | trans = btrfs_join_transaction(root); | 252 | trans = btrfs_join_transaction(root); |
| 253 | BUG_ON(IS_ERR(trans)); | 253 | BUG_ON(IS_ERR(trans)); |
| 254 | 254 | ||
| 255 | btrfs_update_iflags(inode); | ||
| 256 | inode->i_ctime = CURRENT_TIME; | ||
| 255 | ret = btrfs_update_inode(trans, root, inode); | 257 | ret = btrfs_update_inode(trans, root, inode); |
| 256 | BUG_ON(ret); | 258 | BUG_ON(ret); |
| 257 | 259 | ||
| 258 | btrfs_update_iflags(inode); | ||
| 259 | inode->i_ctime = CURRENT_TIME; | ||
| 260 | btrfs_end_transaction(trans, root); | 260 | btrfs_end_transaction(trans, root); |
| 261 | 261 | ||
| 262 | mnt_drop_write(file->f_path.mnt); | 262 | mnt_drop_write(file->f_path.mnt); |
