diff options
-rw-r--r-- | drivers/md/dm-exception-store.c | 11 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 5 |
2 files changed, 10 insertions, 6 deletions
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,11 +489,6 @@ static int persistent_read_metadata(struct exception_store *store) | |||
489 | /* | 489 | /* |
490 | * Sanity checks. | 490 | * Sanity checks. |
491 | */ | 491 | */ |
492 | if (!ps->valid) { | ||
493 | DMWARN("snapshot is marked invalid"); | ||
494 | return -EINVAL; | ||
495 | } | ||
496 | |||
497 | if (ps->version != SNAPSHOT_DISK_VERSION) { | 492 | if (ps->version != SNAPSHOT_DISK_VERSION) { |
498 | DMWARN("unable to handle snapshot disk version %d", | 493 | DMWARN("unable to handle snapshot disk version %d", |
499 | ps->version); | 494 | ps->version); |
@@ -501,6 +496,12 @@ static int persistent_read_metadata(struct exception_store *store) | |||
501 | } | 496 | } |
502 | 497 | ||
503 | /* | 498 | /* |
499 | * Metadata are valid, but snapshot is invalidated | ||
500 | */ | ||
501 | if (!ps->valid) | ||
502 | return 1; | ||
503 | |||
504 | /* | ||
504 | * Read the metadata. | 505 | * Read the metadata. |
505 | */ | 506 | */ |
506 | r = read_exceptions(ps); | 507 | r = read_exceptions(ps); |
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) | |||
523 | 523 | ||
524 | /* Metadata must only be loaded into one table at once */ | 524 | /* Metadata must only be loaded into one table at once */ |
525 | r = s->store.read_metadata(&s->store); | 525 | r = s->store.read_metadata(&s->store); |
526 | if (r) { | 526 | if (r < 0) { |
527 | ti->error = "Failed to read snapshot metadata"; | 527 | ti->error = "Failed to read snapshot metadata"; |
528 | goto bad6; | 528 | goto bad6; |
529 | } else if (r > 0) { | ||
530 | s->valid = 0; | ||
531 | DMWARN("Snapshot is marked invalid."); | ||
529 | } | 532 | } |
530 | 533 | ||
531 | bio_list_init(&s->queued_bios); | 534 | bio_list_init(&s->queued_bios); |