Commit 11da37b26301be772c289c5406aec347ad140bd6
Exists in
ti-lsk-linux-4.1.y
and in
12 other branches
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull two btrfs fixes from Chris Mason: "This has two fixes that we've been testing for 3.16, but since both are safe and fix real bugs, it makes sense to send for 3.15 instead" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: send, fix incorrect ref access when using extrefs Btrfs: fix EIO on reading file after ioctl clone works on it
Showing 2 changed files Side-by-side Diff
fs/btrfs/ioctl.c
... | ... | @@ -3120,6 +3120,8 @@ |
3120 | 3120 | } else if (type == BTRFS_FILE_EXTENT_INLINE) { |
3121 | 3121 | u64 skip = 0; |
3122 | 3122 | u64 trim = 0; |
3123 | + u64 aligned_end = 0; | |
3124 | + | |
3123 | 3125 | if (off > key.offset) { |
3124 | 3126 | skip = off - key.offset; |
3125 | 3127 | new_key.offset += skip; |
3126 | 3128 | |
... | ... | @@ -3136,9 +3138,11 @@ |
3136 | 3138 | size -= skip + trim; |
3137 | 3139 | datal -= skip + trim; |
3138 | 3140 | |
3141 | + aligned_end = ALIGN(new_key.offset + datal, | |
3142 | + root->sectorsize); | |
3139 | 3143 | ret = btrfs_drop_extents(trans, root, inode, |
3140 | 3144 | new_key.offset, |
3141 | - new_key.offset + datal, | |
3145 | + aligned_end, | |
3142 | 3146 | 1); |
3143 | 3147 | if (ret) { |
3144 | 3148 | if (ret != -EOPNOTSUPP) |
fs/btrfs/send.c
... | ... | @@ -1668,7 +1668,7 @@ |
1668 | 1668 | goto out; |
1669 | 1669 | } |
1670 | 1670 | |
1671 | - if (key.type == BTRFS_INODE_REF_KEY) { | |
1671 | + if (found_key.type == BTRFS_INODE_REF_KEY) { | |
1672 | 1672 | struct btrfs_inode_ref *iref; |
1673 | 1673 | iref = btrfs_item_ptr(path->nodes[0], path->slots[0], |
1674 | 1674 | struct btrfs_inode_ref); |