linux/drivers
Jun'ichi Nomura 930d332a23 [PATCH] drivers/md/dm-raid1.c: Fix inconsistent mirroring after interrupted recovery
dm-mirror has potential data corruption problem: while on-disk log shows
that all disk contents are in-sync, actual contents of the disks are not
synchronized.  This problem occurs if initial recovery (synching) is
interrupted and resumed.

Attached patch fixes this problem.

Background:

rh_dec() changes the region state from RH_NOSYNC (out-of-sync) to RH_CLEAN
(in-sync), which results in the corresponding bit of clean_bits being set.

This is harmful if on-disk log is used and the map is removed/suspended
before the initial sync is completed.  The clean_bits is written down to
the on-disk log at the map removal, and, upon resume, it's read and copied
to sync_bits.  Since the recovery process refers to the sync_bits to find a
region to be recovered, the region whose state was changed from RH_NOSYNC
to RH_CLEAN is no longer recovered.

If you haven't applied dm-raid1-read-balancing.patch proposed in dm-devel
sometimes ago, the contents of the mirrored disk just corrupt silently.  If
you have, balanced read may get bogus data from out-of-sync disks.

The patch keeps RH_NOSYNC state unchanged.  It will be changed to
RH_RECOVERING when recovery starts and get reclaimed when the recovery
completes.  So it doesn't leak the region hash entry.

Description:

Keep RH_NOSYNC state unchanged when I/O on the region completes.

rh_dec() changes the region state from RH_NOSYNC (out-of-sync) to RH_CLEAN
(in-sync), which results in the corresponding bit of clean_bits being set.

This is harmful if on-disk log is used and the map is removed/suspended
before the initial sync is completed.  The clean_bits is written down to
the on-disk log at the map removal, and, upon resume, it's read and copied
to sync_bits.  Since the recovery process refers to the sync_bits to find a
region to be recovered, the region whose state was changed from RH_NOSYNC
to RH_CLEAN is no longer recovered.

If you haven't applied dm-raid1-read-balancing.patch proposed in dm-devel
sometimes ago, the contents of the mirrored disk just corrupt silently.  If
you have, balanced read may get bogus data from out-of-sync disks.

The RH_NOSYNC region will be changed to RH_RECOVERING when recovery starts
on the region and get reclaimed when the recovery completes.  So it doesn't
leak the region hash entry.

Alasdair said:

  I've analysed the relevant part of the state machine and I believe that
  the patch is correct.

  (Further work on this code is still needed - this patch has the
  side-effect of holding onto memory unnecessarily for long periods of time
  under certain workloads - but better that than corrupting data.)

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-27 08:44:58 -08:00
..
acorn
acpi [PATCH] more s/fucn/func/ typo fixes 2006-03-26 08:57:09 -08:00
amba
atm Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild 2006-03-25 08:48:48 -08:00
base [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
block [PATCH] mempool: use mempool_create_slab_pool() 2006-03-26 08:57:00 -08:00
bluetooth [Bluetooth] Fix firmware loading problem of BT3C driver 2006-02-13 11:40:07 +01:00
cdrom [PATCH] Remove MODULE_PARM 2006-03-25 08:22:52 -08:00
char [PATCH] RTC subsystem: ARM cleanup 2006-03-27 08:44:50 -08:00
connector [PATCH] sem2mutex: drivers: raw, connector, dcdbas, ppp_generic 2006-03-23 07:38:10 -08:00
cpufreq [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
crypto [CRYPTO] api: Align tfm context as wide as possible 2006-03-21 20:14:08 +11:00
dio [PATCH] hp300: fix driver_register() return handling, remove dio_module_init() 2006-03-25 08:22:53 -08:00
edac [PATCH] EDAC: use EXPORT_SYMBOL_GPL 2006-03-26 08:57:08 -08:00
eisa [PATCH] EISA: Ignore generated file drivers/eisa/devlist.h 2006-03-25 08:23:01 -08:00
fc4 [PATCH] drivers/fc4/fc.c: memset correct length 2006-02-20 20:00:11 -08:00
firmware [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
hwmon [PATCH] s/;;/;/g 2006-03-24 07:33:24 -08:00
i2c [PATCH] RTC subsystem: I2C cleanup 2006-03-27 08:44:51 -08:00
ide [PATCH] ide: fix section mismatch warning 2006-03-25 08:22:53 -08:00
ieee1394 [PATCH] bitops: hweight() related cleanup 2006-03-26 08:57:15 -08:00
infiniband IPoIB: P_Key change event handling 2006-03-24 15:47:30 -08:00
input Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2006-03-26 09:41:18 -08:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2006-03-26 09:41:18 -08:00
macintosh [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
mca
md [PATCH] drivers/md/dm-raid1.c: Fix inconsistent mirroring after interrupted recovery 2006-03-27 08:44:58 -08:00
media Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb 2006-03-25 08:37:36 -08:00
message [PATCH] mempool: use mempool_create_slab_pool() 2006-03-26 08:57:00 -08:00
mfd [PATCH] show MCP menu only on ARCH_SA1100 2006-03-24 07:33:28 -08:00
misc [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
mmc [PATCH] Remove MODULE_PARM 2006-03-25 08:22:52 -08:00
mtd Kconfig help: MTD_JEDECPROBE already supports Intel 2006-03-26 19:15:03 +02:00
net [PATCH] pnp: IRDA: adjust pnp_register_driver signature 2006-03-27 08:44:53 -08:00
nubus
oprofile [PATCH] more for_each_cpu() conversions 2006-03-23 07:38:17 -08:00
parisc [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
parport [PATCH] pnp: parport: adjust pnp_register_driver signature 2006-03-27 08:44:52 -08:00
pci [PATCH] sem2mutex: misc static one-file mutexes 2006-03-26 08:56:55 -08:00
pcmcia [PATCH] handle errors returned by platform_get_irq*() 2006-03-20 13:42:57 -08:00
pnp [PATCH] pnp: PNP: adjust pnp_register_driver signature 2006-03-27 08:44:53 -08:00
rapidio
rtc [PATCH] RTC subsystem: M48T86 driver 2006-03-27 08:44:52 -08:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial 2006-03-26 09:41:18 -08:00
sbus [SPARC]: Respect vm_page_prot in io_remap_page_range(). 2006-03-22 01:15:13 -08:00
scsi [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
serial Merge master.kernel.org:/home/rmk/linux-2.6-serial 2006-03-25 20:31:32 -08:00
sh
sn Pull sem2mutex-ioc4 into release branch 2006-03-21 08:17:15 -08:00
spi [PATCH] spi: Fix modular master driver remove and device suspend/remove 2006-02-20 20:00:09 -08:00
tc [PATCH] kill _INLINE_ 2006-03-23 07:38:16 -08:00
telephony [PATCH] sem2mutex: misc static one-file mutexes 2006-03-26 08:56:55 -08:00
usb [PATCH] Notifier chain update: API changes 2006-03-27 08:44:50 -08:00
video [PATCH] video/sis/init301.c:SiS_ChrontelDoSomething2(): remove dead code 2006-03-27 08:44:58 -08:00
w1 fix typos "wich" -> "which" 2006-03-24 18:23:14 +01:00
zorro [PATCH] amiga: fix driver_register() return handling, remove zorro_module_init() 2006-03-25 08:22:53 -08:00
Kconfig [PATCH] RTC Subsystem: library functions 2006-03-27 08:44:50 -08:00
Makefile [PATCH] RTC Subsystem: library functions 2006-03-27 08:44:50 -08:00