aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-12-13 20:49:46 -0500
committerNeilBrown <neilb@suse.de>2009-12-13 20:49:46 -0500
commitaa5cbd103887011b4830355f88fb055f9ad2d556 (patch)
tree92ef7c80999c6d0bfc6fef9a9cd3e4a75ee16c06 /drivers/md/md.c
parentf40542532e96dda5506eb76badea322f2ae4731c (diff)
md/bitmap: protect against bitmap removal while being updated.
A write intent bitmap can be removed from an array while the array is active. When this happens, all IO is suspended and flushed before the bitmap is removed. However it is possible that bitmap_daemon_work is still running to clear old bits from the bitmap. If it is, it can dereference the bitmap after it has been freed. So introduce a new mutex to protect bitmap_daemon_work and get it before destroying a bitmap. This is suitable for any current -stable kernel. Signed-off-by: NeilBrown <neilb@suse.de> Cc: stable@kernel.org
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5f154ef1e4b..1be7a16a7a5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -363,6 +363,7 @@ static mddev_t * mddev_find(dev_t unit)
363 363
364 mutex_init(&new->open_mutex); 364 mutex_init(&new->open_mutex);
365 mutex_init(&new->reconfig_mutex); 365 mutex_init(&new->reconfig_mutex);
366 mutex_init(&new->bitmap_mutex);
366 INIT_LIST_HEAD(&new->disks); 367 INIT_LIST_HEAD(&new->disks);
367 INIT_LIST_HEAD(&new->all_mddevs); 368 INIT_LIST_HEAD(&new->all_mddevs);
368 init_timer(&new->safemode_timer); 369 init_timer(&new->safemode_timer);
@@ -6625,7 +6626,7 @@ void md_check_recovery(mddev_t *mddev)
6625 6626
6626 6627
6627 if (mddev->bitmap) 6628 if (mddev->bitmap)
6628 bitmap_daemon_work(mddev->bitmap); 6629 bitmap_daemon_work(mddev);
6629 6630
6630 if (mddev->ro) 6631 if (mddev->ro)
6631 return; 6632 return;