linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix double decrease of the writer counter
@ 2012-09-17  6:34 Miao Xie
  2012-09-17 16:31 ` Josef Bacik
  0 siblings, 1 reply; 2+ messages in thread
From: Miao Xie @ 2012-09-17  6:34 UTC (permalink / raw)
  To: Linux Btrfs

In __btrfs_end_transaction(), we have invoked sb_end_intwrite(), but if we
need run btrfs_commit_transaction(), we will decrease the writer counter
for two times because btrfs_commit_transaction() also invokes sb_end_intwrite().
Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/transaction.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 27c2600..3134fdc 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -551,8 +551,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 	btrfs_trans_release_metadata(trans, root);
 	trans->block_rsv = NULL;
 
-	sb_end_intwrite(root->fs_info->sb);
-
 	if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) &&
 	    should_end_transaction(trans, root)) {
 		trans->transaction->blocked = 1;
@@ -573,6 +571,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 		}
 	}
 
+	sb_end_intwrite(root->fs_info->sb);
+
 	WARN_ON(cur_trans != info->running_transaction);
 	WARN_ON(atomic_read(&cur_trans->num_writers) < 1);
 	atomic_dec(&cur_trans->num_writers);
-- 
1.7.6.5

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

* Re: [PATCH] Btrfs: fix double decrease of the writer counter
  2012-09-17  6:34 [PATCH] Btrfs: fix double decrease of the writer counter Miao Xie
@ 2012-09-17 16:31 ` Josef Bacik
  0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2012-09-17 16:31 UTC (permalink / raw)
  To: Miao Xie; +Cc: Linux Btrfs

On Mon, Sep 17, 2012 at 12:34:27AM -0600, Miao Xie wrote:
> In __btrfs_end_transaction(), we have invoked sb_end_intwrite(), but if we
> need run btrfs_commit_transaction(), we will decrease the writer counter
> for two times because btrfs_commit_transaction() also invokes sb_end_intwrite().
> Fix it.
> 

Already fixed in btrfs-next.  Thanks,

Josef
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
>  fs/btrfs/transaction.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 27c2600..3134fdc 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -551,8 +551,6 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
>  	btrfs_trans_release_metadata(trans, root);
>  	trans->block_rsv = NULL;
>  
> -	sb_end_intwrite(root->fs_info->sb);
> -
>  	if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) &&
>  	    should_end_transaction(trans, root)) {
>  		trans->transaction->blocked = 1;
> @@ -573,6 +571,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
>  		}
>  	}
>  
> +	sb_end_intwrite(root->fs_info->sb);
> +
>  	WARN_ON(cur_trans != info->running_transaction);
>  	WARN_ON(atomic_read(&cur_trans->num_writers) < 1);
>  	atomic_dec(&cur_trans->num_writers);
> -- 
> 1.7.6.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2012-09-17 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17  6:34 [PATCH] Btrfs: fix double decrease of the writer counter Miao Xie
2012-09-17 16:31 ` Josef Bacik

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).