[PATCH] device-mapper snapshot: fix invalidation
authorAlasdair G Kergon <agk@redhat.com>
Mon, 27 Mar 2006 09:17:45 +0000 (01:17 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 27 Mar 2006 16:44:58 +0000 (08:44 -0800)
commit76df1c651b66bdf07d60b3d60789feb5f58d73e3
tree5458257a6a089396ac6ed5883a916af542ca8477
parentb4b610f684d13bf8691feeae5d4d7a8bd1f1033e
[PATCH] device-mapper snapshot: fix invalidation

When a snapshot becomes invalid, s->valid is set to 0.  In this state, a
snapshot can no longer be accessed.

When s->lock is acquired, before doing anything else, s->valid must be checked
to ensure the snapshot remains valid.

This patch eliminates some races (that may cause panics) by adding some
missing checks.  At the same time, some unnecessary levels of indentation are
removed and snapshot invalidation is moved into a single function that always
generates a device-mapper event.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/md/dm-snap.c