* [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree
@ 2021-07-07 11:23 fdmanana
2021-07-07 12:01 ` Nikolay Borisov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: fdmanana @ 2021-07-07 11:23 UTC (permalink / raw)
To: linux-btrfs
From: Filipe Manana <fdmanana@suse.com>
When syncing the log, if we fail to allocate the root node for the log
root tree:
1) We are unlocking fs_info->tree_log_mutex, but at this point we have
not yet locked this mutex;
2) We have locked fs_info->tree_root->log_mutex, but we end up not
unlocking it;
So fix this by unlocking fs_info->tree_root->log_mutex instead of
fs_info->tree_log_mutex.
Fixes: e75f9fd194090e ("btrfs: zoned: move log tree node allocation out of log_root_tree->log_mutex")
CC: stable@vger.kernel.org # 5.13+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
fs/btrfs/tree-log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 8471837e7eb9..9fd0348be7f5 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -3173,7 +3173,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
if (!log_root_tree->node) {
ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
if (ret) {
- mutex_unlock(&fs_info->tree_log_mutex);
+ mutex_unlock(&fs_info->tree_root->log_mutex);
goto out;
}
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree
2021-07-07 11:23 [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree fdmanana
@ 2021-07-07 12:01 ` Nikolay Borisov
2021-07-07 15:07 ` Johannes Thumshirn
2021-07-07 17:32 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Borisov @ 2021-07-07 12:01 UTC (permalink / raw)
To: fdmanana, linux-btrfs
On 7.07.21 г. 14:23, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> When syncing the log, if we fail to allocate the root node for the log
> root tree:
>
> 1) We are unlocking fs_info->tree_log_mutex, but at this point we have
> not yet locked this mutex;
>
> 2) We have locked fs_info->tree_root->log_mutex, but we end up not
> unlocking it;
>
> So fix this by unlocking fs_info->tree_root->log_mutex instead of
> fs_info->tree_log_mutex.
>
> Fixes: e75f9fd194090e ("btrfs: zoned: move log tree node allocation out of log_root_tree->log_mutex")
> CC: stable@vger.kernel.org # 5.13+
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree
2021-07-07 11:23 [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree fdmanana
2021-07-07 12:01 ` Nikolay Borisov
@ 2021-07-07 15:07 ` Johannes Thumshirn
2021-07-07 17:32 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2021-07-07 15:07 UTC (permalink / raw)
To: fdmanana, linux-btrfs
On 07/07/2021 13:23, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> When syncing the log, if we fail to allocate the root node for the log
> root tree:
>
> 1) We are unlocking fs_info->tree_log_mutex, but at this point we have
> not yet locked this mutex;
>
> 2) We have locked fs_info->tree_root->log_mutex, but we end up not
> unlocking it;
>
> So fix this by unlocking fs_info->tree_root->log_mutex instead of
> fs_info->tree_log_mutex.
>
> Fixes: e75f9fd194090e ("btrfs: zoned: move log tree node allocation out of log_root_tree->log_mutex")
> CC: stable@vger.kernel.org # 5.13+
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Good catch!
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree
2021-07-07 11:23 [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree fdmanana
2021-07-07 12:01 ` Nikolay Borisov
2021-07-07 15:07 ` Johannes Thumshirn
@ 2021-07-07 17:32 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2021-07-07 17:32 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs
On Wed, Jul 07, 2021 at 12:23:45PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> When syncing the log, if we fail to allocate the root node for the log
> root tree:
>
> 1) We are unlocking fs_info->tree_log_mutex, but at this point we have
> not yet locked this mutex;
>
> 2) We have locked fs_info->tree_root->log_mutex, but we end up not
> unlocking it;
>
> So fix this by unlocking fs_info->tree_root->log_mutex instead of
> fs_info->tree_log_mutex.
>
> Fixes: e75f9fd194090e ("btrfs: zoned: move log tree node allocation out of log_root_tree->log_mutex")
> CC: stable@vger.kernel.org # 5.13+
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-07 17:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 11:23 [PATCH] btrfs: zoned: fix wrong mutex unlock on failure to allocate log root tree fdmanana
2021-07-07 12:01 ` Nikolay Borisov
2021-07-07 15:07 ` Johannes Thumshirn
2021-07-07 17:32 ` David Sterba
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.