Skip to contentSkip to conversation

Btrfs: check the return code of btrfs_save_ino_cache

PATCH New Josef Bacik 1 participant 1 message May 31, 2012 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: check the return code of btrfs_save_ino_cache

In doing my enospc work I would sometimes error out in btrfs_save_ino_cache which would abort the transaction but we'd still end up with a corrupted file system. This is because we don't actually check the return value and so if somethign goes wrong we just exit out and screw everything up. This fixes this particular part. Thanks,
Btrfs: check the return code of btrfs_save_ino_cache

In doing my enospc work I would sometimes error out in btrfs_save_ino_cache which would abort the transaction but we'd still end up with a corrupted file system. This is because we don't actually check the return value and so if somethign goes wrong we just exit out and screw everything up. This fixes this particular part. Thanks,

---
 fs/btrfs/transaction.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
fs/btrfs/transaction.c +4 -1
index 82b03af..7aed0e8 100644
@@ -823,7 +823,9 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans,
 			btrfs_update_reloc_root(trans, root);
 			btrfs_orphan_commit_root(trans, root);
 
-			btrfs_save_ino_cache(root, trans);
+			err = btrfs_save_ino_cache(root, trans);
+			if (err)
+				goto out;
 
 			/* see comments in should_cow_block() */
 			root->force_cow = 0;
@@ -848,6 +850,7 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans,
 		}
 	}
 	spin_unlock(&fs_info->fs_roots_radix_lock);
+out:
 	return err;
 }
 
Signature · 1 line
1.7.7.6