Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-5.1-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fix from David Sterba:
"One patch to fix a crash in io submission path, due to memory
allocation errors.

In short, the multipage bio work that landed in 5.1 caused larger bios
that in turn require larger temporary memory for checksums. The patch
is a workaround, we're going to rework the allocation so it does not
require the vmalloc fallback.

It took a while to identify that it's caused by patches in 5.1 and not
a patchset that did some changes in error handling in the code. I've
tested it on various memory/cpu combinations, it could hit OOM but
does not crash.

The timestamp of the patch is less than a day due to updates in the
changelog, tests were running meanwhile"

* tag 'for-5.1-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: Switch memory allocations in async csum calculation path to kvmalloc

+13 -5
+11 -4
fs/btrfs/file-item.c
··· 7 7 #include <linux/slab.h> 8 8 #include <linux/pagemap.h> 9 9 #include <linux/highmem.h> 10 + #include <linux/sched/mm.h> 10 11 #include "ctree.h" 11 12 #include "disk-io.h" 12 13 #include "transaction.h" ··· 428 427 unsigned long this_sum_bytes = 0; 429 428 int i; 430 429 u64 offset; 430 + unsigned nofs_flag; 431 431 432 - sums = kzalloc(btrfs_ordered_sum_size(fs_info, bio->bi_iter.bi_size), 433 - GFP_NOFS); 432 + nofs_flag = memalloc_nofs_save(); 433 + sums = kvzalloc(btrfs_ordered_sum_size(fs_info, bio->bi_iter.bi_size), 434 + GFP_KERNEL); 435 + memalloc_nofs_restore(nofs_flag); 436 + 434 437 if (!sums) 435 438 return BLK_STS_RESOURCE; 436 439 ··· 477 472 478 473 bytes_left = bio->bi_iter.bi_size - total_bytes; 479 474 480 - sums = kzalloc(btrfs_ordered_sum_size(fs_info, bytes_left), 481 - GFP_NOFS); 475 + nofs_flag = memalloc_nofs_save(); 476 + sums = kvzalloc(btrfs_ordered_sum_size(fs_info, 477 + bytes_left), GFP_KERNEL); 478 + memalloc_nofs_restore(nofs_flag); 482 479 BUG_ON(!sums); /* -ENOMEM */ 483 480 sums->len = bytes_left; 484 481 ordered = btrfs_lookup_ordered_extent(inode,
+2 -1
fs/btrfs/ordered-data.c
··· 6 6 #include <linux/slab.h> 7 7 #include <linux/blkdev.h> 8 8 #include <linux/writeback.h> 9 + #include <linux/sched/mm.h> 9 10 #include "ctree.h" 10 11 #include "transaction.h" 11 12 #include "btrfs_inode.h" ··· 443 442 cur = entry->list.next; 444 443 sum = list_entry(cur, struct btrfs_ordered_sum, list); 445 444 list_del(&sum->list); 446 - kfree(sum); 445 + kvfree(sum); 447 446 } 448 447 kmem_cache_free(btrfs_ordered_extent_cache, entry); 449 448 }