summary refs log tree commit diff
path: root/drivers/md/dm-snap.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2007-07-12 17:28:13 +0100
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 15:01:08 -0700
commit0764147b111b8ca886e4f2e9c9e019106b09b657 (patch)
tree815c9d80c961d54c79692ebe4751318c9052ad45 /drivers/md/dm-snap.c
parentfcac03abd325e4f7a4cc8fe05fea2793b1c8eb75 (diff)
downloadlinux-0764147b111b8ca886e4f2e9c9e019106b09b657.tar.gz
dm snapshot: permit invalid activation
Allow invalid snapshots to be activated instead of failing.

This allows userspace to reinstate any given snapshot state - for
example after an unscheduled reboot - and clean up the invalid snapshot
at its leisure.

Cc: stable@kernel.org
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/dm-snap.c')
-rw-r--r--drivers/md/dm-snap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 1da41229fbf2..854891d07b59 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -523,9 +523,12 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 
 	/* Metadata must only be loaded into one table at once */
 	r = s->store.read_metadata(&s->store);
-	if (r) {
+	if (r < 0) {
 		ti->error = "Failed to read snapshot metadata";
 		goto bad6;
+	} else if (r > 0) {
+		s->valid = 0;
+		DMWARN("Snapshot is marked invalid.");
 	}
 
 	bio_list_init(&s->queued_bios);