Sign In
Sign Up
Search is temporarily disabled. See
ticket
for more info.
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
List overview
Download
lvm2-commits
December 2016
----- 2024 -----
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
lvm2-commits@lists.fedorahosted.org
6 participants
129 discussions
Start a n
N
ew thread
master - cov: declaration matching
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4a33e4c509fb72bf…
Commit: 4a33e4c509fb72bf3540d20bd35e1f0944e1d37a Parent: b8c729efd094146437c3ed5b336b929608401535 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Fri Dec 9 23:10:00 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:24:19 2016 +0100 cov: declaration matching --- lib/format_text/format-text.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/format_text/format-text.h b/lib/format_text/format-text.h index bfabdfd..d6e6b03 100644 --- a/lib/format_text/format-text.h +++ b/lib/format_text/format-text.h @@ -59,7 +59,7 @@ int add_da(struct dm_pool *mem, struct dm_list *das, void del_das(struct dm_list *das); int add_ba(struct dm_pool *mem, struct dm_list *eas, uint64_t start, uint64_t size); -void del_bas(struct dm_list *eas); +void del_bas(struct dm_list *bas); int add_mda(const struct format_type *fmt, struct dm_pool *mem, struct dm_list *mdas, struct device *dev, uint64_t start, uint64_t size, unsigned ignored); void del_mdas(struct dm_list *mdas);
1
0
0
0
master - cov: add internal error for impossible code path
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b8c729efd0941464…
Commit: b8c729efd094146437c3ed5b336b929608401535 Parent: 794093722c657780171486dbfd8cd0ec392e4019 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Fri Dec 9 22:55:25 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:24:19 2016 +0100 cov: add internal error for impossible code path --- tools/vgchange.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/tools/vgchange.c b/tools/vgchange.c index 910f33a..455f688 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -533,6 +533,11 @@ static int _vgchange_locktype(struct cmd_context *cmd, struct logical_volume *lv; int lv_lock_count = 0; + if (!lock_type) { + log_error(INTERNAL_ERROR "No locktype_ARG."); + return 0; + } + /* * This is a special/forced exception to change the lock type to none. * It's needed for recovery cases and skips the normal steps of undoing
1
0
0
0
master - debug: missing stack traces
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=794093722c657780…
Commit: 794093722c657780171486dbfd8cd0ec392e4019 Parent: dc7d3dd5eda43186829ac4237ab049fe50cbc12a Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Dec 10 22:37:34 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:24:19 2016 +0100 debug: missing stack traces --- lib/metadata/raid_manip.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 58e3bcf..98f30e2 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -3248,24 +3248,24 @@ static int _striped_or_raid0_to_raid45610_wrapper(TAKEOVER_FN_ARGS) log_debug_metadata("Converting LV %s from %s to %s", display_lvname(lv), SEG_TYPE_NAME_STRIPED, SEG_TYPE_NAME_RAID0); if (!(seg = _convert_striped_to_raid0(lv, 1 /* alloc_metadata_devs */, 0 /* update_and_reload */, allocate_pvs))) - return 0; + return_0; } /* Add metadata LVs */ if (seg_is_raid0(seg)) { log_debug_metadata("Adding metadata LVs to %s", display_lvname(lv)); if (!_raid0_add_or_remove_metadata_lvs(lv, 1 /* update_and_reload */, allocate_pvs, NULL)) - return 0; + return_0; /* raid0_meta -> raid4 needs clearing of MetaLVs in order to avoid raid disk role cahnge issues in the kernel */ } else if (segtype_is_raid4(new_segtype) && !_clear_meta_lvs(lv)) - return 0; + return_0; /* Add the additional component LV pairs */ log_debug_metadata("Adding %" PRIu32 " component LV pair(s) to %s", new_image_count - lv_raid_image_count(lv), display_lvname(lv)); if (!_lv_raid_change_image_count(lv, new_image_count, allocate_pvs, NULL, 0, 1)) - return 0; + return_0; if (segtype_is_raid4(new_segtype) && (!_shift_parity_dev(seg) || @@ -3289,7 +3289,7 @@ static int _striped_or_raid0_to_raid45610_wrapper(TAKEOVER_FN_ARGS) if (segtype_is_raid4(new_segtype)) { /* We had to rename SubLVs because of collision free sgifting, rename back... */ if (!_rename_area_lvs(lv, NULL)) - return 0; + return_0; if (!lv_update_and_reload(lv)) return_0; }
1
0
0
0
master - cleanup: use NAME_LEN stack buffer
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dc7d3dd5eda43186…
Commit: dc7d3dd5eda43186829ac4237ab049fe50cbc12a Parent: 6cd68c55ddc280bcba72961944d24c6a66da1c18 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Dec 11 12:19:38 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:24:19 2016 +0100 cleanup: use NAME_LEN stack buffer Using NAME_LEN we get at least easy max LV name size validation. Also code gets more simple. --- lib/metadata/mirror.c | 42 +++++++++++++++--------------------------- 1 files changed, 15 insertions(+), 27 deletions(-) diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index 73b1110..c668ea0 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -661,6 +661,7 @@ static int _split_mirror_images(struct logical_volume *lv, struct dm_list split_images; struct lv_list *lvl; struct cmd_context *cmd = lv->vg->cmd; + char layer_name[NAME_LEN], format[NAME_LEN]; if (!lv_is_mirrored(lv)) { log_error("Unable to split non-mirrored LV %s.", @@ -728,9 +729,6 @@ static int _split_mirror_images(struct logical_volume *lv, } if (!dm_list_empty(&split_images)) { - size_t len = strlen(new_lv->name) + 32; - char *layer_name, format[len]; - /* * A number of images have been split and * a new mirror layer must be formed @@ -747,23 +745,21 @@ static int _split_mirror_images(struct logical_volume *lv, dm_list_iterate_items(lvl, &split_images) { sub_lv = lvl->lv; - if (dm_snprintf(format, len, "%s_mimage_%%d", + if (dm_snprintf(format, sizeof(format), "%s_mimage_%%d", new_lv->name) < 0) { log_error("Failed to build new image name for %s.", display_lvname(new_lv)); return 0; } - if (!(layer_name = dm_pool_alloc(lv->vg->vgmem, len))) { - log_error("Unable to allocate memory."); - return 0; - } - if (!generate_lv_name(lv->vg, format, layer_name, len)|| - sscanf(layer_name, format, &i) != 1) { + if (!generate_lv_name(lv->vg, format, layer_name, sizeof(layer_name))) { log_error("Failed to generate new image names for %s.", display_lvname(new_lv)); return 0; } - sub_lv->name = layer_name; + if (!(sub_lv->name = dm_pool_strdup(lv->vg->vgmem, layer_name))) { + log_error("Unable to allocate memory."); + return 0; + } } if (!_merge_mirror_images(new_lv, &split_images)) { @@ -1403,15 +1399,11 @@ static int _create_mimage_lvs(struct alloc_handle *ah, int log) { uint32_t m, first_area; - char *img_name; - size_t len; - - len = strlen(lv->name) + 32; - img_name = alloca(len); + char img_name[NAME_LEN]; - if (dm_snprintf(img_name, len, "%s_mimage_%%d", lv->name) < 0) { - log_error("img_name allocation failed. " - "Remove new LV and retry."); + if (dm_snprintf(img_name, sizeof(img_name), "%s_mimage_%%d", lv->name) < 0) { + log_error("Failed to build new mirror image name for %s.", + display_lvname(lv)); return 0; } @@ -1784,14 +1776,10 @@ static struct logical_volume *_create_mirror_log(struct logical_volume *lv, const char *suffix) { struct logical_volume *log_lv; - char *log_name; - size_t len; - - len = strlen(lv_name) + 32; - log_name = alloca(len); /* alloca never fails */ + char log_name[NAME_LEN]; - if (dm_snprintf(log_name, len, "%s%s", lv_name, suffix) < 0) { - log_error("log_name allocation failed."); + if (dm_snprintf(log_name, sizeof(log_name), "%s%s", lv_name, suffix) < 0) { + log_error("Failed to build new mirror log name for %s.", lv_name); return NULL; }
1
0
0
0
master - cleanup: reuse existing function
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6cd68c55ddc280bc…
Commit: 6cd68c55ddc280bcba72961944d24c6a66da1c18 Parent: 6f84d3c69cdc161508fcc29e82f1167334466084 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Dec 11 14:31:47 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:24:19 2016 +0100 cleanup: reuse existing function Call lv_update_and_reload implementation. --- tools/pvmove_poll.c | 34 ++-------------------------------- 1 files changed, 2 insertions(+), 32 deletions(-) diff --git a/tools/pvmove_poll.c b/tools/pvmove_poll.c index 2cd746b..438d458 100644 --- a/tools/pvmove_poll.c +++ b/tools/pvmove_poll.c @@ -83,38 +83,8 @@ int pvmove_update_metadata(struct cmd_context *cmd, struct volume_group *vg, struct dm_list *lvs_changed __attribute__((unused)), unsigned flags __attribute__((unused))) { - log_verbose("Updating volume group metadata."); - if (!vg_write(vg)) { - log_error("ABORTING: Volume group metadata update failed."); - return 0; - } - - if (!suspend_lv(cmd, lv_mirr)) { - vg_revert(vg); - log_error("ABORTING: Temporary pvmove mirror reload failed."); - if (!revert_lv(cmd, lv_mirr)) - stack; - return 0; - } - - /* Commit on-disk metadata */ - if (!vg_commit(vg)) { - log_error("ABORTING: Volume group metadata update failed."); - if (!resume_lv(cmd, lv_mirr)) - log_error("Unable to reactivate logical volume \"%s\".", - lv_mirr->name); - if (!revert_lv(cmd, lv_mirr)) - stack; - return 0; - } - - if (!resume_lv(cmd, lv_mirr)) { - log_error("Unable to reactivate logical volume \"%s\".", - lv_mirr->name); - return 0; - } - - backup(vg); + if (!lv_update_and_reload(lv_mirr)) + return_0; return 1; }
1
0
0
0
master - libdm: validate vsnprintf
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6f84d3c69cdc1615…
Commit: 6f84d3c69cdc161508fcc29e82f1167334466084 Parent: 3903f915f83634f91946550fda85d60b72ce3a88 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Fri Dec 9 22:54:08 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:24:17 2016 +0100 libdm: validate vsnprintf Avoid using buffer when no output has been generated. Missed in ee13f265f043b47a1b023321fb9e8470fb5703c1. --- WHATS_NEW_DM | 1 + libdm/libdm-common.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 73707b6..f402113 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.138 - ===================================== + Validation vsnprintf result in runtime translate of dm_log (1.02.136). Separate filemap extent allocation from region table. Fix segmentation fault when filemap region creation fails Fix performance of region cleanup for failed filemap creation. diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 476f018..d8cf946 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -173,14 +173,16 @@ static void _log_to_default_log(int level, const char *file, int line, int dm_errno_or_class, const char *f, ...) { + int n; va_list ap; char buf[2 * PATH_MAX + 256]; /* big enough for most messages */ va_start(ap, f); - vsnprintf(buf, sizeof(buf), f, ap); + n = vsnprintf(buf, sizeof(buf), f, ap); va_end(ap); - dm_log(level, file, line, "%s", buf); + if (n > 0) /* Could be truncated */ + dm_log(level, file, line, "%s", buf); } /* @@ -195,14 +197,16 @@ __attribute__((format(printf, 4, 5))) static void _log_to_default_log_with_errno(int level, const char *file, int line, const char *f, ...) { + int n; va_list ap; char buf[2 * PATH_MAX + 256]; /* big enough for most messages */ va_start(ap, f); - vsnprintf(buf, sizeof(buf), f, ap); + n = vsnprintf(buf, sizeof(buf), f, ap); va_end(ap); - dm_log_with_errno(level, file, line, 0, "%s", buf); + if (n > 0) /* Could be truncated */ + dm_log_with_errno(level, file, line, 0, "%s", buf); } void dm_log_init(dm_log_fn fn)
1
0
0
0
master - pvmove: fix activation order
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3903f915f83634f9…
Commit: 3903f915f83634f91946550fda85d60b72ce3a88 Parent: 67f9e6b175815d7a91a10ecc3d5098d30dbfed91 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Dec 11 14:26:17 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:22:36 2016 +0100 pvmove: fix activation order For proper locking we need to gain lock first for mirror which needs to be deactivated later to be working in cluster. --- WHATS_NEW | 1 + tools/pvmove_poll.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 63cdb89..ea15903 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Fix pvmove leaving -pvmove0 error device in clustered VG. Avoid adding extra '_' at end of raid extracted images or metadata. Optimize another _rmeta clearing code. Fix deactivation of raid orphan devices for clustered VG. diff --git a/tools/pvmove_poll.c b/tools/pvmove_poll.c index ea4be24..2cd746b 100644 --- a/tools/pvmove_poll.c +++ b/tools/pvmove_poll.c @@ -157,17 +157,17 @@ int pvmove_finish(struct cmd_context *cmd, struct volume_group *vg, return 0; } + /* Unsuspend LVs */ + if (!resume_lvs(cmd, lvs_changed)) + stack; + /* Release mirror LV. (No pending I/O because it's been suspended.) */ - if (!resume_lv(cmd, lv_mirr)) { + if (!activate_lv_excl_local(cmd, lv_mirr)) { log_error("Unable to reactivate logical volume \"%s\"", lv_mirr->name); r = 0; } - /* Unsuspend LVs */ - if (!resume_lvs(cmd, lvs_changed)) - stack; - /* Deactivate mirror LV */ if (!deactivate_lv(cmd, lv_mirr)) { log_error("ABORTING: Unable to deactivate temporary logical "
1
0
0
0
master - raid: avoid _ at end of name of extracted metadata LV
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=67f9e6b175815d7a…
Commit: 67f9e6b175815d7a91a10ecc3d5098d30dbfed91 Parent: 55ca8043d4bb0ef4435a24728cad34f8b0ff6c8c Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Dec 10 14:51:00 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:20:51 2016 +0100 raid: avoid _ at end of name of extracted metadata LV Do not generate @PREFIX@vg/LV1_rmeta_1_extracted_. --- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 9e95792..63cdb89 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Avoid adding extra '_' at end of raid extracted images or metadata. Optimize another _rmeta clearing code. Fix deactivation of raid orphan devices for clustered VG. Fix lvconvert raid1 to mirror table reload order. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 159bfa2..58e3bcf 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1785,7 +1785,7 @@ static int _extract_image_component_error_seg(struct lv_segment *seg, if (!remove_seg_from_segs_using_this_lv(lv, seg)) return_0; - if (!(lv->name = _generate_raid_name(lv, "extracted_", -1))) + if (!(lv->name = _generate_raid_name(lv, "extracted", -1))) return_0; if (set_error_seg && !replace_lv_with_error_segment(lv))
1
0
0
0
master - raid: optimize clearing of lvs
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55ca8043d4bb0ef4…
Commit: 55ca8043d4bb0ef4435a24728cad34f8b0ff6c8c Parent: 8831a541a831a2d25cb96ee09f6739526d29e5c1 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Dec 10 20:53:17 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:19:41 2016 +0100 raid: optimize clearing of lvs Activate whole list of metadata lvs first before clearing them. (Similar to commit ada5733c5652d456ffa138b0d07e6897824813b0) TODO: make this clearing in a single common function. --- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 92 ++++++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index b6f74ec..9e95792 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Optimize another _rmeta clearing code. Fix deactivation of raid orphan devices for clustered VG. Fix lvconvert raid1 to mirror table reload order. Add internal function for separate mirror log preparation. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 661c39b..159bfa2 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -379,10 +379,7 @@ static int _raid_remove_top_layer(struct logical_volume *lv, return 1; } -/* - * _clear_lv - * @lv - * +/* Makes on-disk metadata changes * If LV is active: * clear first block of device * otherwise: @@ -390,50 +387,15 @@ static int _raid_remove_top_layer(struct logical_volume *lv, * * Returns: 1 on success, 0 on failure */ -static int _clear_lv(struct logical_volume *lv) -{ - int was_active = lv_is_active_locally(lv); - - if (test_mode()) - return 1; - - lv->status |= LV_TEMPORARY; - if (!was_active && !activate_lv_local(lv->vg->cmd, lv)) { - log_error("Failed to activate localy %s for clearing.", - display_lvname(lv)); - return 0; - } - lv->status &= ~LV_TEMPORARY; - - log_verbose("Clearing metadata area of %s", - display_lvname(lv)); - /* - * Rather than wiping lv->size, we can simply - * wipe the first sector to remove the superblock of any previous - * RAID devices. It is much quicker. - */ - if (!wipe_lv(lv, (struct wipe_params) { .do_zero = 1, .zero_sectors = 1 })) { - log_error("Failed to zero %s.", - display_lvname(lv)); - return 0; - } - - if (!was_active && !deactivate_lv(lv->vg->cmd, lv)) { - log_error("Failed to deactivate %s.", - display_lvname(lv)); - return 0; - } - - return 1; -} - -/* Makes on-disk metadata changes */ static int _clear_lvs(struct dm_list *lv_list) { struct lv_list *lvl; struct volume_group *vg = NULL; + unsigned i = 0, sz = dm_list_size(lv_list); + char *was_active; + int r = 1; - if (dm_list_empty(lv_list)) { + if (!sz) { log_debug_metadata(INTERNAL_ERROR "Empty list of LVs given for clearing."); return 1; } @@ -447,6 +409,9 @@ static int _clear_lvs(struct dm_list *lv_list) vg = lvl->lv->vg; } + if (test_mode()) + return 1; + /* * FIXME: only vg_[write|commit] if LVs are not already written * as visible in the LVM metadata (which is never the case yet). @@ -454,11 +419,46 @@ static int _clear_lvs(struct dm_list *lv_list) if (!vg || !vg_write(vg) || !vg_commit(vg)) return_0; + was_active = alloca(sz); + dm_list_iterate_items(lvl, lv_list) - if (!_clear_lv(lvl->lv)) - return 0; + if (!(was_active[i++] = lv_is_active_locally(lvl->lv))) { + lvl->lv->status |= LV_TEMPORARY; + if (!activate_lv_excl_local(vg->cmd, lvl->lv)) { + log_error("Failed to activate localy %s for clearing.", + display_lvname(lvl->lv)); + r = 0; + goto out; + } + lvl->lv->status &= ~LV_TEMPORARY; + } - return 1; + dm_list_iterate_items(lvl, lv_list) { + log_verbose("Clearing metadata area %s.", display_lvname(lvl->lv)); + /* + * Rather than wiping lv->size, we can simply + * wipe the first sector to remove the superblock of any previous + * RAID devices. It is much quicker. + */ + if (!wipe_lv(lvl->lv, (struct wipe_params) { .do_zero = 1, .zero_sectors = 1 })) { + log_error("Failed to zero %s.", display_lvname(lvl->lv)); + r = 0; + goto out; + } + } +out: + /* TODO: deactivation is only needed with clustered locking + * in normal case we should keep device active + */ + sz = 0; + dm_list_iterate_items(lvl, lv_list) + if ((i > sz) && !was_active[sz++] && + !deactivate_lv(vg->cmd, lvl->lv)) { + log_error("Failed to deactivate %s.", display_lvname(lvl->lv)); + r = 0; /* continue deactivating */ + } + + return r; } /*
1
0
0
0
master - raid: fix delete on clustered vg
by Zdenek Kabelac
12 Dec '16
12 Dec '16
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8831a541a831a2d2…
Commit: 8831a541a831a2d25cb96ee09f6739526d29e5c1 Parent: 0c8369099bc6105f39982b3e36dd9a53c347b07a Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Dec 10 20:00:32 2016 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Sun Dec 11 23:18:22 2016 +0100 raid: fix delete on clustered vg For clustered VG ensure lock is grabbed first, so later deactivation works. TODO: fix tree to solve device removal automatically. --- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 74627ba..b6f74ec 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Fix deactivation of raid orphan devices for clustered VG. Fix lvconvert raid1 to mirror table reload order. Add internal function for separate mirror log preparation. Fix segfault in lvmetad from missing NULL in daemon_reply_simple. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 5cbd819..661c39b 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -248,6 +248,12 @@ static int _deactivate_and_remove_lvs(struct volume_group *vg, struct dm_list *r { struct lv_list *lvl; + if (vg_is_clustered(vg)) + /* Need to take lock for proper deactivation */ + dm_list_iterate_items(lvl, removal_lvs) + if (!activate_lv_excl_local(vg->cmd, lvl->lv)) + return_0; + dm_list_iterate_items(lvl, removal_lvs) { if (!deactivate_lv(vg->cmd, lvl->lv)) return_0; @@ -2968,6 +2974,12 @@ static int _clear_meta_lvs(struct logical_volume *lv) !lv_update_and_reload(lv)) return_0; + /* Note: detached rmeta are NOT renamed */ + /* Grab locks first in case of clustered VG */ + if (vg_is_clustered(lv->vg)) + dm_list_iterate_items(lvl, &meta_lvs) + if (!activate_lv_excl_local(lv->vg->cmd, lvl->lv)) + return_0; /* * Now deactivate the MetaLVs before clearing, so * that _clear_lvs() will activate them visible.
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
13
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
Results per page:
10
25
50
100
200