Commit 978a7a47 authored by NeilBrown's avatar NeilBrown

md/bitmap: protect clearing of ->bitmap by mddev->lock

This makes it safe to inspect the struct while holding only
the spinlock.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 36d091f4
...@@ -1619,7 +1619,9 @@ void bitmap_destroy(struct mddev *mddev) ...@@ -1619,7 +1619,9 @@ void bitmap_destroy(struct mddev *mddev)
return; return;
mutex_lock(&mddev->bitmap_info.mutex); mutex_lock(&mddev->bitmap_info.mutex);
spin_lock(&mddev->lock);
mddev->bitmap = NULL; /* disconnect from the md device */ mddev->bitmap = NULL; /* disconnect from the md device */
spin_unlock(&mddev->lock);
mutex_unlock(&mddev->bitmap_info.mutex); mutex_unlock(&mddev->bitmap_info.mutex);
if (mddev->thread) if (mddev->thread)
mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT; mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
......
...@@ -392,6 +392,7 @@ struct mddev { ...@@ -392,6 +392,7 @@ struct mddev {
* clearing MD_CHANGE_* * clearing MD_CHANGE_*
* in_sync - and related safemode and MD_CHANGE changes * in_sync - and related safemode and MD_CHANGE changes
* pers (also protected by reconfig_mutex and pending IO). * pers (also protected by reconfig_mutex and pending IO).
* clearing ->bitmap
*/ */
spinlock_t lock; spinlock_t lock;
wait_queue_head_t sb_wait; /* for waiting on superblock updates */ wait_queue_head_t sb_wait; /* for waiting on superblock updates */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment