mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
btrfs_drop_extent fixe for inline items > 8K
When truncating a inline extent, btrfs_drop_extents doesn't properly handle the case "key.offset > inline_limit". This bug can only happen when max line size is larger than 8K. Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
parent
1b0f7c29e2
commit
0181e58f91
1 changed files with 3 additions and 5 deletions
|
@ -591,8 +591,7 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
|
|||
}
|
||||
}
|
||||
bookend = 1;
|
||||
if (found_inline && start <= key.offset &&
|
||||
inline_limit < extent_end)
|
||||
if (found_inline && start <= key.offset)
|
||||
keep = 1;
|
||||
}
|
||||
/* truncate existing extent */
|
||||
|
@ -672,11 +671,10 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans,
|
|||
if (!bookend)
|
||||
continue;
|
||||
}
|
||||
if (bookend && found_inline && start <= key.offset &&
|
||||
inline_limit < extent_end && key.offset <= inline_limit) {
|
||||
if (bookend && found_inline && start <= key.offset) {
|
||||
u32 new_size;
|
||||
new_size = btrfs_file_extent_calc_inline_size(
|
||||
extent_end - inline_limit);
|
||||
extent_end - end);
|
||||
btrfs_truncate_item(trans, root, path, new_size, 0);
|
||||
}
|
||||
/* create bookend, splitting the extent in two */
|
||||
|
|
Loading…
Reference in a new issue