linux-stable/drivers/md
Mikulas Patocka 879129d208 dm snapshot: wait for chunks in destructor
If there are several snapshots sharing an origin and one is removed
while the origin is being written to, the snapshot's mempool may get
deleted while elements are still referenced.

Prior to dm-snapshot-use-per-device-mempools.patch the pending
exceptions may still have been referenced after the snapshot was
destroyed, but this was not a problem because the shared mempool
was still there.

This patch fixes the problem by tracking the number of mempool elements
in use.

The scenario:
- You have an origin and two snapshots 1 and 2.
- Someone writes to the origin.
- It creates two exceptions in the snapshots, snapshot 1 will be primary
exception, snapshot 2's pending_exception->primary_pe will point to the
exception in snapshot 1.
- The exceptions are being relocated, relocation of exception 1 finishes
(but it's pending_exception is still allocated, because it is referenced
by an exception from snapshot 2)
- The user lvremoves snapshot 1 --- it calls just suspend (does nothing)
and destructor. md->pending is zero (there is no I/O submitted to the
snapshot by md layer), so it won't help us.
- The destructor waits for kcopyd jobs to finish on snapshot 1 --- but
there are none.
- The destructor on snapshot 1 cleans up everything.
- The relocation of exception on snapshot 2 finishes, it drops reference
on primary_pe. This frees its primary_pe pointer. Primary_pe points to
pending exception created for snapshot 1. So it frees memory into
non-existing mempool.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2008-10-30 13:33:16 +00:00
..
raid6test md: raid6: clean up the style of raid6test/test.c 2008-02-06 10:41:18 -08:00
.gitignore
bitmap.c Fix problem with waiting while holding rcu read lock in md/bitmap.c 2008-09-01 12:48:13 +10:00
dm-bio-list.h dm: bio_list macro renaming 2007-10-20 02:01:11 +01:00
dm-bio-record.h
dm-crypt.c dm crypt: remove waitqueue 2008-10-21 17:45:03 +01:00
dm-delay.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-exception-store.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-io.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-ioctl.c [PATCH] introduce fmode_t, do annotations 2008-10-21 07:47:06 -04:00
dm-kcopyd.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-linear.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev 2008-10-23 10:23:07 -07:00
dm-log.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-mpath.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev 2008-10-23 10:23:07 -07:00
dm-mpath.h dm mpath: remove is_active from struct dm_path 2008-10-10 13:36:58 +01:00
dm-path-selector.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-path-selector.h [PATCH] struct path: rename DM's struct path 2006-12-08 08:28:40 -08:00
dm-raid1.c dm raid1: fix do_failures 2008-10-30 13:33:07 +00:00
dm-region-hash.c dm raid1: separate region_hash interface part1 2008-10-21 17:45:06 +01:00
dm-round-robin.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-snap.c dm snapshot: wait for chunks in destructor 2008-10-30 13:33:16 +00:00
dm-snap.h dm snapshot: wait for chunks in destructor 2008-10-30 13:33:16 +00:00
dm-stripe.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-table.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev 2008-10-23 10:23:07 -07:00
dm-target.c dm: use kzalloc 2007-10-20 02:01:07 +01:00
dm-uevent.c md: replace remaining __FUNCTION__ occurrences 2008-04-28 08:58:42 -07:00
dm-uevent.h dm: uevent generate events 2007-10-20 02:01:26 +01:00
dm-zero.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev 2008-10-23 10:23:07 -07:00
dm.h dm: publish array_too_big 2008-10-21 17:44:57 +01:00
faulty.c md: check for memory allocation failure in faulty personality 2008-10-16 14:16:53 +11:00
Kconfig raid, fastboot: hide RAID autodetect option if MD is compiled as a module 2008-10-12 08:25:14 -07:00
linear.c md: Remove unnecessary #includes, #defines, and function declarations. 2008-10-13 11:55:12 +11:00
Makefile dm raid1: separate region_hash interface part1 2008-10-21 17:45:06 +01:00
md.c Merge branch 'for-linus' of git://neil.brown.name/md 2008-10-26 16:42:18 -07:00
mktables.c md: raid6: Fix mktable.c 2008-02-06 10:41:18 -08:00
multipath.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2008-10-17 09:00:23 -07:00
raid0.c md: Remove unnecessary #includes, #defines, and function declarations. 2008-10-13 11:55:12 +11:00
raid1.c md: build failure due to missing delay.h 2008-10-15 21:57:05 +11:00
raid5.c md: Relax minimum size restrictions on chunk_size. 2008-10-13 11:55:12 +11:00
raid6.h md: Remove unnecessary #includes, #defines, and function declarations. 2008-10-13 11:55:12 +11:00
raid6algos.c drivers/md: use time_before, time_before_eq, etc 2008-04-28 08:58:42 -07:00
raid6altivec.uc
raid6int.uc
raid6mmx.c x86 merge fallout: uml 2007-10-29 07:41:32 -07:00
raid6recov.c
raid6sse1.c x86 merge fallout: uml 2007-10-29 07:41:32 -07:00
raid6sse2.c x86 merge fallout: uml 2007-10-29 07:41:32 -07:00
raid6x86.h x86 merge fallout: uml 2007-10-29 07:41:32 -07:00
raid10.c md: build failure due to missing delay.h 2008-10-15 21:57:05 +11:00
unroll.pl