1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

snapshot: skip invalid snapshost

When scanning DM device, skip automatically invalid snapshot devices.
They behave just like 'error' device.
This commit is contained in:
Zdenek Kabelac 2018-03-08 10:32:15 +01:00
parent a6fdb9d9d7
commit 7421252edc
2 changed files with 25 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
Automatically avoid reading invalid snapshots during device scan.
Ensure COW device is writable even for read-only thick snapshots.
Support activation of component LVs in read-only mode.
Extend internal library to recognize and work with component LV.

View File

@ -518,6 +518,24 @@ out:
return r;
}
static int _ignore_invalid_snapshot(const char *params)
{
struct dm_status_snapshot *s;
struct dm_pool *mem;
int r;
if (!(mem = dm_pool_create("invalid snapshots", 128)))
return_0;
if (!dm_get_status_snapshot(mem, params, &s))
return_0;
r = s->invalid;
dm_pool_destroy(mem);
return r;
}
/*
* device_is_usable
* @dev
@ -633,6 +651,12 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
goto out;
}
if (target_type && !strcmp(target_type, TARGET_NAME_SNAPSHOT) &&
_ignore_invalid_snapshot(params)) {
log_debug_activation("%s: Invalid %s device %s not usable.", dev_name(dev), target_type, name);
goto out;
}
/* TODO: extend check struct ? */
if (target_type && !strcmp(target_type, TARGET_NAME_THIN) &&
!_ignore_unusable_thins(dev)) {