diff options
author | NeilBrown <neilb@suse.de> | 2007-01-26 03:57:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-26 16:51:00 -0500 |
commit | 2a2275d630b982e5f90206f9bc497f6695a3ec5d (patch) | |
tree | 88cddee709b2107b74e5424810d4ffb6e3772382 /drivers/md/raid1.c | |
parent | a0ad13ef643a5829d63c456ab6143bbda60b44a9 (diff) |
[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>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index ab74d40cac98..97ee870b265d 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2104,6 +2104,8 @@ static int raid1_reshape(mddev_t *mddev) | |||
2104 | return -EINVAL; | 2104 | return -EINVAL; |
2105 | } | 2105 | } |
2106 | 2106 | ||
2107 | md_allow_write(mddev); | ||
2108 | |||
2107 | raid_disks = mddev->raid_disks + mddev->delta_disks; | 2109 | raid_disks = mddev->raid_disks + mddev->delta_disks; |
2108 | 2110 | ||
2109 | if (raid_disks < conf->raid_disks) { | 2111 | if (raid_disks < conf->raid_disks) { |