aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2008-06-09 21:57:42 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:03 -0400
commit3b96362cc8d314c935c335d5c3c42eb93c23166b (patch)
tree6d69302c9589d64ccb76f61b833f1a7151f9c841 /fs/btrfs/transaction.c
parent48ec2cf8738b0db53dc8361026cb7a328f7ad386 (diff)
Btrfs: Invalidate dcache entry after creating snapshot and
We need to invalidate an existing dcache entry after creating a new snapshot or subvolume, because a negative dache entry will stop us from accessing the new snapshot or subvolume. --- ctree.h | 23 +++++++++++++++++++++++ inode.c | 4 ++++ transaction.c | 4 ++++ 3 files changed, 31 insertions(+) Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 1cb084efd6ed..f04684f7fea3 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -560,6 +560,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
560 struct btrfs_root *root = pending->root; 560 struct btrfs_root *root = pending->root;
561 struct extent_buffer *tmp; 561 struct extent_buffer *tmp;
562 int ret; 562 int ret;
563 int namelen;
563 u64 objectid; 564 u64 objectid;
564 565
565 new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS); 566 new_root_item = kmalloc(sizeof(*new_root_item), GFP_NOFS);
@@ -595,8 +596,9 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
595 * insert the directory item 596 * insert the directory item
596 */ 597 */
597 key.offset = (u64)-1; 598 key.offset = (u64)-1;
599 namelen = strlen(pending->name);
598 ret = btrfs_insert_dir_item(trans, root->fs_info->tree_root, 600 ret = btrfs_insert_dir_item(trans, root->fs_info->tree_root,
599 pending->name, strlen(pending->name), 601 pending->name, namelen,
600 root->fs_info->sb->s_root->d_inode->i_ino, 602 root->fs_info->sb->s_root->d_inode->i_ino,
601 &key, BTRFS_FT_DIR); 603 &key, BTRFS_FT_DIR);
602 604
@@ -606,6 +608,10 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
606 ret = btrfs_insert_inode_ref(trans, root->fs_info->tree_root, 608 ret = btrfs_insert_inode_ref(trans, root->fs_info->tree_root,
607 pending->name, strlen(pending->name), objectid, 609 pending->name, strlen(pending->name), objectid,
608 root->fs_info->sb->s_root->d_inode->i_ino); 610 root->fs_info->sb->s_root->d_inode->i_ino);
611
612 /* Invalidate existing dcache entry for new snapshot. */
613 btrfs_invalidate_dcache_root(root, pending->name, namelen);
614
609fail: 615fail:
610 kfree(new_root_item); 616 kfree(new_root_item);
611 return ret; 617 return ret;