linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: assert send doesn't attempt to start transactions
@ 2014-06-24 16:48 Filipe David Borba Manana
  2014-07-03 23:18 ` Satoru Takeuchi
  0 siblings, 1 reply; 2+ messages in thread
From: Filipe David Borba Manana @ 2014-06-24 16:48 UTC (permalink / raw)
  To: linux-btrfs; +Cc: jbacik, Filipe David Borba Manana

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>
---
 fs/btrfs/transaction.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 614eac3..47870ca 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,
 	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++;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Btrfs: assert send doesn't attempt to start transactions
  2014-06-24 16:48 [PATCH] Btrfs: assert send doesn't attempt to start transactions Filipe David Borba Manana
@ 2014-07-03 23:18 ` Satoru Takeuchi
  0 siblings, 0 replies; 2+ messages in thread
From: Satoru Takeuchi @ 2014-07-03 23:18 UTC (permalink / raw)
  To: Filipe David Borba Manana, linux-btrfs; +Cc: jbacik

(2014/06/25 1:48), Filipe David Borba Manana wrote:
> 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>

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

Thanks,
Satoru

> ---
>   fs/btrfs/transaction.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 614eac3..47870ca 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,
>   	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++;
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-03 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-24 16:48 [PATCH] Btrfs: assert send doesn't attempt to start transactions Filipe David Borba Manana
2014-07-03 23:18 ` Satoru Takeuchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).