kernel-hacking-2024-linux-s.../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
.gitignore
bitmap.c
dm-bio-list.h
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-path-selector.c dm: remove dm header from targets 2008-10-21 17:44:59 +01:00
dm-path-selector.h
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-uevent.c
dm-uevent.h
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
Kconfig
linear.c
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
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
raid1.c
raid5.c
raid6.h
raid6algos.c
raid6altivec.uc
raid6int.uc
raid6mmx.c
raid6recov.c
raid6sse1.c
raid6sse2.c
raid6x86.h
raid10.c
unroll.pl