aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-10-28 13:39:21 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:10:48 -0500
commit269d040ff2f340e1ed517dab8b66b2f133c83a77 (patch)
treecbbcf1d4fbda2043a88e7e4bf41c12dae4e92122 /fs/btrfs/tree-log.c
parent488111aa0e17102d42e0328299fd782dc6a4a051 (diff)
Btrfs: log recovery, don't unlink inode always on error
If we get any error while doing a dir index/item lookup in the log tree, we were always unlinking the corresponding inode in the subvolume. It makes sense to unlink only if the lookup failed to find the dir index/item, which corresponds to NULL or -ENOENT, and not when other errors happen (like a transient -ENOMEM or -EIO). Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r--fs/btrfs/tree-log.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 18891c009641..7927a5fa755c 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1832,7 +1832,7 @@ again:
1832 dir_key->offset, 1832 dir_key->offset,
1833 name, name_len, 0); 1833 name, name_len, 0);
1834 } 1834 }
1835 if (IS_ERR_OR_NULL(log_di)) { 1835 if (!log_di || (IS_ERR(log_di) && PTR_ERR(log_di) == -ENOENT)) {
1836 btrfs_dir_item_key_to_cpu(eb, di, &location); 1836 btrfs_dir_item_key_to_cpu(eb, di, &location);
1837 btrfs_release_path(path); 1837 btrfs_release_path(path);
1838 btrfs_release_path(log_path); 1838 btrfs_release_path(log_path);
@@ -1869,6 +1869,9 @@ again:
1869 goto again; 1869 goto again;
1870 ret = 0; 1870 ret = 0;
1871 goto out; 1871 goto out;
1872 } else if (IS_ERR(log_di)) {
1873 kfree(name);
1874 return PTR_ERR(log_di);
1872 } 1875 }
1873 btrfs_release_path(log_path); 1876 btrfs_release_path(log_path);
1874 kfree(name); 1877 kfree(name);