diff options
author | Filipe Manana <fdmanana@gmail.com> | 2014-06-24 12:48:28 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-28 16:48:46 -0400 |
commit | 46c4e71e9b02a649c722f06569f5b6575da02dba (patch) | |
tree | 9e4d947c41be9ed97076a630bd80a6e7dcfba2b8 /fs | |
parent | c39aa7056f50fa7b49265ea35c0f3eddb7c7be68 (diff) |
Btrfs: assert send doesn't attempt to start transactions
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/transaction.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 511839c04f11..a32ad65b6cdc 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -386,11 +386,13 @@ start_transaction(struct btrfs_root *root, u64 num_items, unsigned int type, | |||
386 | bool reloc_reserved = false; | 386 | bool reloc_reserved = false; |
387 | int ret; | 387 | int ret; |
388 | 388 | ||
389 | /* Send isn't supposed to start transactions. */ | ||
390 | ASSERT(current->journal_info != (void *)BTRFS_SEND_TRANS_STUB); | ||
391 | |||
389 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) | 392 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) |
390 | return ERR_PTR(-EROFS); | 393 | return ERR_PTR(-EROFS); |
391 | 394 | ||
392 | if (current->journal_info && | 395 | if (current->journal_info) { |
393 | current->journal_info != (void *)BTRFS_SEND_TRANS_STUB) { | ||
394 | WARN_ON(type & TRANS_EXTWRITERS); | 396 | WARN_ON(type & TRANS_EXTWRITERS); |
395 | h = current->journal_info; | 397 | h = current->journal_info; |
396 | h->use_count++; | 398 | h->use_count++; |