Commit 60e7cd3a4ba6049ef590921e84454e6cfd9e2589

Authored by Josef Bacik
1 parent 94aebfb2e7

Btrfs: fix transid verify errors when recovering log tree

If we crash with a log, remount and recover that log, and then crash before we
can commit another transaction we will get transid verify errors on the next
mount.  This is because we were not zero'ing out the log when we committed the
transaction after recovery.  This is ok as long as we commit another transaction
at some point in the future, but if you abort or something else goes wrong you
can end up in this weird state because the recovery stuff says that the tree log
should have a generation+1 of the super generation, which won't be the case of
the transaction that was started for recovery.  Fix this by removing the check
and _always_ zero out the log portion of the super when we commit a transaction.
This fixes the transid verify issues I was seeing with my force errors tests.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>

Showing 1 changed file with 2 additions and 5 deletions Side-by-side Diff

fs/btrfs/transaction.c
... ... @@ -1838,11 +1838,8 @@
1838 1838 assert_qgroups_uptodate(trans);
1839 1839 update_super_roots(root);
1840 1840  
1841   - if (!root->fs_info->log_root_recovering) {
1842   - btrfs_set_super_log_root(root->fs_info->super_copy, 0);
1843   - btrfs_set_super_log_root_level(root->fs_info->super_copy, 0);
1844   - }
1845   -
  1841 + btrfs_set_super_log_root(root->fs_info->super_copy, 0);
  1842 + btrfs_set_super_log_root_level(root->fs_info->super_copy, 0);
1846 1843 memcpy(root->fs_info->super_for_commit, root->fs_info->super_copy,
1847 1844 sizeof(*root->fs_info->super_copy));
1848 1845