diff options
author | NeilBrown <neilb@suse.de> | 2012-04-12 02:05:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-22 19:21:44 -0400 |
commit | a10d1f32dbf1b9f74b6b6ba1571ee3f7a1bd3883 (patch) | |
tree | 7d0e3536c79318e029eb41f081b8392ae462846f | |
parent | 127f90d6ff47e9095261f442d1ad511930cd7fd4 (diff) |
md/bitmap: prevent bitmap_daemon_work running while initialising bitmap
commit afbaa90b80b1ec66e5137cc3824746bfdf559b18 upstream.
If a bitmap is added while the array is active, it is possible
for bitmap_daemon_work to run while the bitmap is being
initialised.
This is particularly a problem if bitmap_daemon_work sees
bitmap->filemap as non-NULL before it has been filled in properly.
So hold bitmap_info.mutex while filling in ->filemap
to prevent problems.
This patch is suitable for any -stable kernel, though it might not
apply cleanly before about 3.1.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/md/bitmap.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 703a3fa831b..2eba9a12a6a 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1897,7 +1897,9 @@ int bitmap_load(mddev_t *mddev) | |||
1897 | * re-add of a missing device */ | 1897 | * re-add of a missing device */ |
1898 | start = mddev->recovery_cp; | 1898 | start = mddev->recovery_cp; |
1899 | 1899 | ||
1900 | mutex_lock(&mddev->bitmap_info.mutex); | ||
1900 | err = bitmap_init_from_disk(bitmap, start); | 1901 | err = bitmap_init_from_disk(bitmap, start); |
1902 | mutex_unlock(&mddev->bitmap_info.mutex); | ||
1901 | } | 1903 | } |
1902 | if (err) | 1904 | if (err) |
1903 | goto out; | 1905 | goto out; |