* [PATCH] Add missing unlocks on error paths
@ 2012-04-25 16:04 Daniel J Blueman
2012-04-25 17:08 ` Josef Bacik
2012-04-25 21:40 ` David Sterba
0 siblings, 2 replies; 4+ messages in thread
From: Daniel J Blueman @ 2012-04-25 16:04 UTC (permalink / raw)
To: linux-btrfs, Chris Mason; +Cc: Josef Bacik, Daniel J Blueman
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Add missing unlocks on error paths
2012-04-25 16:04 [PATCH] Add missing unlocks on error paths Daniel J Blueman
@ 2012-04-25 17:08 ` Josef Bacik
2012-04-25 21:40 ` David Sterba
1 sibling, 0 replies; 4+ messages in thread
From: Josef Bacik @ 2012-04-25 17:08 UTC (permalink / raw)
To: Daniel J Blueman; +Cc: linux-btrfs, Chris Mason, Josef Bacik
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add missing unlocks on error paths
2012-04-25 16:04 [PATCH] Add missing unlocks on error paths Daniel J Blueman
2012-04-25 17:08 ` Josef Bacik
@ 2012-04-25 21:40 ` David Sterba
2012-04-26 15:08 ` Josef Bacik
1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2012-04-25 21:40 UTC (permalink / raw)
To: Daniel J Blueman; +Cc: linux-btrfs, Chris Mason, Josef Bacik
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>
> ---
fyi, the same patch is already present in for-linus,
871383be592ba7e819d27556591e315a0df38cee
[http://www.spinics.net/lists/linux-btrfs/msg15837.html]
david
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add missing unlocks on error paths
2012-04-25 21:40 ` David Sterba
@ 2012-04-26 15:08 ` Josef Bacik
0 siblings, 0 replies; 4+ messages in thread
From: Josef Bacik @ 2012-04-26 15:08 UTC (permalink / raw)
To: Daniel J Blueman, linux-btrfs, Chris Mason, Josef Bacik
On Wed, Apr 25, 2012 at 11:40:14PM +0200, David Sterba wrote:
> 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>
> > ---
>
> fyi, the same patch is already present in for-linus,
> 871383be592ba7e819d27556591e315a0df38cee
> [http://www.spinics.net/lists/linux-btrfs/msg15837.html]
>
Hrm weird I didn't have that in btrfs-next. Thanks,
Josef
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-26 15:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-25 16:04 [PATCH] Add missing unlocks on error paths Daniel J Blueman
2012-04-25 17:08 ` Josef Bacik
2012-04-25 21:40 ` David Sterba
2012-04-26 15:08 ` Josef Bacik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.