master - vgcreate/vgextend: restrict PVs with mixed block sizes
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0404539edb25e4a9d3456bb3e6b402aa2767af6b Commit: 0404539edb25e4a9d3456bb3e6b402aa2767af6b Parent: c1996c78c18ee0b555e4f7eba16858d8dd4fa0a1 Author: David Teigland <[email protected]> AuthorDate: Thu Aug 1 10:06:47 2019 -0500 Committer: David Teigland <[email protected]> CommitterDate: Thu Aug 1 10:06:47 2019 -0500
vgcreate/vgextend: restrict PVs with mixed block sizes
Avoid having PVs with different logical block sizes in the same VG. This prevents LVs from having mixed block sizes, which can produce file system errors.
The new config setting devices/allow_mixed_block_sizes (default 0) can be changed to 1 to return to the unrestricted mode.
--- lib/commands/toolcontext.h | 1 + lib/config/config_settings.h | 5 ++++ lib/metadata/metadata-exported.h | 1 + lib/metadata/metadata.c | 44 +++++++++++++++++++++++++++++++++++ tools/lvmcmdline.c | 2 + tools/toollib.c | 47 ++++++++++++++++++++++++++++++++++++++ tools/vgcreate.c | 2 + 7 files changed, 102 insertions(+), 0 deletions(-)
lib/commands/toolcontext.h +1 -0
@@ -153,6 +153,7 @@ struct cmd_context { unsigned include_shared_vgs:1; /* report/display cmds can reveal lockd VGs */ unsigned include_active_foreign_vgs:1; /* cmd should process foreign VGs with active LVs */ unsigned vg_read_print_access_error:1; /* print access errors from vg_read */ + unsigned allow_mixed_block_sizes:1; unsigned force_access_clustered:1; unsigned lockd_gl_disable:1; unsigned lockd_vg_disable:1;
lib/config/config_settings.h +5 -0
@@ -502,6 +502,11 @@ cfg(devices_allow_changes_with_duplicate_pvs_CFG, "allow_changes_with_duplicate_ "Enabling this setting allows the VG to be used as usual even with\n" "uncertain devices.\n") +cfg(devices_allow_mixed_block_sizes_CFG, "allow_mixed_block_sizes", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 3, 6), NULL, 0, NULL, + "Allow PVs in the same VG with different logical block sizes.\n" + "When allowed, the user is responsible to ensure that an LV is\n" + "using PVs with matching block sizes when necessary.\n") +cfg_array (allocation_cling_tag_list_CFG,"cling_tag_list" , allocation_CFG_SECTION,CFG_DEFAULT_UNDEFINED ,CFG_TYPE_STRING ,NULL ,vsn (2 ,2 ,77 ),NULL ,0 ,NULL ,"Advise LVM which PVs to use when searching for new space.\n" "When searching for free space to extend an LV, the 'cling' allocation\n"
lib/metadata/metadata-exported.h +1 -0
@@ -623,6 +623,7 @@ struct pvcreate_params { unsigned is_remove : 1; /* is removing PVs, not creating */ unsigned preserve_existing : 1; unsigned check_failed : 1; + unsigned check_consistent_block_size : 1; };struct lvresize_params {
lib/metadata/metadata.c +44 -0
62 lines not on this page · raw message
tools/lvmcmdline.c +2 -0
@@ -2319,6 +2319,8 @@ static int _get_current_settings(struct cmd_context *cmd) cmd->scan_lvs =find_config_tree_bool (cmd, devices_scan_lvs_CFG,NULL ); + cmd->allow_mixed_block_sizes =find_config_tree_bool (cmd, devices_allow_mixed_block_sizes_CFG,NULL ); +/* * enable_hints is set to 1 if any commands are using hints. * use_hints is set to 1 if this command doesn't use the hints.
tools/toollib.c +47 -0
59 lines not on this page · raw message
tools/vgcreate.c +2 -0
@@ -47,6 +47,8 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)/* Don't create a new PV on top of an existing PV like pvcreate does. */ pp.preserve_existing =1 ; + pp.check_consistent_block_size =1 ; +if (!vgcreate_params_set_defaults (cmd, &vp_def,NULL ))return EINVALID_CMD_LINE ; vp_def.vg_name = vg_name;