diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-26 11:41:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-26 11:41:54 -0400 |
commit | 84bfed40fc25dd052620398fdcc19d8c77f02270 (patch) | |
tree | e0a8c7df159edfdc745b91de2c8158f939c31e03 | |
parent | 6f0d349d922ba44e4348a17a78ea51b7135965b1 (diff) | |
parent | c5b4a50b74018b3677098151ec5f4fce07d5e6a0 (diff) |
Merge tag 'for-4.18-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba:
"Two regression fixes and an incorrect error value propagation fix from
'rename exchange'"
* tag 'for-4.18-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
Btrfs: fix return value on rename exchange failure
btrfs: fix invalid-free in btrfs_extent_same
Btrfs: fix physical offset reported by fiemap for inline extents
-rw-r--r-- | fs/btrfs/extent_io.c | 5 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 4 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 10 |
3 files changed, 12 insertions, 7 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index cce6087d6880..e55843f536bc 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -4542,8 +4542,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
4542 | offset_in_extent = em_start - em->start; | 4542 | offset_in_extent = em_start - em->start; |
4543 | em_end = extent_map_end(em); | 4543 | em_end = extent_map_end(em); |
4544 | em_len = em_end - em_start; | 4544 | em_len = em_end - em_start; |
4545 | disko = em->block_start + offset_in_extent; | ||
4546 | flags = 0; | 4545 | flags = 0; |
4546 | if (em->block_start < EXTENT_MAP_LAST_BYTE) | ||
4547 | disko = em->block_start + offset_in_extent; | ||
4548 | else | ||
4549 | disko = 0; | ||
4547 | 4550 | ||
4548 | /* | 4551 | /* |
4549 | * bump off for our next call to get_extent | 4552 | * bump off for our next call to get_extent |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index e9482f0db9d0..be98dfc8d0f8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -9443,6 +9443,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, | |||
9443 | u64 new_idx = 0; | 9443 | u64 new_idx = 0; |
9444 | u64 root_objectid; | 9444 | u64 root_objectid; |
9445 | int ret; | 9445 | int ret; |
9446 | int ret2; | ||
9446 | bool root_log_pinned = false; | 9447 | bool root_log_pinned = false; |
9447 | bool dest_log_pinned = false; | 9448 | bool dest_log_pinned = false; |
9448 | 9449 | ||
@@ -9639,7 +9640,8 @@ out_fail: | |||
9639 | dest_log_pinned = false; | 9640 | dest_log_pinned = false; |
9640 | } | 9641 | } |
9641 | } | 9642 | } |
9642 | ret = btrfs_end_transaction(trans); | 9643 | ret2 = btrfs_end_transaction(trans); |
9644 | ret = ret ? ret : ret2; | ||
9643 | out_notrans: | 9645 | out_notrans: |
9644 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) | 9646 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) |
9645 | up_read(&fs_info->subvol_sem); | 9647 | up_read(&fs_info->subvol_sem); |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c2837a32d689..43ecbe620dea 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -3577,7 +3577,7 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
3577 | ret = btrfs_extent_same_range(src, loff, BTRFS_MAX_DEDUPE_LEN, | 3577 | ret = btrfs_extent_same_range(src, loff, BTRFS_MAX_DEDUPE_LEN, |
3578 | dst, dst_loff, &cmp); | 3578 | dst, dst_loff, &cmp); |
3579 | if (ret) | 3579 | if (ret) |
3580 | goto out_unlock; | 3580 | goto out_free; |
3581 | 3581 | ||
3582 | loff += BTRFS_MAX_DEDUPE_LEN; | 3582 | loff += BTRFS_MAX_DEDUPE_LEN; |
3583 | dst_loff += BTRFS_MAX_DEDUPE_LEN; | 3583 | dst_loff += BTRFS_MAX_DEDUPE_LEN; |
@@ -3587,16 +3587,16 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
3587 | ret = btrfs_extent_same_range(src, loff, tail_len, dst, | 3587 | ret = btrfs_extent_same_range(src, loff, tail_len, dst, |
3588 | dst_loff, &cmp); | 3588 | dst_loff, &cmp); |
3589 | 3589 | ||
3590 | out_free: | ||
3591 | kvfree(cmp.src_pages); | ||
3592 | kvfree(cmp.dst_pages); | ||
3593 | |||
3590 | out_unlock: | 3594 | out_unlock: |
3591 | if (same_inode) | 3595 | if (same_inode) |
3592 | inode_unlock(src); | 3596 | inode_unlock(src); |
3593 | else | 3597 | else |
3594 | btrfs_double_inode_unlock(src, dst); | 3598 | btrfs_double_inode_unlock(src, dst); |
3595 | 3599 | ||
3596 | out_free: | ||
3597 | kvfree(cmp.src_pages); | ||
3598 | kvfree(cmp.dst_pages); | ||
3599 | |||
3600 | return ret; | 3600 | return ret; |
3601 | } | 3601 | } |
3602 | 3602 | ||