Skip to contentSkip to conversation

Btrfs: fix wrong mtime and ctime when creating snapshots

PATCH New Miao Xie 1 participant 1 message Aug 9, 2012 Btrfs file system

lore
Share & tools
lore

Miao Xie

author
#0 lore raw

PATCH 1/1 Btrfs: fix wrong mtime and ctime when creating snapshots

When we created a new snapshot, the mtime and ctime of its parent directory were not updated. Fix it.

---
 fs/btrfs/transaction.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/btrfs/transaction.c +1 -0
index 7ac7cdc..5a81982 100644
@@ -1026,6 +1026,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
 
 	btrfs_i_size_write(parent_inode, parent_inode->i_size +
 					 dentry->d_name.len * 2);
+	parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME;
 	ret = btrfs_update_inode(trans, parent_root, parent_inode);
 	if (ret)
 		goto abort_trans_dput;
Signature · 1 line
1.7.6.5