diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index e0a82aa7da897cc576b62270b10f3abd83be49b0..22951621363f0169005efd87d9984eda0b3af606 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1406,8 +1406,10 @@ int btrfs_defrag_root(struct btrfs_root *root) while (1) { trans = btrfs_start_transaction(root, 0); - if (IS_ERR(trans)) - return PTR_ERR(trans); + if (IS_ERR(trans)) { + ret = PTR_ERR(trans); + break; + } ret = btrfs_defrag_leaves(trans, root);