Skip to content

Commit

Permalink
Btrfs: assert send doesn't attempt to start transactions
Browse files Browse the repository at this point in the history
When starting a transaction just assert that current->journal_info
doesn't contain a send transaction stub, since send isn't supposed
to start transactions and when it finishes (either successfully or
not) it's supposed to set current->journal_info to NULL.

This is motivated by the change titled:

    Btrfs: fix crash when starting transaction

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Filipe Manana authored and Chris Mason committed Jun 28, 2014
1 parent c39aa70 commit 46c4e71
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,13 @@ start_transaction(struct btrfs_root *root, u64 num_items, unsigned int type,
bool reloc_reserved = false;
int ret;

/* Send isn't supposed to start transactions. */
ASSERT(current->journal_info != (void *)BTRFS_SEND_TRANS_STUB);

if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state))
return ERR_PTR(-EROFS);

if (current->journal_info &&
current->journal_info != (void *)BTRFS_SEND_TRANS_STUB) {
if (current->journal_info) {
WARN_ON(type & TRANS_EXTWRITERS);
h = current->journal_info;
h->use_count++;
Expand Down

0 comments on commit 46c4e71

Please sign in to comment.