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

md: using GFP_NOIO to allocate bio for flush request

A flush request is usually issued in transaction commit code path, so
using GFP_KERNEL to allocate memory for flush request bio falls into
the classic deadlock issue.

This is suitable for any -stable kernel to which it applies as it
avoids a possible deadlock.

Cc: stable@vger.kernel.org
Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>

authored by

Shaohua Li and committed by
NeilBrown
b5e1b8ce b0d634d5

+1 -1
+1 -1
drivers/md/md.c
··· 452 452 atomic_inc(&rdev->nr_pending); 453 453 atomic_inc(&rdev->nr_pending); 454 454 rcu_read_unlock(); 455 - bi = bio_alloc_mddev(GFP_KERNEL, 0, mddev); 455 + bi = bio_alloc_mddev(GFP_NOIO, 0, mddev); 456 456 bi->bi_end_io = md_end_flush; 457 457 bi->bi_private = rdev; 458 458 bi->bi_bdev = rdev->bdev;