From 0764147b111b8ca886e4f2e9c9e019106b09b657 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Thu, 12 Jul 2007 17:28:13 +0100 Subject: 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 Signed-off-by: Alasdair G Kergon Signed-off-by: Linus Torvalds --- drivers/md/dm-exception-store.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers/md/dm-exception-store.c') diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c index 8c25c2ff724a..3d65917a1bbb 100644 --- a/drivers/md/dm-exception-store.c +++ b/drivers/md/dm-exception-store.c @@ -489,17 +489,18 @@ static int persistent_read_metadata(struct exception_store *store) /* * Sanity checks. */ - if (!ps->valid) { - DMWARN("snapshot is marked invalid"); - return -EINVAL; - } - if (ps->version != SNAPSHOT_DISK_VERSION) { DMWARN("unable to handle snapshot disk version %d", ps->version); return -EINVAL; } + /* + * Metadata are valid, but snapshot is invalidated + */ + if (!ps->valid) + return 1; + /* * Read the metadata. */ -- cgit v1.2.3