aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-30 23:27:02 -0400
committerNeilBrown <neilb@suse.de>2009-03-30 23:27:02 -0400
commitd0a4bb492772ce5c4bdfba3744a99ed6f6fb238f (patch)
treea76356c2051e6f225c31989dbf278689554dfcbf /drivers/md/bitmap.c
parent1187cf0a3c8b647d08bc86e043563c8d2a327adc (diff)
md: never clear bit from the write-intent bitmap when the array is degraded.
It is safe to clear a bit from the write-intent bitmap for a raid1 if we know the data has been written to all devices, which is what the current test does. But it is not always safe to update the 'events_cleared' counter in that case. This is because one request could complete successfully after some other request has partially failed. So simply disable the clearing and updating of events_cleared whenever the array is degraded. This might end up not clearing some bits that could safely be cleared, but it is safest approach. Note that the bug fixed here did not risk corrupting data by letting the array get out-of-sync. Rather it meant that when a device is removed and re-added to the array, it might incorrectly require a full recovery rather than just recovering based on the bitmap. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 8fa3277f72dc..2ef497d1848c 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1307,6 +1307,9 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
1307 PRINTK(KERN_DEBUG "dec write-behind count %d/%d\n", 1307 PRINTK(KERN_DEBUG "dec write-behind count %d/%d\n",
1308 atomic_read(&bitmap->behind_writes), bitmap->max_write_behind); 1308 atomic_read(&bitmap->behind_writes), bitmap->max_write_behind);
1309 } 1309 }
1310 if (bitmap->mddev->degraded)
1311 /* Never clear bits or update events_cleared when degraded */
1312 success = 0;
1310 1313
1311 while (sectors) { 1314 while (sectors) {
1312 int blocks; 1315 int blocks;