Skip to contentSkip to conversation

md: using GFP_NOIO to allocate bio for flush request

RFC In review Shaohua Li 3 participants 4 messages Apr 16, 2012 – May 8, 2012 MD RAID

lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

RFC 1/1 md: using GFP_NOIO to allocate bio for flush request

flush request is issued in transaction commit code path usually, so looks using GFP_KERNEL to allocate memory for flush request bio falls into the classic deadlock issue. dm already gets it right.

---
 drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
Index: linux/drivers/md/md.c
===================================================================
@@ -450,7 +450,7 @@ static void submit_flushes(struct work_s
 			atomic_inc(&rdev->nr_pending);
 			atomic_inc(&rdev->nr_pending);
 			rcu_read_unlock();
-			bi = bio_alloc_mddev(GFP_KERNEL, 0, mddev);
+			bi = bio_alloc_mddev(GFP_NOIO, 0, mddev);
 			bi->bi_end_io = md_end_flush;
 			bi->bi_private = rdev;
 			bi->bi_bdev = rdev->bdev;
author
#1 lore raw
Quoted 5 lines · Shaohua Li

flush request is issued in transaction commit code path usually, so looks using
GFP_KERNEL to allocate memory for flush request bio falls into the classic deadlock issue. dm already gets it right.

ping!

Quoted 18 lines
---
 drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux/drivers/md/md.c
===================================================================

drivers/md/md.c +1 -1
@@ -450,7 +450,7 @@ static void submit_flushes(struct work_s
 			atomic_inc(&rdev->nr_pending);
 			atomic_inc(&rdev->nr_pending);
 			rcu_read_unlock();
-			bi = bio_alloc_mddev(GFP_KERNEL, 0, mddev);
+			bi = bio_alloc_mddev(GFP_NOIO, 0, mddev);
 			bi->bi_end_io = md_end_flush;
 			bi->bi_private = rdev;
 			bi->bi_bdev = rdev->bdev;
#2 lore raw
Quoted 8 lines · Shaohua Li
Quoted 5 lines · Shaohua Li

flush request is issued in transaction commit code path usually, so looks using
GFP_KERNEL to allocate memory for flush request bio falls into the classic deadlock issue. dm already gets it right.

ping!

This one should probably also be queued for -stable right?

#3 lore raw
Quoted 11 lines · On Tue, 8 May 2012 12:31:18 -0700 Dan Williams <[email protected]> wrote:
Quoted 8 lines · Shaohua Li
Quoted 5 lines · Shaohua Li

flush request is issued in transaction commit code path usually, so looks using
GFP_KERNEL to allocate memory for flush request bio falls into the classic deadlock issue. dm already gets it right.

ping!

This one should probably also be queued for -stable right?

I suspect so.

I've edited the commit-log message slightly and added a 'cc' for stable, It is now in my for-next branch. I'll push to Linus next week.

Thanks Shaohua,

NeilBrown