aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2011-06-17 16:14:09 -0400
committerChris Mason <chris.mason@oracle.com>2011-06-17 16:38:47 -0400
commite999376f094162aa425ae749aa1df95ab928d010 (patch)
tree080d4a2a20d8d7e7ea8b36f63150827b970da715 /fs/btrfs/delayed-inode.c
parent35a30d7ce54e087d8025a725d4e5a2fdee723a9f (diff)
Btrfs: avoid delayed metadata items during commits
Snapshot creation has two phases. One is the initial snapshot setup, and the second is done during commit, while nobody is allowed to modify the root we are snapshotting. The delayed metadata insertion code can break that rule, it does a delayed inode update on the inode of the parent of the snapshot, and delayed directory item insertion. This makes sure to run the pending delayed operations before we record the snapshot root, which avoids corruptions. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
-rw-r--r--fs/btrfs/delayed-inode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index fc515b787e8..f1cbd028f7b 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1237,6 +1237,13 @@ again:
1237 return 0; 1237 return 0;
1238} 1238}
1239 1239
1240void btrfs_assert_delayed_root_empty(struct btrfs_root *root)
1241{
1242 struct btrfs_delayed_root *delayed_root;
1243 delayed_root = btrfs_get_delayed_root(root);
1244 WARN_ON(btrfs_first_delayed_node(delayed_root));
1245}
1246
1240void btrfs_balance_delayed_items(struct btrfs_root *root) 1247void btrfs_balance_delayed_items(struct btrfs_root *root)
1241{ 1248{
1242 struct btrfs_delayed_root *delayed_root; 1249 struct btrfs_delayed_root *delayed_root;