Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
lvm2.5953
bug-999878_metadata-check-PV-dev-size-is-not-le...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bug-999878_metadata-check-PV-dev-size-is-not-less-than-PV-size.patch of Package lvm2.5953
From 511fdb2569aec988a7013e0b25f05f05617aa781 Mon Sep 17 00:00:00 2001 From: Eric Ren <zren@suse.com> Date: Tue, 25 Apr 2017 19:28:58 +0800 Subject: [PATCH 1/2] [PATCH 1/2] metadata: check PV dev size is not less than PV size Upstream commit: c0912af3104cb72ea275d90b8b1d68a25a9ca48a Backport-by: Eric Ren <zren@suse.com> --- WHATS_NEW | 3 ++- lib/metadata/metadata.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 9218794..eb0eabe 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,6 +1,7 @@ -News within backported patches +News for backported patches ============================== Fix lvm2-{activation,clvmd,cmirrord,monitor} service to exec before mounting. + Warn if device size is less than corresponding PV size in metadata. Version 2.02.120 - 15th May 2015 ================================ diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 9f098ca..c4e4491 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -650,6 +650,34 @@ int vg_check_pv_dev_block_sizes(const struct volume_group *vg) return 1; } +static int _check_pv_dev_sizes(struct volume_group *vg) +{ + struct pv_list *pvl; + uint64_t dev_size, size; + int r = 1; + + if (is_orphan_vg(vg->name)) + return 1; + + dm_list_iterate_items(pvl, &vg->pvs) { + if (is_missing_pv(pvl->pv)) + continue; + + dev_size = pv_dev_size(pvl->pv); + size = pv_size(pvl->pv); + + if (dev_size < size) { + log_warn("Device %s has size of %" PRIu64 " sectors which " + "is smaller than corresponding PV size of %" PRIu64 + " sectors. Was device resized?", + pv_dev_name(pvl->pv), dev_size, size); + r = 0; + } + } + + return r; +} + /* * Extend a VG by a single PV / device path * @@ -726,6 +754,8 @@ int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names dm_free(pv_name); } + (void) _check_pv_dev_sizes(vg); + /* FIXME Decide whether to initialise and add new mdahs to format instance */ return 1; @@ -3739,6 +3769,10 @@ struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgnam if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, consistent, 0))) goto_out; + if (!_check_pv_dev_sizes(vg)) + log_warn("One or more devices used as PVs in VG %s " + "have changed sizes.", vg->name); + if (!check_pv_segments(vg)) { log_error(INTERNAL_ERROR "PV segments corrupted in %s.", vg->name); -- 2.10.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor