diff options
author | NeilBrown <neilb@suse.de> | 2011-01-13 17:14:33 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-01-13 17:14:33 -0500 |
commit | defad61a5b16352d3e22a04d4c930a5b5a7fd1f0 (patch) | |
tree | c353bd036c12011d0eee7f7924c230888fd34b0a /drivers/md/md.c | |
parent | 43c73ca43b3e03bb228ff9350b6b44d0e560f262 (diff) |
md: md_stop_writes requires mddev_lock.
As md_stop_writes manipulates the sync_thread and calls md_update_sb,
it need to be called with mddev_lock held.
In all internal cases it is, but the symbol is exported for dm-raid to
call and in that case the lock won't be help.
Do make an exported version which takes the lock, and an internal
version which does not.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 540347c538f9..f43ff2962b2b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4704,7 +4704,7 @@ static void md_clean(mddev_t *mddev) | |||
4704 | mddev->plug = NULL; | 4704 | mddev->plug = NULL; |
4705 | } | 4705 | } |
4706 | 4706 | ||
4707 | void md_stop_writes(mddev_t *mddev) | 4707 | static void __md_stop_writes(mddev_t *mddev) |
4708 | { | 4708 | { |
4709 | if (mddev->sync_thread) { | 4709 | if (mddev->sync_thread) { |
4710 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 4710 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
@@ -4724,6 +4724,13 @@ void md_stop_writes(mddev_t *mddev) | |||
4724 | md_update_sb(mddev, 1); | 4724 | md_update_sb(mddev, 1); |
4725 | } | 4725 | } |
4726 | } | 4726 | } |
4727 | |||
4728 | void md_stop_writes(mddev_t *mddev) | ||
4729 | { | ||
4730 | mddev_lock(mddev); | ||
4731 | __md_stop_writes(mddev); | ||
4732 | mddev_unlock(mddev); | ||
4733 | } | ||
4727 | EXPORT_SYMBOL_GPL(md_stop_writes); | 4734 | EXPORT_SYMBOL_GPL(md_stop_writes); |
4728 | 4735 | ||
4729 | void md_stop(mddev_t *mddev) | 4736 | void md_stop(mddev_t *mddev) |
@@ -4748,7 +4755,7 @@ static int md_set_readonly(mddev_t *mddev, int is_open) | |||
4748 | goto out; | 4755 | goto out; |
4749 | } | 4756 | } |
4750 | if (mddev->pers) { | 4757 | if (mddev->pers) { |
4751 | md_stop_writes(mddev); | 4758 | __md_stop_writes(mddev); |
4752 | 4759 | ||
4753 | err = -ENXIO; | 4760 | err = -ENXIO; |
4754 | if (mddev->ro==1) | 4761 | if (mddev->ro==1) |
@@ -4785,7 +4792,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4785 | if (mddev->ro) | 4792 | if (mddev->ro) |
4786 | set_disk_ro(disk, 0); | 4793 | set_disk_ro(disk, 0); |
4787 | 4794 | ||
4788 | md_stop_writes(mddev); | 4795 | __md_stop_writes(mddev); |
4789 | md_stop(mddev); | 4796 | md_stop(mddev); |
4790 | mddev->queue->merge_bvec_fn = NULL; | 4797 | mddev->queue->merge_bvec_fn = NULL; |
4791 | mddev->queue->unplug_fn = NULL; | 4798 | mddev->queue->unplug_fn = NULL; |