aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-08-21 15:54:00 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-01 08:16:22 -0400
commite8e7cff667e674a886f4fbf1773c217bb9a0f664 (patch)
treefe258a54a8a8cc8145a8abf299b754779277ba3b
parent57cfd4627046efc43081d26b5db77dbfb7595caa (diff)
Btrfs: do not clear our orphan item runtime flag on eexist
We were unconditionally clearing our runtime flag on the inode on error when trying to insert an orphan item. This is wrong in the case of -EEXIST since we obviously have an orphan item. This was causing us to not do the correct cleanup of our orphan items which caused issues on cleanup. This happens because currently when truncate fails we just leave the orphan item on there so it can be cleaned up, so if we go to remove the file later we will hit this issue. What we do for truncate isn't right either, but we shouldn't screw this sort of thing up on error either, so fix this and then I'll fix truncate in a different patch. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 21d8674f7837..4d4e2de3e879 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2950,14 +2950,14 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode)
2950 if (insert >= 1) { 2950 if (insert >= 1) {
2951 ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode)); 2951 ret = btrfs_insert_orphan_item(trans, root, btrfs_ino(inode));
2952 if (ret) { 2952 if (ret) {
2953 clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
2954 &BTRFS_I(inode)->runtime_flags);
2955 if (reserve) { 2953 if (reserve) {
2956 clear_bit(BTRFS_INODE_ORPHAN_META_RESERVED, 2954 clear_bit(BTRFS_INODE_ORPHAN_META_RESERVED,
2957 &BTRFS_I(inode)->runtime_flags); 2955 &BTRFS_I(inode)->runtime_flags);
2958 btrfs_orphan_release_metadata(inode); 2956 btrfs_orphan_release_metadata(inode);
2959 } 2957 }
2960 if (ret != -EEXIST) { 2958 if (ret != -EEXIST) {
2959 clear_bit(BTRFS_INODE_HAS_ORPHAN_ITEM,
2960 &BTRFS_I(inode)->runtime_flags);
2961 btrfs_abort_transaction(trans, root, ret); 2961 btrfs_abort_transaction(trans, root, ret);
2962 return ret; 2962 return ret;
2963 } 2963 }