Sign In
Sign Up
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
November
October
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 2017
----- 2024 -----
November 2024
October 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
5 participants
97 discussions
Start a n
N
ew thread
master - clenaup: use log_warn
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=76322d3b3e1cf7e118a82…
Commit: 76322d3b3e1cf7e118a8207975ae8342de454fa3 Parent: 2a01e3d4ca56b13c266629ebb343d1dfb5e9b583 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 13:34:10 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 clenaup: use log_warn Avoid logging error when function is not failing. Technically can't really happen ATM anyway. --- libdm/libdm-deptree.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 6370e88..c976cce 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -2705,7 +2705,7 @@ static int _load_node(struct dm_tree_node *dnode) } if (!dm_task_no_open_count(dmt)) - log_error("Failed to disable open_count"); + log_warn("WARNING: Failed to disable open_count."); dm_list_iterate_items(seg, &dnode->props.segs) if (!_emit_segment(dmt, dnode->info.major, dnode->info.minor, @@ -2713,7 +2713,7 @@ static int _load_node(struct dm_tree_node *dnode) goto_out; if (!dm_task_suppress_identical_reload(dmt)) - log_error("Failed to suppress reload of identical tables."); + log_warn("WARNING: Failed to suppress reload of identical tables."); if ((r = dm_task_run(dmt))) { r = dm_task_get_info(dmt, &dnode->info);
1
0
0
0
master - cleanup: use _node_name
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2a01e3d4ca56b13c26662…
Commit: 2a01e3d4ca56b13c266629ebb343d1dfb5e9b583 Parent: 925fec6ecb8f1915aee20e09a9703e1cb70cd0b1 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 13:33:05 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: use _node_name Use existing internal method for create 'name (major:minor)' string for debug messages and reduce some messages. --- libdm/libdm-deptree.c | 57 ++++++++++++++++++------------------------------- 1 files changed, 21 insertions(+), 36 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index f662d26..6370e88 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -597,8 +597,9 @@ static struct dm_tree_node *_find_dm_tree_node_by_uuid(struct dm_tree *dtree, static const char *_node_name(struct dm_tree_node *dnode) { if (dm_snprintf(dnode->dtree->buf, sizeof(dnode->dtree->buf), - "%s (%" PRIu32 ":%" PRIu32 ")", - dnode->name, dnode->info.major, dnode->info.minor) < 0) { + "%s (" FMTu32 ":" FMTu32 ")", + dnode->name ? dnode->name : "", + dnode->info.major, dnode->info.minor) < 0) { stack; return dnode->name; } @@ -609,12 +610,9 @@ static const char *_node_name(struct dm_tree_node *dnode) void dm_tree_node_set_udev_flags(struct dm_tree_node *dnode, uint16_t udev_flags) { - struct dm_info *dinfo = &dnode->info; - if (udev_flags != dnode->udev_flags) - log_debug_activation("Resetting %s (%" PRIu32 ":%" PRIu32 - ") udev_flags from 0x%x to 0x%x", - dnode->name, dinfo->major, dinfo->minor, + log_debug_activation("Resetting %s udev_flags from 0x%x to 0x%x.", + _node_name(dnode), dnode->udev_flags, udev_flags); dnode->udev_flags = udev_flags; } @@ -1398,8 +1396,8 @@ static int _thin_pool_get_status(struct dm_tree_node *dnode, dm_get_next_target(dmt, NULL, &start, &length, &type, ¶ms); if (type && (strcmp(type, "thin-pool") != 0)) { - log_error("Expected thin-pool target for %d:%d and got %s.", - dnode->info.major, dnode->info.minor, type); + log_error("Expected thin-pool target for %s and got %s.", + _node_name(dnode), type); goto out; } @@ -1895,9 +1893,7 @@ int dm_tree_activate_children(struct dm_tree_node *dnode, if (!_resume_node(child->name, child->info.major, child->info.minor, child->props.read_ahead, child->props.read_ahead_flags, &newinfo, &child->dtree->cookie, child->udev_flags, child->info.suspended)) { - log_error("Unable to resume %s (%" PRIu32 - ":%" PRIu32 ")", child->name, child->info.major, - child->info.minor); + log_error("Unable to resume %s.", _node_name(child)); r = 0; continue; } @@ -1997,9 +1993,8 @@ static int _remove_node(struct dm_tree_node *dnode) if (!_deactivate_node(dnode->name, dnode->info.major, dnode->info.minor, &dnode->dtree->cookie, dnode->udev_flags, 0)) { - log_error("Failed to clean-up device with no table: %s %u:%u", - dnode->name ? dnode->name : "", - dnode->info.major, dnode->info.minor); + log_error("Failed to clean-up device with no table: %s.", + _node_name(dnode)); return 0; } return 1; @@ -2691,22 +2686,21 @@ static int _load_node(struct dm_tree_node *dnode) struct load_segment *seg; uint64_t seg_start = 0, existing_table_size; - log_verbose("Loading %s table (%" PRIu32 ":%" PRIu32 ")", dnode->name, - dnode->info.major, dnode->info.minor); + log_verbose("Loading table for %s.", _node_name(dnode)); if (!(dmt = dm_task_create(DM_DEVICE_RELOAD))) { - log_error("Reload dm_task creation failed for %s", dnode->name); + log_error("Reload dm_task creation failed for %s.", _node_name(dnode)); return 0; } if (!dm_task_set_major(dmt, dnode->info.major) || !dm_task_set_minor(dmt, dnode->info.minor)) { - log_error("Failed to set device number for %s reload.", dnode->name); + log_error("Failed to set device number for %s reload.", _node_name(dnode)); goto out; } if (dnode->props.read_only && !dm_task_set_ro(dmt)) { - log_error("Failed to set read only flag for %s", dnode->name); + log_error("Failed to set read only flag for %s.", _node_name(dnode)); goto out; } @@ -2724,10 +2718,8 @@ static int _load_node(struct dm_tree_node *dnode) if ((r = dm_task_run(dmt))) { r = dm_task_get_info(dmt, &dnode->info); if (r && !dnode->info.inactive_table) - log_verbose("Suppressed %s (%" PRIu32 ":%" PRIu32 - ") identical table reload.", - dnode->name, - dnode->info.major, dnode->info.minor); + log_verbose("Suppressed %s identical table reload.", + _node_name(dnode)); existing_table_size = dm_task_get_existing_table_size(dmt); if ((dnode->props.size_changed = @@ -2742,9 +2734,8 @@ static int _load_node(struct dm_tree_node *dnode) dnode->props.size_changed = 0; log_debug_activation("Table size changed from %" PRIu64 " to %" - PRIu64 " for %s (%" PRIu32 ":%" PRIu32 ").%s", - existing_table_size, seg_start, dnode->name, - dnode->info.major, dnode->info.minor, + PRIu64 " for %s.%s", existing_table_size, + seg_start, _node_name(dnode), dnode->props.size_changed ? "" : " (Ignoring.)"); } } @@ -2773,9 +2764,7 @@ static int _dm_tree_revert_activated(struct dm_tree_node *parent) } if (!_deactivate_node(child->name, child->info.major, child->info.minor, &child->dtree->cookie, child->udev_flags, 0)) { - log_error("Unable to deactivate %s (%" PRIu32 - ":%" PRIu32 ")", child->name, child->info.major, - child->info.minor); + log_error("Unable to deactivate %s.", _node_name(child)); return 0; } if (!_dm_tree_revert_activated(child)) @@ -2869,16 +2858,12 @@ int dm_tree_preload_children(struct dm_tree_node *dnode, child->props.read_ahead, child->props.read_ahead_flags, &newinfo, &child->dtree->cookie, child->udev_flags, child->info.suspended)) { - log_error("Unable to resume %s (%" PRIu32 - ":%" PRIu32 ")", child->name, child->info.major, - child->info.minor); + log_error("Unable to resume %s.", _node_name(child)); /* If the device was not previously active, we might as well remove this node. */ if (!child->info.live_table && !_deactivate_node(child->name, child->info.major, child->info.minor, &child->dtree->cookie, child->udev_flags, 0)) - log_error("Unable to deactivate %s (%" PRIu32 - ":%" PRIu32 ")", child->name, child->info.major, - child->info.minor); + log_error("Unable to deactivate %s.", _node_name(child)); r = 0; /* Each child is handled independently */ continue;
1
0
0
0
master - cleanup: stack tracing
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=925fec6ecb8f1915aee20…
Commit: 925fec6ecb8f1915aee20e09a9703e1cb70cd0b1 Parent: e3366787b6349a190063a09b0c37ad5a641fcccf Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 13:31:40 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: stack tracing --- libdm/libdm-common.c | 4 ++-- libdm/libdm-deptree.c | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index e983b03..f5c6062 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -2033,7 +2033,7 @@ int dm_mknodes(const char *name) int r = 0; if (!(dmt = dm_task_create(DM_DEVICE_MKNODES))) - return 0; + return_0; if (name && !dm_task_set_name(dmt, name)) goto out; @@ -2054,7 +2054,7 @@ int dm_driver_version(char *version, size_t size) int r = 0; if (!(dmt = dm_task_create(DM_DEVICE_VERSION))) - return 0; + return_0; if (!dm_task_run(dmt)) log_error("Failed to get driver version"); diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index ba11388..f662d26 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -813,10 +813,8 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint return 1; } - if (!(*dmt = dm_task_create(DM_DEVICE_DEPS))) { - log_error("deps dm_task creation failed"); - return 0; - } + if (!(*dmt = dm_task_create(DM_DEVICE_DEPS))) + return_0; if (!dm_task_set_major(*dmt, major) || !dm_task_set_minor(*dmt, minor)) { log_error("_deps: failed to set major:minor for (" FMTu32 ":" FMTu32 ").", @@ -877,10 +875,8 @@ static int _info_by_dev(uint32_t major, uint32_t minor, int with_open_count, struct dm_task *dmt; int r = 0; - if (!(dmt = dm_task_create(DM_DEVICE_INFO))) { - log_error("_info_by_dev: dm_task creation failed"); - return 0; - } + if (!(dmt = dm_task_create(DM_DEVICE_INFO))) + return_0; if (!dm_task_set_major(dmt, major) || !dm_task_set_minor(dmt, minor)) { log_error("_info_by_dev: Failed to set device number.");
1
0
0
0
master - cleanup: mark success at the end
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e3366787b6349a190063a…
Commit: e3366787b6349a190063a09b0c37ad5a641fcccf Parent: 10f37345ebbd4822083bd9451f59df6074995bb8 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 12:49:57 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: mark success at the end Simplify setting 'success' return value and use common use-pattern for handling return code. --- libdm/libdm-deptree.c | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index d0b4658..ba11388 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -875,7 +875,7 @@ static int _info_by_dev(uint32_t major, uint32_t minor, int with_open_count, const char **name, const char **uuid) { struct dm_task *dmt; - int r; + int r = 0; if (!(dmt = dm_task_create(DM_DEVICE_INFO))) { log_error("_info_by_dev: dm_task creation failed"); @@ -883,32 +883,30 @@ static int _info_by_dev(uint32_t major, uint32_t minor, int with_open_count, } if (!dm_task_set_major(dmt, major) || !dm_task_set_minor(dmt, minor)) { - log_error("_info_by_dev: Failed to set device number"); - dm_task_destroy(dmt); - return 0; + log_error("_info_by_dev: Failed to set device number."); + goto out; } if (!with_open_count && !dm_task_no_open_count(dmt)) log_warn("WARNING: Failed to disable open_count."); - if (!(r = dm_task_run(dmt))) + if (!dm_task_run(dmt)) goto_out; - if (!(r = dm_task_get_info(dmt, info))) + if (!dm_task_get_info(dmt, info)) goto_out; if (name && !(*name = dm_pool_strdup(mem, dm_task_get_name(dmt)))) { log_error("name pool_strdup failed"); - r = 0; goto out; } if (uuid && !(*uuid = dm_pool_strdup(mem, dm_task_get_uuid(dmt)))) { log_error("uuid pool_strdup failed"); - r = 0; goto out; } + r = 1; out: dm_task_destroy(dmt); @@ -1341,7 +1339,7 @@ static int _suspend_node(const char *name, uint32_t major, uint32_t minor, int skip_lockfs, int no_flush, struct dm_info *newinfo) { struct dm_task *dmt; - int r; + int r = 0; log_verbose("Suspending %s (%" PRIu32 ":%" PRIu32 ")%s%s", name, major, minor, @@ -1355,8 +1353,7 @@ static int _suspend_node(const char *name, uint32_t major, uint32_t minor, if (!dm_task_set_major(dmt, major) || !dm_task_set_minor(dmt, minor)) { log_error("Failed to set device number for %s suspension.", name); - dm_task_destroy(dmt); - return 0; + goto out; } if (!dm_task_no_open_count(dmt)) @@ -1372,7 +1369,7 @@ static int _suspend_node(const char *name, uint32_t major, uint32_t minor, inc_suspended(); r = dm_task_get_info(dmt, newinfo); } - +out: dm_task_destroy(dmt); return r;
1
0
0
0
master - cleanup: drop impossible test case
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=10f37345ebbd4822083bd…
Commit: 10f37345ebbd4822083bd9451f59df6074995bb8 Parent: 1f6d79ab4827929420e032f4fb77e03393f336a8 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 11:28:31 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: drop impossible test case This test can never be true since info is embeded struct. --- libdm/libdm-deptree.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 9bc16c9..d0b4658 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1025,7 +1025,7 @@ out: static int _node_clear_table(struct dm_tree_node *dnode, uint16_t udev_flags) { struct dm_task *dmt = NULL, *deps_dmt = NULL; - struct dm_info *info, deps_info; + struct dm_info *info = &dnode->info, deps_info; struct dm_deps *deps = NULL; const char *name, *uuid, *depname, *depuuid; const char *default_uuid_prefix; @@ -1033,11 +1033,6 @@ static int _node_clear_table(struct dm_tree_node *dnode, uint16_t udev_flags) uint32_t i; int r = 0; - if (!(info = &dnode->info)) { - log_error("_node_clear_table failed: missing info"); - return 0; - } - if (!(name = dm_tree_node_get_name(dnode))) { log_error("_node_clear_table failed: missing name"); return 0;
1
0
0
0
master - cleanup: simplier error message
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1f6d79ab4827929420e03…
Commit: 1f6d79ab4827929420e032f4fb77e03393f336a8 Parent: 7379a2624beb6bbefff6f6d6222b1eac9f5980e6 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 11:25:01 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: simplier error message Use single 'error' message just with different reason. --- libdm/libdm-deptree.c | 33 +++++++++++++-------------------- 1 files changed, 13 insertions(+), 20 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 8fac4a1..9bc16c9 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -917,33 +917,26 @@ out: static int _check_device_not_in_use(const char *name, struct dm_info *info) { + const char *reason; + if (!info->exists) return 1; /* If sysfs is not used, use open_count information only. */ if (!*dm_sysfs_dir()) { - if (info->open_count) { - log_error("Device %s (%" PRIu32 ":%" PRIu32 ") in use", - name, info->major, info->minor); - return 0; - } - + if (!info->open_count) + return 1; + reason = "in use"; + } else if (dm_device_has_holders(info->major, info->minor)) + reason = "is used by another device"; + else if (dm_device_has_mounted_fs(info->major, info->minor)) + reason = "constains a filesystem in use"; + else return 1; - } - if (dm_device_has_holders(info->major, info->minor)) { - log_error("Device %s (%" PRIu32 ":%" PRIu32 ") is used " - "by another device.", name, info->major, info->minor); - return 0; - } - - if (dm_device_has_mounted_fs(info->major, info->minor)) { - log_error("Device %s (%" PRIu32 ":%" PRIu32 ") contains " - "a filesystem in use.", name, info->major, info->minor); - return 0; - } - - return 1; + log_error("Device %s (" FMTu32 ":" FMTu32 ") %s.", + name, info->major, info->minor, reason); + return 0; } /* Check if all parent nodes of given node have open_count == 0 */
1
0
0
0
master - cleanup: futher code reduction
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7379a2624beb6bbefff6f…
Commit: 7379a2624beb6bbefff6f6d6222b1eac9f5980e6 Parent: 2a22576b2d5b839f30d0dd7fb652920b303366f3 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 10:38:39 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: futher code reduction Just like everywhere else - use single if() for major:minor setup (it basically can't fail as of today anyway) Always leave funtion with correctly set pointers even on error path. --- libdm/libdm-deptree.c | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-) diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index d6c2693..8fac4a1 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -803,13 +803,11 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint struct dm_info *info, struct dm_deps **deps) { memset(info, 0, sizeof(*info)); + *name = ""; + *uuid = ""; + *deps = NULL; if (!dm_is_dm_major(major)) { - if (name) - *name = ""; - if (uuid) - *uuid = ""; - *deps = NULL; info->major = major; info->minor = minor; return 1; @@ -820,14 +818,8 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint return 0; } - if (!dm_task_set_major(*dmt, major)) { - log_error("_deps: failed to set major for (%" PRIu32 ":%" PRIu32 ")", - major, minor); - goto failed; - } - - if (!dm_task_set_minor(*dmt, minor)) { - log_error("_deps: failed to set minor for (%" PRIu32 ":%" PRIu32 ")", + if (!dm_task_set_major(*dmt, major) || !dm_task_set_minor(*dmt, minor)) { + log_error("_deps: failed to set major:minor for (" FMTu32 ":" FMTu32 ").", major, minor); goto failed; } @@ -850,11 +842,7 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint goto failed; } - if (!info->exists) { - *name = ""; - *uuid = ""; - *deps = NULL; - } else { + if (info->exists) { if (info->major != major) { log_error("Inconsistent dtree major number: %u != %u", major, info->major); @@ -874,6 +862,8 @@ static int _deps(struct dm_task **dmt, struct dm_pool *mem, uint32_t major, uint failed: dm_task_destroy(*dmt); + *dmt = NULL; + return 0; }
1
0
0
0
master - cleanup: drop unused header
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2a22576b2d5b839f30d0d…
Commit: 2a22576b2d5b839f30d0dd7fb652920b303366f3 Parent: e447d7ca5e178bc7b13d5aabaef3d160b4655f07 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Fri Dec 1 22:58:47 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 cleanup: drop unused header DM_UUID_LEN is no longer needed. --- lib/activate/dev_manager.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 5662090..c050f34 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -26,7 +26,6 @@ #include "activate.h" #include "lvm-exec.h" #include "str_list.h" -#include "dm-ioctl.h" /* for DM_UUID_LEN */ #include <limits.h> #include <dirent.h>
1
0
0
0
master - libdm: support for replicator target is dropped
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e447d7ca5e178bc7b13d5…
Commit: e447d7ca5e178bc7b13d5aabaef3d160b4655f07 Parent: 63368a5064dd20a1fb5a2f4110704059c79b3ced Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 15:27:05 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 libdm: support for replicator target is dropped Replicator never really existed in upstream kernel and its support got deprecated. Also its support never got finished so no code is supposed to be using it anyway. Libdm symbols are remaining, just the implementation will always return failure - so any user of: dm_tree_node_add_replicator_dev_target() dm_tree_node_add_replicator_target(). will now always recieve error message. --- WHATS_NEW_DM | 1 + libdm/libdm-deptree.c | 271 ++----------------------------------------------- 2 files changed, 8 insertions(+), 264 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 56b8153..dfa5a97 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.146 - ==================================== + Remove code supporting replicator target. Do not ignore failure of _info_by_dev(). Propagate delayed resume for pvmove subvolumes. Suppress integrity encryption keys in 'table' output unless --showkeys supplied. diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index ff7e9b4..d6c2693 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -24,8 +24,6 @@ #define MAX_TARGET_PARAMSIZE 500000 -#define REPLICATOR_LOCAL_SITE 0 - /* Supported segment types */ enum { SEG_CACHE, @@ -33,8 +31,6 @@ enum { SEG_ERROR, SEG_LINEAR, SEG_MIRRORED, - SEG_REPLICATOR, - SEG_REPLICATOR_DEV, SEG_SNAPSHOT, SEG_SNAPSHOT_ORIGIN, SEG_SNAPSHOT_MERGE, @@ -73,8 +69,6 @@ static const struct { { SEG_ERROR, "error" }, { SEG_LINEAR, "linear" }, { SEG_MIRRORED, "mirror" }, - { SEG_REPLICATOR, "replicator" }, - { SEG_REPLICATOR_DEV, "replicator-dev" }, { SEG_SNAPSHOT, "snapshot" }, { SEG_SNAPSHOT_ORIGIN, "snapshot-origin" }, { SEG_SNAPSHOT_MERGE, "snapshot-merge" }, @@ -118,11 +112,6 @@ struct seg_area { struct dm_tree_node *dev_node; uint64_t offset; - - unsigned rsite_index; /* Replicator site index */ - struct dm_tree_node *slog; /* Replicator sync log node */ - uint64_t region_size; /* Replicator sync log size */ - uint32_t flags; /* Replicator sync log flags */ }; struct dm_thin_message { @@ -151,18 +140,6 @@ struct thin_message { int expected_errno; }; -/* Replicator-log has a list of sites */ -/* FIXME: maybe move to seg_area too? */ -struct replicator_site { - struct dm_list list; - - unsigned rsite_index; - dm_replicator_mode_t mode; - uint32_t async_timeout; - uint32_t fall_behind_ios; - uint64_t fall_behind_data; -}; - /* Per-segment properties */ struct load_segment { struct dm_list list; @@ -171,8 +148,8 @@ struct load_segment { uint64_t size; - unsigned area_count; /* Linear + Striped + Mirrored + Crypt + Replicator */ - struct dm_list areas; /* Linear + Striped + Mirrored + Crypt + Replicator */ + unsigned area_count; /* Linear + Striped + Mirrored + Crypt */ + struct dm_list areas; /* Linear + Striped + Mirrored + Crypt */ uint32_t stripe_size; /* Striped + raid */ @@ -182,7 +159,7 @@ struct load_segment { struct dm_tree_node *origin; /* Snapshot + Snapshot origin + Cache */ struct dm_tree_node *merge; /* Snapshot */ - struct dm_tree_node *log; /* Mirror + Replicator */ + struct dm_tree_node *log; /* Mirror */ uint32_t region_size; /* Mirror + raid */ unsigned clustered; /* Mirror */ unsigned mirror_area_count; /* Mirror */ @@ -199,13 +176,6 @@ struct load_segment { uint64_t iv_offset; /* Crypt */ const char *key; /* Crypt */ - const char *rlog_type; /* Replicator */ - struct dm_list rsites; /* Replicator */ - unsigned rsite_count; /* Replicator */ - unsigned rdevice_count; /* Replicator */ - struct dm_tree_node *replicator;/* Replicator-dev */ - uint64_t rdevice_index; /* Replicator-dev */ - int delta_disks; /* raid reshape number of disks */ int data_offset; /* raid reshape data offset on disk to set */ uint64_t rebuilds[RAID_BITMAP_SIZE]; /* raid */ @@ -2099,47 +2069,9 @@ static int _emit_areas_line(struct dm_task *dmt __attribute__((unused)), struct seg_area *area; char devbuf[DM_FORMAT_DEV_BUFSIZE]; unsigned first_time = 1; - const char *logtype, *synctype; - unsigned log_parm_count; dm_list_iterate_items(area, &seg->areas) { switch (seg->type) { - case SEG_REPLICATOR_DEV: - if (!_build_dev_string(devbuf, sizeof(devbuf), area->dev_node)) - return_0; - - EMIT_PARAMS(*pos, " %d 1 %s", area->rsite_index, devbuf); - if (first_time) - EMIT_PARAMS(*pos, " nolog 0"); - else { - /* Remote devices */ - log_parm_count = (area->flags & - (DM_NOSYNC | DM_FORCESYNC)) ? 2 : 1; - - if (!area->slog) { - devbuf[0] = 0; /* Only core log parameters */ - logtype = "core"; - } else { - devbuf[0] = ' '; /* Extra space before device name */ - if (!_build_dev_string(devbuf + 1, - sizeof(devbuf) - 1, - area->slog)) - return_0; - logtype = "disk"; - log_parm_count++; /* Extra sync log device name parameter */ - } - - EMIT_PARAMS(*pos, " %s %u%s %" PRIu64, logtype, - log_parm_count, devbuf, area->region_size); - - synctype = (area->flags & DM_NOSYNC) ? - " nosync" : (area->flags & DM_FORCESYNC) ? - " sync" : NULL; - - if (synctype) - EMIT_PARAMS(*pos, "%s", synctype); - } - break; case SEG_RAID0: case SEG_RAID0_META: case SEG_RAID1: @@ -2181,42 +2113,6 @@ static int _emit_areas_line(struct dm_task *dmt __attribute__((unused)), return 1; } -static int _replicator_emit_segment_line(const struct load_segment *seg, char *params, - size_t paramsize, int *pos) -{ - const struct load_segment *rlog_seg; - struct replicator_site *rsite; - char rlogbuf[DM_FORMAT_DEV_BUFSIZE]; - unsigned parm_count; - - if (!seg->log || !_build_dev_string(rlogbuf, sizeof(rlogbuf), seg->log)) - return_0; - - rlog_seg = dm_list_item(dm_list_last(&seg->log->props.segs), - struct load_segment); - - EMIT_PARAMS(*pos, "%s 4 %s 0 auto %" PRIu64, - seg->rlog_type, rlogbuf, rlog_seg->size); - - dm_list_iterate_items(rsite, &seg->rsites) { - parm_count = (rsite->fall_behind_data - || rsite->fall_behind_ios - || rsite->async_timeout) ? 4 : 2; - - EMIT_PARAMS(*pos, " blockdev %u %u %s", parm_count, rsite->rsite_index, - (rsite->mode == DM_REPLICATOR_SYNC) ? "synchronous" : "asynchronous"); - - if (rsite->fall_behind_data) - EMIT_PARAMS(*pos, " data %" PRIu64, rsite->fall_behind_data); - else if (rsite->fall_behind_ios) - EMIT_PARAMS(*pos, " ios %" PRIu32, rsite->fall_behind_ios); - else if (rsite->async_timeout) - EMIT_PARAMS(*pos, " timeout %" PRIu32, rsite->async_timeout); - } - - return 1; -} - /* * Returns: 1 on success, 0 on failure */ @@ -2677,21 +2573,6 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major, if (!r) return_0; break; - case SEG_REPLICATOR: - if ((r = _replicator_emit_segment_line(seg, params, paramsize, - &pos)) <= 0) { - stack; - return r; - } - break; - case SEG_REPLICATOR_DEV: - if (!seg->replicator || !_build_dev_string(originbuf, - sizeof(originbuf), - seg->replicator)) - return_0; - - EMIT_PARAMS(pos, "%s %" PRIu64, originbuf, seg->rdevice_index); - break; case SEG_SNAPSHOT: case SEG_SNAPSHOT_MERGE: if (!_build_dev_string(originbuf, sizeof(originbuf), seg->origin)) @@ -2757,7 +2638,6 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major, switch(seg->type) { case SEG_ERROR: - case SEG_REPLICATOR: case SEG_SNAPSHOT: case SEG_SNAPSHOT_ORIGIN: case SEG_SNAPSHOT_MERGE: @@ -2768,7 +2648,6 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major, break; case SEG_CRYPT: case SEG_LINEAR: - case SEG_REPLICATOR_DEV: case SEG_STRIPED: if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) { stack; @@ -3573,74 +3452,8 @@ int dm_tree_node_add_replicator_target(struct dm_tree_node *node, uint64_t fall_behind_data, uint32_t fall_behind_ios) { - struct load_segment *rseg; - struct replicator_site *rsite; - - /* Local site0 - adds replicator segment and links rlog device */ - if (rsite_index == REPLICATOR_LOCAL_SITE) { - if (node->props.segment_count) { - log_error(INTERNAL_ERROR "Attempt to add replicator segment to already used node."); - return 0; - } - - if (!(rseg = _add_segment(node, SEG_REPLICATOR, size))) - return_0; - - if (!(rseg->log = dm_tree_find_node_by_uuid(node->dtree, rlog_uuid))) { - log_error("Missing replicator log uuid %s.", rlog_uuid); - return 0; - } - - if (!_link_tree_nodes(node, rseg->log)) - return_0; - - if (strcmp(rlog_type, "ringbuffer") != 0) { - log_error("Unsupported replicator log type %s.", rlog_type); - return 0; - } - - if (!(rseg->rlog_type = dm_pool_strdup(node->dtree->mem, rlog_type))) - return_0; - - dm_list_init(&rseg->rsites); - rseg->rdevice_count = 0; - node->activation_priority = 1; - } - - /* Add site to segment */ - if (mode == DM_REPLICATOR_SYNC - && (async_timeout || fall_behind_ios || fall_behind_data)) { - log_error("Async parameters passed for synchronnous replicator."); - return 0; - } - - if (node->props.segment_count != 1) { - log_error(INTERNAL_ERROR "Attempt to add remote site area before setting replicator log."); - return 0; - } - - rseg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment); - if (rseg->type != SEG_REPLICATOR) { - log_error(INTERNAL_ERROR "Attempt to use non replicator segment %s.", - _dm_segtypes[rseg->type].target); - return 0; - } - - if (!(rsite = dm_pool_zalloc(node->dtree->mem, sizeof(*rsite)))) { - log_error("Failed to allocate remote site segment."); - return 0; - } - - dm_list_add(&rseg->rsites, &rsite->list); - rseg->rsite_count++; - - rsite->mode = mode; - rsite->async_timeout = async_timeout; - rsite->fall_behind_data = fall_behind_data; - rsite->fall_behind_ios = fall_behind_ios; - rsite->rsite_index = rsite_index; - - return 1; + log_error("Replicator segment is unsupported."); + return 0; } /* Appends device node to Replicator */ @@ -3654,78 +3467,8 @@ int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node, uint32_t slog_flags, uint32_t slog_region_size) { - struct seg_area *area; - struct load_segment *rseg; - struct load_segment *rep_seg; - - if (rsite_index == REPLICATOR_LOCAL_SITE) { - /* Site index for local target */ - if (!(rseg = _add_segment(node, SEG_REPLICATOR_DEV, size))) - return_0; - - if (!(rseg->replicator = dm_tree_find_node_by_uuid(node->dtree, replicator_uuid))) { - log_error("Missing replicator uuid %s.", replicator_uuid); - return 0; - } - - /* Local slink0 for replicator must be always initialized first */ - if (rseg->replicator->props.segment_count != 1) { - log_error(INTERNAL_ERROR "Attempt to use non replicator segment."); - return 0; - } - - rep_seg = dm_list_item(dm_list_last(&rseg->replicator->props.segs), struct load_segment); - if (rep_seg->type != SEG_REPLICATOR) { - log_error(INTERNAL_ERROR "Attempt to use non replicator segment %s.", - _dm_segtypes[rep_seg->type].target); - return 0; - } - rep_seg->rdevice_count++; - - if (!_link_tree_nodes(node, rseg->replicator)) - return_0; - - rseg->rdevice_index = rdevice_index; - } else { - /* Local slink0 for replicator must be always initialized first */ - if (node->props.segment_count != 1) { - log_error(INTERNAL_ERROR "Attempt to use non replicator-dev segment."); - return 0; - } - - rseg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment); - if (rseg->type != SEG_REPLICATOR_DEV) { - log_error(INTERNAL_ERROR "Attempt to use non replicator-dev segment %s.", - _dm_segtypes[rseg->type].target); - return 0; - } - } - - if (!(slog_flags & DM_CORELOG) && !slog_uuid) { - log_error("Unspecified sync log uuid."); - return 0; - } - - if (!dm_tree_node_add_target_area(node, NULL, rdev_uuid, 0)) - return_0; - - area = dm_list_item(dm_list_last(&rseg->areas), struct seg_area); - - if (!(slog_flags & DM_CORELOG)) { - if (!(area->slog = dm_tree_find_node_by_uuid(node->dtree, slog_uuid))) { - log_error("Couldn't find sync log uuid %s.", slog_uuid); - return 0; - } - - if (!_link_tree_nodes(node, area->slog)) - return_0; - } - - area->flags = slog_flags; - area->region_size = slog_region_size; - area->rsite_index = rsite_index; - - return 1; + log_error("Replicator targer is unsupported."); + return 0; } static struct load_segment *_get_single_load_segment(struct dm_tree_node *node,
1
0
0
0
master - libdm: watch for failing _info_by_dev
by Zdenek Kabelac
04 Dec '17
04 Dec '17
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=63368a5064dd20a1fb5a2…
Commit: 63368a5064dd20a1fb5a2f4110704059c79b3ced Parent: b74e7f6a781bf7dc4914d8294fcbc6881a539f2e Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Dec 4 15:05:44 2017 +0100 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Mon Dec 4 15:38:50 2017 +0100 libdm: watch for failing _info_by_dev Separate handling of error code from _info_by_dev. This error can only happeng when we are running out of memory. In such case there is urgent need to stop any futher proceeding of command and run to error ASAP. --- WHATS_NEW_DM | 1 + libdm/libdm-deptree.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 9cec953..56b8153 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.146 - ==================================== + Do not ignore failure of _info_by_dev(). Propagate delayed resume for pvmove subvolumes. Suppress integrity encryption keys in 'table' output unless --showkeys supplied. diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 8c623bf..ff7e9b4 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1011,8 +1011,10 @@ static int _node_has_closed_parents(struct dm_tree_node *node, return_0; /* FIXME Is this normal? */ /* Refresh open_count */ - if (!_info_by_dev(dinfo->major, dinfo->minor, 1, &info, NULL, NULL, NULL) || - !info.exists) + if (!_info_by_dev(dinfo->major, dinfo->minor, 1, &info, NULL, NULL, NULL)) + return_0; + + if (!info.exists) continue; if (info.open_count) { @@ -1137,7 +1139,7 @@ static int _node_clear_table(struct dm_tree_node *dnode, uint16_t udev_flags) if (!_info_by_dev(MAJOR(deps->device[i]), MINOR(deps->device[i]), 1, &deps_info, dnode->dtree->mem, &name, &uuid)) - continue; + goto_out; /* Proceed if device is an 'orphan' - unreferenced and without a live table. */ if (!deps_info.exists || deps_info.live_table || deps_info.open_count) @@ -1653,8 +1655,10 @@ static int _dm_tree_deactivate_children(struct dm_tree_node *dnode, continue; /* Refresh open_count */ - if (!_info_by_dev(dinfo->major, dinfo->minor, 1, &info, NULL, NULL, NULL) || - !info.exists) + if (!_info_by_dev(dinfo->major, dinfo->minor, 1, &info, NULL, NULL, NULL)) + return_0; + + if (!info.exists) continue; if (info.open_count) { @@ -1773,8 +1777,10 @@ int dm_tree_suspend_children(struct dm_tree_node *dnode, if (!_children_suspended(child, 1, uuid_prefix, uuid_prefix_len)) continue; - if (!_info_by_dev(dinfo->major, dinfo->minor, 0, &info, NULL, NULL, NULL) || - !info.exists || info.suspended) + if (!_info_by_dev(dinfo->major, dinfo->minor, 0, &info, NULL, NULL, NULL)) + return_0; + + if (!info.exists || info.suspended) continue; /* If child has some real messages send them */
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
10
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
Results per page:
10
25
50
100
200