diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2018-01-25 21:02:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-02-22 17:42:29 +0300 |
commit | c766cb48771b7604fb5beca646bfa9904d0a2b17 (patch) | |
tree | 1678e676494dc199c4c70b309338493f9b6a7478 /fs | |
parent | f6318abd3a5458be821eb417969726622e1e09c4 (diff) | |
download | linux-c766cb48771b7604fb5beca646bfa9904d0a2b17.tar.xz |
Btrfs: fix deadlock in run_delalloc_nocow
commit e89166990f11c3f21e1649d760dd35f9e410321c upstream.
@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>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5eaedff28a32..db3f67b58104 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1330,8 +1330,11 @@ next_slot: 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]; |