]> pilppa.com Git - linux-2.6-omap-h63xx.git/commit
[PATCH] md: fix potential memalloc deadlock in md
authorNeilBrown <neilb@suse.de>
Fri, 26 Jan 2007 08:57:11 +0000 (00:57 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 26 Jan 2007 21:51:00 +0000 (13:51 -0800)
commit2a2275d630b982e5f90206f9bc497f6695a3ec5d
tree88cddee709b2107b74e5424810d4ffb6e3772382
parenta0ad13ef643a5829d63c456ab6143bbda60b44a9
[PATCH] md: fix potential memalloc deadlock in md

If a GFP_KERNEL allocation is attempted in md while the mddev_lock is held,
it is possible for a deadlock to eventuate.

This happens if the array was marked 'clean', and the memalloc triggers a
write-out to the md device.

For the writeout to succeed, the array must be marked 'dirty', and that
requires getting the mddev_lock.

So, before attempting a GFP_KERNEL allocation while holding the lock, make
sure the array is marked 'dirty' (unless it is currently read-only).

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/md.c
drivers/md/raid1.c
drivers/md/raid5.c
include/linux/raid/md.h