* [PATCH] Btrfs: avoid deadlock in btrfs_async_run_delayed_root
@ 2017-10-20 23:40 Liu Bo
2017-10-21 5:41 ` Liu Bo
0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2017-10-20 23:40 UTC (permalink / raw)
To: linux-btrfs
Here %path is set with ->leave_spinning=1, thus it'll hold the rwlock
after btrfs_search_slot(), however, when processing delayed items in
__btrfs_commit_inode_delayed_items(), it goes to acquire node->mutex
which might sleep, that is, it may sleep under spin_lock.
Given node->mutex is necessary to avoid race between async works, this
remove the ->leave_spining setting.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/delayed-inode.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 19e4ad2..a857a2f 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1331,7 +1331,6 @@ static void btrfs_async_run_delayed_root(struct btrfs_work *work)
if (!delayed_node)
goto free_path;
- path->leave_spinning = 1;
root = delayed_node->root;
trans = btrfs_join_transaction(root);
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: avoid deadlock in btrfs_async_run_delayed_root
2017-10-20 23:40 [PATCH] Btrfs: avoid deadlock in btrfs_async_run_delayed_root Liu Bo
@ 2017-10-21 5:41 ` Liu Bo
0 siblings, 0 replies; 2+ messages in thread
From: Liu Bo @ 2017-10-21 5:41 UTC (permalink / raw)
To: linux-btrfs
Hi,
Please ignore this patch, I misunderstood the lock order.
thanks,
-liubo
On Fri, Oct 20, 2017 at 05:40:12PM -0600, Liu Bo wrote:
> Here %path is set with ->leave_spinning=1, thus it'll hold the rwlock
> after btrfs_search_slot(), however, when processing delayed items in
> __btrfs_commit_inode_delayed_items(), it goes to acquire node->mutex
> which might sleep, that is, it may sleep under spin_lock.
>
> Given node->mutex is necessary to avoid race between async works, this
> remove the ->leave_spining setting.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/delayed-inode.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
> index 19e4ad2..a857a2f 100644
> --- a/fs/btrfs/delayed-inode.c
> +++ b/fs/btrfs/delayed-inode.c
> @@ -1331,7 +1331,6 @@ static void btrfs_async_run_delayed_root(struct btrfs_work *work)
> if (!delayed_node)
> goto free_path;
>
> - path->leave_spinning = 1;
> root = delayed_node->root;
>
> trans = btrfs_join_transaction(root);
> --
> 2.9.4
>
> --
> 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:[~2017-10-21 5:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 23:40 [PATCH] Btrfs: avoid deadlock in btrfs_async_run_delayed_root Liu Bo
2017-10-21 5:41 ` Liu Bo
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.