* [PATCH] Btrfs: fix deadlock in run_delalloc_nocow
@ 2018-01-25 18:02 Liu Bo
2018-01-26 14:02 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2018-01-25 18:02 UTC (permalink / raw)
To: linux-btrfs
@cur_offset is not set back to what it should be (@cow_start) if
btrfs_next_leaf() returns something wrong, and the range [cow_start,
cur_offset) remains locked forever.
cc: <stable@vger.kernel.org>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/inode.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ac1a1ac..281a250 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1332,8 +1332,11 @@ static noinline int run_delalloc_nocow(struct inode *inode,
leaf = path->nodes[0];
if (path->slots[0] >= btrfs_header_nritems(leaf)) {
ret = btrfs_next_leaf(root, path);
- if (ret < 0)
+ if (ret < 0) {
+ if (cow_start != (u64)-1)
+ cur_offset = cow_start;
goto error;
+ }
if (ret > 0)
break;
leaf = path->nodes[0];
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: fix deadlock in run_delalloc_nocow
2018-01-25 18:02 [PATCH] Btrfs: fix deadlock in run_delalloc_nocow Liu Bo
@ 2018-01-26 14:02 ` Josef Bacik
0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2018-01-26 14:02 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Thu, Jan 25, 2018 at 11:02:50AM -0700, Liu Bo wrote:
> @cur_offset is not set back to what it should be (@cow_start) if
> btrfs_next_leaf() returns something wrong, and the range [cow_start,
> cur_offset) remains locked forever.
>
> cc: <stable@vger.kernel.org>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-01-26 14:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 18:02 [PATCH] Btrfs: fix deadlock in run_delalloc_nocow Liu Bo
2018-01-26 14:02 ` 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).