diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-21 19:42:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-07-21 19:42:03 -0400 |
commit | 55b636b419a269e167f7d6a9265e5e316a89cd5f (patch) | |
tree | 3cd695a0d880bcb0dd8212dadb181c8f8426fc7a | |
parent | 490fc053865c9cc40f1085ef8a5504f5341f79d2 (diff) | |
parent | bd3599a0e142cd73edd3b6801068ac3f48ac771a (diff) |
Merge tag 'for-4.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fix from David Sterba:
"A fix of a corruption regarding fsync and clone, under some very
specific conditions explained in the patch.
The fix is marked for stable 3.16+ so I'd like to get it merged now
given the impact"
* tag 'for-4.18-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
Btrfs: fix file data corruption after cloning a range and fsync
-rw-r--r-- | fs/btrfs/extent_io.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index e55843f536bc..b3e45714d28f 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -4238,8 +4238,9 @@ int try_release_extent_mapping(struct page *page, gfp_t mask) | |||
4238 | struct extent_map *em; | 4238 | struct extent_map *em; |
4239 | u64 start = page_offset(page); | 4239 | u64 start = page_offset(page); |
4240 | u64 end = start + PAGE_SIZE - 1; | 4240 | u64 end = start + PAGE_SIZE - 1; |
4241 | struct extent_io_tree *tree = &BTRFS_I(page->mapping->host)->io_tree; | 4241 | struct btrfs_inode *btrfs_inode = BTRFS_I(page->mapping->host); |
4242 | struct extent_map_tree *map = &BTRFS_I(page->mapping->host)->extent_tree; | 4242 | struct extent_io_tree *tree = &btrfs_inode->io_tree; |
4243 | struct extent_map_tree *map = &btrfs_inode->extent_tree; | ||
4243 | 4244 | ||
4244 | if (gfpflags_allow_blocking(mask) && | 4245 | if (gfpflags_allow_blocking(mask) && |
4245 | page->mapping->host->i_size > SZ_16M) { | 4246 | page->mapping->host->i_size > SZ_16M) { |
@@ -4262,6 +4263,8 @@ int try_release_extent_mapping(struct page *page, gfp_t mask) | |||
4262 | extent_map_end(em) - 1, | 4263 | extent_map_end(em) - 1, |
4263 | EXTENT_LOCKED | EXTENT_WRITEBACK, | 4264 | EXTENT_LOCKED | EXTENT_WRITEBACK, |
4264 | 0, NULL)) { | 4265 | 0, NULL)) { |
4266 | set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | ||
4267 | &btrfs_inode->runtime_flags); | ||
4265 | remove_extent_mapping(map, em); | 4268 | remove_extent_mapping(map, em); |
4266 | /* once for the rb tree */ | 4269 | /* once for the rb tree */ |
4267 | free_extent_map(em); | 4270 | free_extent_map(em); |