linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@redhat.com>
To: Daniel J Blueman <daniel@quora.org>
Cc: linux-btrfs@vger.kernel.org, Chris Mason <chris.mason@oracle.com>,
	Josef Bacik <josef@redhat.com>
Subject: Re: [PATCH] Add missing unlocks on error paths
Date: Wed, 25 Apr 2012 13:08:04 -0400	[thread overview]
Message-ID: <20120425170803.GA17006@localhost.localdomain> (raw)
In-Reply-To: <1335369891-19137-1-git-send-email-daniel@quora.org>

On Thu, Apr 26, 2012 at 12:04:51AM +0800, Daniel J Blueman wrote:
> Correctly drop locks during error cases.
> 
> Signed-off-by: Daniel J Blueman <daniel@quora.org>
> ---
>  fs/btrfs/transaction.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 11b77a5..ede3988 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -73,8 +73,11 @@ loop:
>  
>  	cur_trans = root->fs_info->running_transaction;
>  	if (cur_trans) {
> -		if (cur_trans->aborted)
> +		if (cur_trans->aborted) {
> +			spin_unlock(&root->fs_info->trans_lock);
>  			return cur_trans->aborted;
> +		}
> +
>  		atomic_inc(&cur_trans->use_count);
>  		atomic_inc(&cur_trans->num_writers);
>  		cur_trans->num_joined++;
> @@ -1400,6 +1403,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
>  	ret = commit_fs_roots(trans, root);
>  	if (ret) {
>  		mutex_unlock(&root->fs_info->tree_log_mutex);
> +		mutex_unlock(&root->fs_info->reloc_mutex);
>  		goto cleanup_transaction;
>  	}
>  
> @@ -1411,6 +1415,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
>  	ret = commit_cowonly_roots(trans, root);
>  	if (ret) {
>  		mutex_unlock(&root->fs_info->tree_log_mutex);
> +		mutex_unlock(&root->fs_info->reloc_mutex);
>  		goto cleanup_transaction;
>  	}
>  
> -- 
> 1.7.9.5
> 

Reviewed-by: Josef Bacik <josef@redhat.com>

Thanks,

Josef

  reply	other threads:[~2012-04-25 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25 16:04 [PATCH] Add missing unlocks on error paths Daniel J Blueman
2012-04-25 17:08 ` Josef Bacik [this message]
2012-04-25 21:40 ` David Sterba
2012-04-26 15:08   ` Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120425170803.GA17006@localhost.localdomain \
    --to=josef@redhat.com \
    --cc=chris.mason@oracle.com \
    --cc=daniel@quora.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).