[07/10] btrfs: fix wrong ctime when adding link
diff mbox

Message ID 4BF4E336.40603@cn.fujitsu.com
State New, archived
Headers show

Commit Message

Miao Xie May 20, 2010, 7:22 a.m. UTC
None

Patch
diff mbox

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a85b90c..5271887 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4218,8 +4218,12 @@  int btrfs_add_link(struct btrfs_trans_handle *trans,
 
 		btrfs_i_size_write(parent_inode, parent_inode->i_size +
 				   name_len * 2);
-		parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME;
-		ret = btrfs_update_inode(trans, root, parent_inode);
+		parent_inode->i_mtime = parent_inode->i_ctime = inode->i_ctime
+				      = CURRENT_TIME;
+
+		ret = btrfs_update_inode(trans, root, inode);
+		if (!ret)
+			ret = btrfs_update_inode(trans, root, parent_inode);
 	}
 	return ret;
 }