master - make: generate
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=08396b4bce45fb83119...
Commit: 08396b4bce45fb8311979250623f04ec0ddb628c
Parent: 728435e7d680c95fd21fe496d707d1c77adf7d85
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 9 12:56:28 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 9 12:57:07 2019 +0200
make: generate
Run make generate.
---
conf/example.conf.in | 18 +++++++-----
man/lvconvert.8_pregen | 70 ++++++++++++++++++++++++++----------------------
2 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 154f621..91ce5be 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -142,7 +142,7 @@ devices {
#
# Example
# Accept every block device:
- # filter = [ "a|.*/|" ]
+ # filter = [ "a|.*|" ]
# Reject the cdrom drive:
# filter = [ "r|/dev/cdrom|" ]
# Work with just loopback devices, e.g. for testing:
@@ -150,10 +150,10 @@ devices {
# Accept all loop devices and ide drives except hdc:
# filter = [ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
# Use anchors to be very specific:
- # filter = [ "a|^/dev/hda8$|", "r|.*/|" ]
+ # filter = [ "a|^/dev/hda8$|", "r|.*|" ]
#
# This configuration option has an automatic default value.
- # filter = [ "a|.*/|" ]
+ # filter = [ "a|.*|" ]
# Configuration option devices/global_filter.
# Limit the block devices that are used by LVM system components.
@@ -163,7 +163,7 @@ devices {
# The syntax is the same as devices/filter. Devices rejected by
# global_filter are not opened by LVM.
# This configuration option has an automatic default value.
- # global_filter = [ "a|.*/|" ]
+ # global_filter = [ "a|.*|" ]
# Configuration option devices/types.
# List of additional acceptable block device types.
@@ -347,6 +347,12 @@ devices {
# Enabling this setting allows the VG to be used as usual even with
# uncertain devices.
allow_changes_with_duplicate_pvs = 0
+
+ # Configuration option devices/allow_mixed_block_sizes.
+ # Allow PVs in the same VG with different logical block sizes.
+ # When allowed, the user is responsible to ensure that an LV is
+ # using PVs with matching block sizes when necessary.
+ allow_mixed_block_sizes = 0
}
# Configuration section allocation.
@@ -899,9 +905,6 @@ global {
# the error messages.
activation = 1
- # Configuration option global/segment_libraries.
- # This configuration option does not have a default value defined.
-
# Configuration option global/proc.
# Location of proc filesystem.
# This configuration option is advanced.
@@ -1751,7 +1754,6 @@ activation {
# additional space for VG metadata. The --metadatasize option overrides
# this setting.
# This configuration option does not have a default value defined.
- # This configuration option has an automatic default value.
# Configuration option metadata/pvmetadataignore.
# Ignore metadata areas on a new PV.
diff --git a/man/lvconvert.8_pregen b/man/lvconvert.8_pregen
index 7252f6f..846ea2d 100644
--- a/man/lvconvert.8_pregen
+++ b/man/lvconvert.8_pregen
@@ -378,6 +378,44 @@ Convert LV to striped.
.RE
-
+Convert LV to type mirror (also see type raid1),
+.br
+.P
+\fBlvconvert\fP \fB--type\fP \fBmirror\fP \fILV\fP
+.br
+.RS 4
+.ad l
+[ \fB-m\fP|\fB--mirrors\fP [\fB+\fP|\fB-\fP]\fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB-R\fP|\fB--regionsize\fP \fISize\fP[m|UNIT] ]
+.ad b
+.br
+.ad l
+[ \fB-i\fP|\fB--interval\fP \fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB--stripes\fP \fINumber\fP ]
+.ad b
+.br
+.ad l
+[ \fB--mirrorlog\fP \fBcore\fP|\fBdisk\fP ]
+.ad b
+.br
+[ COMMON_OPTIONS ]
+.RE
+.br
+.RS 4
+[ \fIPV\fP ... ]
+.RE
+-
+
Convert LV to raid or change raid layout
.br
(a specific raid level must be used, e.g. raid1).
@@ -1636,38 +1674,6 @@ For example, LVM_VG_NAME can generally be substituted for a required VG paramete
.SH ADVANCED USAGE
Alternate command forms, advanced command usage, and listing of all valid syntax for completeness.
.P
-Convert LV to type mirror (also see type raid1),
-.br
-(also see lvconvert --mirrors).
-.br
-.P
-\fBlvconvert\fP \fB--type\fP \fBmirror\fP \fILV\fP
-.br
-.RS 4
-.ad l
-[ \fB-m\fP|\fB--mirrors\fP [\fB+\fP|\fB-\fP]\fINumber\fP ]
-.ad b
-.br
-.ad l
-[ \fB-R\fP|\fB--regionsize\fP \fISize\fP[m|UNIT] ]
-.ad b
-.br
-.ad l
-[ \fB-i\fP|\fB--interval\fP \fINumber\fP ]
-.ad b
-.br
-.ad l
-[ \fB--mirrorlog\fP \fBcore\fP|\fBdisk\fP ]
-.ad b
-.br
-[ COMMON_OPTIONS ]
-.RE
-.br
-.RS 4
-[ \fIPV\fP ... ]
-.RE
--
-
Change the region size of an LV.
.br
.P
4 years, 8 months
master - cov: check for socket_path being set
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=728435e7d680c95fd21...
Commit: 728435e7d680c95fd21fe496d707d1c77adf7d85
Parent: cc4a92b13c08f500c1dc0c7af95af599b1c15095
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 25 15:11:05 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 9 12:57:07 2019 +0200
cov: check for socket_path being set
As we check for existince on entering path
let's ensure it's there also on exit path.
---
libdaemon/server/daemon-server.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 9dd0017..2df4e89 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -690,7 +690,7 @@ void daemon_start(daemon_state s)
out:
/* If activated by systemd, do not unlink the socket - systemd takes care of that! */
if (!_systemd_activation && s.socket_fd >= 0)
- if (unlink(s.socket_path))
+ if (s.socket_path && unlink(s.socket_path))
perror("unlink error");
if (s.socket_fd >= 0)
4 years, 8 months
master - cov: ensure cname exists before derefering it
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=cc4a92b13c08f500c1d...
Commit: cc4a92b13c08f500c1dc0c7af95af599b1c15095
Parent: 46f1d17c743145d3ffa045557a6a792eb99f478a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jun 25 15:29:26 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 9 12:57:07 2019 +0200
cov: ensure cname exists before derefering it
Just make it clear to analyzers cname can't be NULL.
TODO: maybe exclude NULL at front of the function...
---
tools/command.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/command.c b/tools/command.c
index 724040e..2e69eff 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -1935,7 +1935,7 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
* see print_common_options_cmd()
*/
- if ((cname->variants > 1) && cname->common_options[opt_enum])
+ if (cname && (cname->variants > 1) && cname->common_options[opt_enum])
continue;
printf("\n\t[");
@@ -1975,7 +1975,7 @@ void print_usage(struct command *cmd, int longhelp, int desc_first)
* see print_common_options_cmd()
*/
- if ((cname->variants > 1) && cname->common_options[opt_enum])
+ if (cname && (cname->variants > 1) && cname->common_options[opt_enum])
continue;
printf("\n\t[");
@@ -3438,7 +3438,7 @@ static int _print_man(char *name, char *des_file, int secondary)
if (!prev_cmd || strcmp(prev_cmd->name, cmd->name)) {
printf(".SH NAME\n");
- if (cname->desc)
+ if (cname && cname->desc)
printf("%s - %s\n", lvmname, cname->desc);
else
printf("%s\n", lvmname);
4 years, 8 months
master - libdm: implement search for device names for older kernels
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=46f1d17c743145d3ffa...
Commit: 46f1d17c743145d3ffa045557a6a792eb99f478a
Parent: 2f5ea9e61acf56aa244715570710ba1e229a77cd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 6 01:21:39 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 9 12:57:07 2019 +0200
libdm: implement search for device names for older kernels
Kernels <2.6.27 don't have /sys/dev dir - add code for looking
out device name via longre seach in /sys/block
This makes commands like 'dmsetup dep -o blkdevname' working.
---
device_mapper/libdm-common.c | 118 +++++++++++++++++++++++++++++++++++++++++-
libdm/libdm-common.c | 119 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 235 insertions(+), 2 deletions(-)
diff --git a/device_mapper/libdm-common.c b/device_mapper/libdm-common.c
index 45dcb4c..1cb29f1 100644
--- a/device_mapper/libdm-common.c
+++ b/device_mapper/libdm-common.c
@@ -1874,6 +1874,120 @@ bad:
return r;
}
+static int _sysfs_get_dev_major_minor(const char *path, uint32_t major, uint32_t minor)
+{
+ FILE *fp;
+ uint32_t ma, mi;
+ int r;
+
+ if (!(fp = fopen(path, "r")))
+ return 0;
+
+ r = (fscanf(fp, "%" PRIu32 ":%" PRIu32 , &ma, &mi) == 2) &&
+ (ma == major) && (mi == minor);
+ // log_debug("Checking %s %u:%u -> %d", path, ma, mi, r);
+
+ if (fclose(fp))
+ log_sys_error("fclose", path);
+
+ return r;
+}
+
+static int _sysfs_find_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
+{
+ const char *name, *name_dev;
+ char path[PATH_MAX];
+ struct dirent *dirent, *dirent_dev;
+ DIR *d, *d_dev;
+ struct stat st;
+ int r = 0, sz;
+
+ if (!*_sysfs_dir ||
+ dm_snprintf(path, sizeof(path), "%s/block/", _sysfs_dir) < 0) {
+ log_error("Failed to build sysfs_path.");
+ return 0;
+ }
+
+ if (!(d = opendir(path))) {
+ log_sys_error("opendir", path);
+ return 0;
+ }
+
+ while (!r && (dirent = readdir(d))) {
+ name = dirent->d_name;
+
+ if (!strcmp(name, ".") || !strcmp(name, ".."))
+ continue;
+
+ if ((sz = dm_snprintf(path, sizeof(path), "%sblock/%s/dev",
+ _sysfs_dir, name)) == -1) {
+ log_warn("Couldn't create path for %s.", name);
+ continue;
+ }
+
+ if (_sysfs_get_dev_major_minor(path, major, minor)) {
+ r = dm_strncpy(buf, name, buf_size);
+ break; /* found */
+ }
+
+ path[sz - 4] = 0; /* strip /dev from end of path string */
+ if (stat(path, &st))
+ continue;
+
+ if (S_ISDIR(st.st_mode)) {
+
+ /* let's assume there is no tree-complex device in past systems */
+ if (!(d_dev = opendir(path))) {
+ log_sys_debug("opendir", path);
+ continue;
+ }
+
+ while ((dirent_dev = readdir(d_dev))) {
+ name_dev = dirent_dev->d_name;
+
+ /* skip known ignorable paths */
+ if (!strcmp(name_dev, ".") || !strcmp(name_dev, "..") ||
+ !strcmp(name_dev, "bdi") ||
+ !strcmp(name_dev, "dev") ||
+ !strcmp(name_dev, "device") ||
+ !strcmp(name_dev, "holders") ||
+ !strcmp(name_dev, "integrity") ||
+ !strcmp(name_dev, "loop") ||
+ !strcmp(name_dev, "queueu") ||
+ !strcmp(name_dev, "md") ||
+ !strcmp(name_dev, "mq") ||
+ !strcmp(name_dev, "power") ||
+ !strcmp(name_dev, "removable") ||
+ !strcmp(name_dev, "slave") ||
+ !strcmp(name_dev, "slaves") ||
+ !strcmp(name_dev, "subsystem") ||
+ !strcmp(name_dev, "trace") ||
+ !strcmp(name_dev, "uevent"))
+ continue;
+
+ if (dm_snprintf(path, sizeof(path), "%sblock/%s/%s/dev",
+ _sysfs_dir, name, name_dev) == -1) {
+ log_warn("Couldn't create path for %s/%s.", name, name_dev);
+ continue;
+ }
+
+ if (_sysfs_get_dev_major_minor(path, major, minor)) {
+ r = dm_strncpy(buf, name_dev, buf_size);
+ break; /* found */
+ }
+ }
+
+ if (closedir(d_dev))
+ log_sys_debug("closedir", name);
+ }
+ }
+
+ if (closedir(d))
+ log_sys_debug("closedir", path);
+
+ return r;
+}
+
static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
{
char *name, *sysfs_path, *temp_buf = NULL;
@@ -1896,8 +2010,10 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz
if ((size = readlink(sysfs_path, temp_buf, PATH_MAX - 1)) < 0) {
if (errno != ENOENT)
log_sys_error("readlink", sysfs_path);
- else
+ else {
log_sys_debug("readlink", sysfs_path);
+ return _sysfs_find_kernel_name(major, minor, buf, buf_size);
+ }
goto bad;
}
temp_buf[size] = '\0';
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 7d19f75..d17c284 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1872,6 +1872,121 @@ bad:
return r;
}
+static int _sysfs_get_dev_major_minor(const char *path, uint32_t major, uint32_t minor)
+{
+ FILE *fp;
+ uint32_t ma, mi;
+ int r;
+
+ if (!(fp = fopen(path, "r")))
+ return 0;
+
+ r = (fscanf(fp, "%" PRIu32 ":%" PRIu32 , &ma, &mi) == 2) &&
+ (ma == major) && (mi == minor);
+ // log_debug("Checking %s %u:%u -> %d", path, ma, mi, r);
+
+ if (fclose(fp))
+ log_sys_error("fclose", path);
+
+ return r;
+}
+
+
+static int _sysfs_find_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
+{
+ const char *name, *name_dev;
+ char path[PATH_MAX];
+ struct dirent *dirent, *dirent_dev;
+ DIR *d, *d_dev;
+ struct stat st;
+ int r = 0, sz;
+
+ if (!*_sysfs_dir ||
+ dm_snprintf(path, sizeof(path), "%s/block/", _sysfs_dir) < 0) {
+ log_error("Failed to build sysfs_path.");
+ return 0;
+ }
+
+ if (!(d = opendir(path))) {
+ log_sys_error("opendir", path);
+ return 0;
+ }
+
+ while (!r && (dirent = readdir(d))) {
+ name = dirent->d_name;
+
+ if (!strcmp(name, ".") || !strcmp(name, ".."))
+ continue;
+
+ if ((sz = dm_snprintf(path, sizeof(path), "%sblock/%s/dev",
+ _sysfs_dir, name)) == -1) {
+ log_warn("Couldn't create path for %s.", name);
+ continue;
+ }
+
+ if (_sysfs_get_dev_major_minor(path, major, minor)) {
+ r = dm_strncpy(buf, name, buf_size);
+ break; /* found */
+ }
+
+ path[sz - 4] = 0; /* strip /dev from end of path string */
+ if (stat(path, &st))
+ continue;
+
+ if (S_ISDIR(st.st_mode)) {
+
+ /* let's assume there is no tree-complex device in past systems */
+ if (!(d_dev = opendir(path))) {
+ log_sys_debug("opendir", path);
+ continue;
+ }
+
+ while ((dirent_dev = readdir(d_dev))) {
+ name_dev = dirent_dev->d_name;
+
+ /* skip known ignorable paths */
+ if (!strcmp(name_dev, ".") || !strcmp(name_dev, "..") ||
+ !strcmp(name_dev, "bdi") ||
+ !strcmp(name_dev, "dev") ||
+ !strcmp(name_dev, "device") ||
+ !strcmp(name_dev, "holders") ||
+ !strcmp(name_dev, "integrity") ||
+ !strcmp(name_dev, "loop") ||
+ !strcmp(name_dev, "queueu") ||
+ !strcmp(name_dev, "md") ||
+ !strcmp(name_dev, "mq") ||
+ !strcmp(name_dev, "power") ||
+ !strcmp(name_dev, "removable") ||
+ !strcmp(name_dev, "slave") ||
+ !strcmp(name_dev, "slaves") ||
+ !strcmp(name_dev, "subsystem") ||
+ !strcmp(name_dev, "trace") ||
+ !strcmp(name_dev, "uevent"))
+ continue;
+
+ if (dm_snprintf(path, sizeof(path), "%sblock/%s/%s/dev",
+ _sysfs_dir, name, name_dev) == -1) {
+ log_warn("Couldn't create path for %s/%s.", name, name_dev);
+ continue;
+ }
+
+ if (_sysfs_get_dev_major_minor(path, major, minor)) {
+ r = dm_strncpy(buf, name_dev, buf_size);
+ break; /* found */
+ }
+ }
+
+ if (closedir(d_dev))
+ log_sys_debug("closedir", name);
+ }
+ }
+
+ if (closedir(d))
+ log_sys_debug("closedir", path);
+
+ return r;
+}
+
static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, size_t buf_size)
{
char *name, *sysfs_path, *temp_buf = NULL;
@@ -1894,8 +2009,10 @@ static int _sysfs_get_kernel_name(uint32_t major, uint32_t minor, char *buf, siz
if ((size = readlink(sysfs_path, temp_buf, PATH_MAX - 1)) < 0) {
if (errno != ENOENT)
log_sys_error("readlink", sysfs_path);
- else
+ else {
log_sys_debug("readlink", sysfs_path);
+ return _sysfs_find_kernel_name(major, minor, buf, buf_size);
+ }
goto bad;
}
temp_buf[size] = '\0';
4 years, 8 months
master - exported_symbols: comment old symbols
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2f5ea9e61acf56aa244...
Commit: 2f5ea9e61acf56aa244715570710ba1e229a77cd
Parent: f2489d9dda78a9976b9655cd82efaa7ef6615e91
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 30 15:31:51 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 9 12:57:07 2019 +0200
exported_symbols: comment old symbols
Fix versioning for updated symbols dm_stats_create_region
and dm_stats_create_region.
Only the latest symbol should have global entry.
Since I'm not sure what is currenlty the best option for
old symbols - we added support for easy commenting of them
(so we do not lose information when the symbol appeared
for the first time.)
Note: some old already deleted symbols should have been
restored as comments.
---
WHATS_NEW_DM | 1 +
libdm/.exported_symbols.DM_1_02_106 | 2 +-
libdm/.exported_symbols.DM_1_02_129 | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 4ea3ed5..2c0c7ec 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.165 -
=================================
+ Fix versioning of dm_stats_create_region and dm_stats_create_region.
Version 1.02.163 - 15th June 2019
=================================
diff --git a/libdm/.exported_symbols.DM_1_02_106 b/libdm/.exported_symbols.DM_1_02_106
index 0bec544..88bba02 100644
--- a/libdm/.exported_symbols.DM_1_02_106
+++ b/libdm/.exported_symbols.DM_1_02_106
@@ -1,5 +1,5 @@
dm_message_supports_precise_timestamps
-dm_stats_create_region
+#dm_stats_create_region
dm_stats_driver_supports_precise
dm_stats_get_current_region_precise_timestamps
dm_stats_get_region_precise_timestamps
diff --git a/libdm/.exported_symbols.DM_1_02_129 b/libdm/.exported_symbols.DM_1_02_129
index 88d3f1b..a5133dd 100644
--- a/libdm/.exported_symbols.DM_1_02_129
+++ b/libdm/.exported_symbols.DM_1_02_129
@@ -1,4 +1,4 @@
-dm_bitset_parse_list
+#dm_bitset_parse_list
dm_stats_create_group
dm_stats_current_object_type
dm_stats_delete_group
4 years, 8 months
master - make: support comments in exported symbols
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f2489d9dda78a9976b9...
Commit: f2489d9dda78a9976b9655cd82efaa7ef6615e91
Parent: 3fcb4697f652e8f439b865f3b544b83576c156ae
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 30 15:31:01 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 9 12:57:07 2019 +0200
make: support comments in exported symbols
Now the lines starting with '#' in exported symbols files are treated as
comments (ignored).
---
libdm/make.tmpl.in | 6 +++---
make.tmpl.in | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index 26e3dba..9041da5 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -512,17 +512,17 @@ EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.expor
.export.sym: .exported_symbols_generated $(EXPORTED_SYMBOLS)
ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
$(Q) set -e; (echo "Base {"; echo " global:";\
- $(SED) "s/^/ /;s/$$/;/" $<;\
+ $(SED) "/^#/d;s/^/ /;s/$$/;/" $<;\
echo "};";\
echo "Local {"; echo " local:"; echo " *;"; echo "};";\
) > $@
else
$(Q) set -e;\
- R=$$($(SORT) $^ | uniq -u);\
+ R=$$($(SORT) $^ | $(GREP) -v "^#" | uniq -u);\
test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\
( for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -rnt_ -k5 ); do\
echo "$${i##*.} {"; echo " global:";\
- $(SED) "s/^/ /;s/$$/;/" $$i;\
+ $(SED) "/^#/d;s/^/ /;s/$$/;/" $$i;\
echo "};";\
done;\
echo "Local {"; echo " local:"; echo " *;"; echo "};";\
diff --git a/make.tmpl.in b/make.tmpl.in
index f3332e9..8a20818 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -551,17 +551,17 @@ EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.expor
.export.sym: .exported_symbols_generated $(EXPORTED_SYMBOLS)
ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
$(Q) set -e; (echo "Base {"; echo " global:";\
- $(SED) "s/^/ /;s/$$/;/" $<;\
+ $(SED) "/^#/d;s/^/ /;s/$$/;/" $<;\
echo "};";\
echo "Local {"; echo " local:"; echo " *;"; echo "};";\
) > $@
else
$(Q) set -e;\
- R=$$($(SORT) $^ | uniq -u);\
+ R=$$($(SORT) $^ | $(GREP) -v "^#" | uniq -u);\
test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\
( for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -rnt_ -k5 ); do\
echo "$${i##*.} {"; echo " global:";\
- $(SED) "s/^/ /;s/$$/;/" $$i;\
+ $(SED) "/^#/d;s/^/ /;s/$$/;/" $$i;\
echo "};";\
done;\
echo "Local {"; echo " local:"; echo " *;"; echo "};";\
4 years, 8 months
master - tests: open-file-limit
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3fcb4697f652e8f439b...
Commit: 3fcb4697f652e8f439b865f3b544b83576c156ae
Parent: ecefcc9ca89982dbc5cc6b210da7ca9d0fef655b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 8 15:21:26 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 8 15:45:03 2019 -0500
tests: open-file-limit
---
test/shell/open-file-limit.sh | 46 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/test/shell/open-file-limit.sh b/test/shell/open-file-limit.sh
new file mode 100644
index 0000000..87b0f7e
--- /dev/null
+++ b/test/shell/open-file-limit.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Test scan_lvs config setting
+
+SKIP_WITH_LVMPOLLD=1
+SKIP_WITH_LVMLOCKD=1
+
+. lib/inittest
+
+aux lvmconf 'devices/pv_min_size = 1024'
+
+aux prepare_devs 200 1
+
+for i in $(seq 1 200); do
+ pvcreate "$DM_DEV_DIR/mapper/${PREFIX}pv$i"
+done
+
+pvs > out
+test "$(grep pv out | wc -l)" -eq 200
+
+# Set the soft limit to 100 fd's when 200 PVs need to be open.
+# This requires lvm to increase its soft limit in order to
+# process all the PVs.
+# Test this with and without udev providing device lists.
+
+aux lvmconf 'devices/obtain_device_list_from_udev = 0'
+
+prlimit --nofile=100: pvs > out
+
+test "$(grep pv out | wc -l)" -eq 200
+
+aux lvmconf 'devices/obtain_device_list_from_udev = 1'
+
+prlimit --nofile=100: pvs > out
+
+test "$(grep pv out | wc -l)" -eq 200
+
4 years, 8 months
master - increase soft open file limit
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ecefcc9ca89982dbc5c...
Commit: ecefcc9ca89982dbc5cc6b210da7ca9d0fef655b
Parent: eb6aa5fefee0793bf4122640a2a53ed70602e4cc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 8 13:11:05 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 8 15:45:03 2019 -0500
increase soft open file limit
When there are more devices than the current soft
open file limit (default 1024), raise the soft limit
to the hard/max limit (default 4096).
Do this prior to scanning in case enough of the
devices are PVs that need to be kept open.
---
lib/label/label.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index 5d8a0f5..9454fc8 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -29,6 +29,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
+#include <sys/resource.h>
/* FIXME Allow for larger labels? Restricted to single sector currently */
@@ -860,6 +861,57 @@ static void _free_hints(struct dm_list *hints)
}
/*
+ * We don't know how many of num_devs will be PVs that we need to
+ * keep open, but if it's greater than the soft limit, then we'll
+ * need the soft limit raised, so do that before starting.
+ *
+ * If opens approach the raised soft/hard limit while scanning, then
+ * we could also attempt to raise the soft/hard limits during the scan.
+ */
+
+#define BASE_FD_COUNT 32 /* Number of open files we want apart from devs */
+
+static void _prepare_open_file_limit(struct cmd_context *cmd, unsigned int num_devs)
+{
+ struct rlimit old, new;
+ unsigned int want = num_devs + BASE_FD_COUNT;
+ int rv;
+
+ rv = prlimit(0, RLIMIT_NOFILE, NULL, &old);
+ if (rv < 0) {
+ log_debug("Checking fd limit for num_devs %u failed %d", num_devs, errno);
+ return;
+ }
+
+ log_debug("Checking fd limit for num_devs %u want %u soft %lld hard %lld",
+ num_devs, want, (long long)old.rlim_cur, (long long)old.rlim_max);
+
+ /* Current soft limit is enough */
+ if (old.rlim_cur > want)
+ return;
+
+ /* Soft limit already raised to max */
+ if (old.rlim_cur == old.rlim_max)
+ return;
+
+ /* Raise soft limit up to hard/max limit */
+ new.rlim_cur = old.rlim_max;
+ new.rlim_max = old.rlim_max;
+
+ log_debug("Setting fd limit for num_devs %u soft %lld hard %lld",
+ num_devs, (long long)new.rlim_cur, (long long)new.rlim_max);
+
+ rv = prlimit(0, RLIMIT_NOFILE, &new, &old);
+ if (rv < 0) {
+ if (errno == EPERM)
+ log_warn("WARNING: permission error setting open file limit for scanning %u devices.", num_devs);
+ else
+ log_warn("WARNING: cannot set open file limit for scanning %u devices.", num_devs);
+ return;
+ }
+}
+
+/*
* Scan devices on the system to discover which are LVM devices.
* Info about the LVM devices (PVs) is saved in lvmcache in a
* basic/summary form (info/vginfo structs). The vg_read phase
@@ -977,6 +1029,15 @@ int label_scan(struct cmd_context *cmd)
log_debug("Will scan %d devices skip %d", dm_list_size(&scan_devs), dm_list_size(&all_devs));
/*
+ * If the total number of devices exceeds the soft open file
+ * limit, then increase the soft limit to the hard/max limit
+ * in case the number of PVs in scan_devs (it's only the PVs
+ * which we want to keep open) is higher than the current
+ * soft limit.
+ */
+ _prepare_open_file_limit(cmd, dm_list_size(&scan_devs));
+
+ /*
* Do the main scan.
*/
_scan_list(cmd, cmd->filter, &scan_devs, NULL);
4 years, 8 months
master - devices: put ifdef around BLKPBSZGET
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eb6aa5fefee0793bf41...
Commit: eb6aa5fefee0793bf4122640a2a53ed70602e4cc
Parent: 09bc2d0fd15a5bbb5d1e8d6ce79bd786ffed42b3
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 8 15:43:09 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 8 15:45:03 2019 -0500
devices: put ifdef around BLKPBSZGET
BLKPBSZGET is not defined before kernel version 2.6.32
(e.g. rhel5)
---
lib/device/dev-io.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 8a9ed5c..dd65c3d 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -200,6 +200,7 @@ int dev_get_direct_block_sizes(struct device *dev, unsigned int *physical_block_
do_close = 1;
}
+#ifdef BLKPBSZGET /* not defined before kernel version 2.6.32 (e.g. rhel5) */
/*
* BLKPBSZGET from kernel comment for blk_queue_physical_block_size:
* "the lowest possible sector size that the hardware can operate on
@@ -209,6 +210,7 @@ int dev_get_direct_block_sizes(struct device *dev, unsigned int *physical_block_
stack;
pbs = 0;
}
+#endif
/*
* BLKSSZGET from kernel comment for blk_queue_logical_block_size:
4 years, 8 months
master - devices: clean up block size functions
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=09bc2d0fd15a5bbb5d1...
Commit: 09bc2d0fd15a5bbb5d1e8d6ce79bd786ffed42b3
Parent: bec3088f85a9a2d0b6a355aea1adc67fab8de6e9
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 7 11:38:06 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Aug 7 11:48:10 2019 -0500
devices: clean up block size functions
Replace calls to the old dev_get_block_size function
with calls to the new dev_get_direct_block_size function,
and remove the old function.
---
lib/device/dev-cache.c | 2 -
lib/device/dev-io.c | 73 -----------------------------------------------
lib/device/device.h | 3 --
lib/locking/lvmlockd.c | 10 +++---
lib/metadata/metadata.c | 25 ++++++++--------
5 files changed, 18 insertions(+), 95 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 980dd3c..a15e239 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -64,8 +64,6 @@ static int _insert(const char *path, const struct stat *info,
/* Setup non-zero members of passed zeroed 'struct device' */
static void _dev_init(struct device *dev)
{
- dev->phys_block_size = -1;
- dev->block_size = -1;
dev->fd = -1;
dev->read_ahead = -1;
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 5fa0b7a..8a9ed5c 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -53,77 +53,6 @@
static unsigned _dev_size_seqno = 1;
-/*
- * Get the physical and logical block size for a device.
- */
-int dev_get_block_size(struct device *dev, unsigned int *physical_block_size, unsigned int *block_size)
-{
- const char *name = dev_name(dev);
- int fd = dev->bcache_fd;
- int do_close = 0;
- int r = 1;
-
- if ((dev->phys_block_size > 0) && (dev->block_size > 0)) {
- *physical_block_size = (unsigned int)dev->phys_block_size;
- *block_size = (unsigned int)dev->block_size;
- return 1;
- }
-
- if (fd <= 0) {
- if (!dev->open_count) {
- if (!dev_open_readonly(dev))
- return_0;
- do_close = 1;
- }
- fd = dev_fd(dev);
- }
-
- if (dev->block_size == -1) {
- if (ioctl(fd, BLKBSZGET, &dev->block_size) < 0) {
- log_sys_error("ioctl BLKBSZGET", name);
- r = 0;
- goto out;
- }
- log_debug_devs("%s: Block size is %u bytes", name, dev->block_size);
- }
-
-#ifdef BLKPBSZGET
- /* BLKPBSZGET is available in kernel >= 2.6.32 only */
- if (dev->phys_block_size == -1) {
- if (ioctl(fd, BLKPBSZGET, &dev->phys_block_size) < 0) {
- log_sys_error("ioctl BLKPBSZGET", name);
- r = 0;
- goto out;
- }
- log_debug_devs("%s: Physical block size is %u bytes", name, dev->phys_block_size);
- }
-#elif defined (BLKSSZGET)
- /* if we can't get physical block size, just use logical block size instead */
- if (dev->phys_block_size == -1) {
- if (ioctl(fd, BLKSSZGET, &dev->phys_block_size) < 0) {
- log_sys_error("ioctl BLKSSZGET", name);
- r = 0;
- goto out;
- }
- log_debug_devs("%s: Physical block size can't be determined: Using logical block size of %u bytes", name, dev->phys_block_size);
- }
-#else
- /* if even BLKSSZGET is not available, use default 512b */
- if (dev->phys_block_size == -1) {
- dev->phys_block_size = 512;
- log_debug_devs("%s: Physical block size can't be determined: Using block size of %u bytes instead", name, dev->phys_block_size);
- }
-#endif
-
- *physical_block_size = (unsigned int) dev->phys_block_size;
- *block_size = (unsigned int) dev->block_size;
-out:
- if (do_close && !dev_close_immediate(dev))
- stack;
-
- return r;
-}
-
static int _dev_get_size_file(struct device *dev, uint64_t *size)
{
const char *name = dev_name(dev);
@@ -515,8 +444,6 @@ static void _close(struct device *dev)
if (close(dev->fd))
log_sys_error("close", dev_name(dev));
dev->fd = -1;
- dev->phys_block_size = -1;
- dev->block_size = -1;
log_debug_devs("Closed %s", dev_name(dev));
diff --git a/lib/device/device.h b/lib/device/device.h
index bb65f84..bd3b355 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -67,8 +67,6 @@ struct device {
/* private */
int fd;
int open_count;
- int phys_block_size; /* From either BLKPBSZGET or BLKSSZGET, don't use */
- int block_size; /* From BLKBSZGET, returns bdev->bd_block_size, likely set by fs, probably don't use */
int physical_block_size; /* From BLKPBSZGET: lowest possible sector size that the hardware can operate on without reverting to read-modify-write operations */
int logical_block_size; /* From BLKSSZGET: lowest possible block size that the storage device can address */
int read_ahead;
@@ -133,7 +131,6 @@ void dev_size_seqno_inc(void);
/*
* All io should use these routines.
*/
-int dev_get_block_size(struct device *dev, unsigned int *phys_block_size, unsigned int *block_size);
int dev_get_direct_block_sizes(struct device *dev, unsigned int *physical_block_size,
unsigned int *logical_block_size);
int dev_get_size(struct device *dev, uint64_t *size);
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 5ef3c94..612de5d 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -636,7 +636,7 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
struct pv_list *pvl;
struct device *sector_dev;
uint32_t sector_size = 0;
- unsigned int phys_block_size, block_size;
+ unsigned int physical_block_size, logical_block_size;
int num_mb = 0;
int result;
int ret;
@@ -653,14 +653,14 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
*/
dm_list_iterate_items(pvl, &vg->pvs) {
- if (!dev_get_block_size(pvl->pv->dev, &phys_block_size, &block_size))
+ if (!dev_get_direct_block_sizes(pvl->pv->dev, &physical_block_size, &logical_block_size))
continue;
if (!sector_size) {
- sector_size = phys_block_size;
+ sector_size = logical_block_size;
sector_dev = pvl->pv->dev;
- } else if (sector_size != phys_block_size) {
- log_error("Inconsistent sector sizes for %s and %s.",
+ } else if (sector_size != logical_block_size) {
+ log_error("Inconsistent logical block sizes for %s and %s.",
dev_name(pvl->pv->dev), dev_name(sector_dev));
return 0;
}
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index e55adc2..0f5154d 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -679,20 +679,21 @@ int vg_remove(struct volume_group *vg)
}
int check_dev_block_size_for_vg(struct device *dev, const struct volume_group *vg,
- unsigned int *max_phys_block_size_found)
+ unsigned int *max_logical_block_size_found)
{
- unsigned int phys_block_size, block_size;
+ unsigned int physical_block_size, logical_block_size;
- if (!(dev_get_block_size(dev, &phys_block_size, &block_size)))
+ if (!(dev_get_direct_block_sizes(dev, &physical_block_size, &logical_block_size)))
return_0;
- if (phys_block_size > *max_phys_block_size_found)
- *max_phys_block_size_found = phys_block_size;
+ /* FIXME: max_logical_block_size_found does not seem to be used anywhere */
+ if (logical_block_size > *max_logical_block_size_found)
+ *max_logical_block_size_found = logical_block_size;
- if (phys_block_size >> SECTOR_SHIFT > vg->extent_size) {
+ if (logical_block_size >> SECTOR_SHIFT > vg->extent_size) {
log_error("Physical extent size used for volume group %s "
- "is less than physical block size that %s uses.",
- vg->name, dev_name(dev));
+ "is less than logical block size (%u bytes) that %s uses.",
+ vg->name, logical_block_size, dev_name(dev));
return 0;
}
@@ -702,10 +703,10 @@ int check_dev_block_size_for_vg(struct device *dev, const struct volume_group *v
int vg_check_pv_dev_block_sizes(const struct volume_group *vg)
{
struct pv_list *pvl;
- unsigned int max_phys_block_size_found = 0;
+ unsigned int max_logical_block_size_found = 0;
dm_list_iterate_items(pvl, &vg->pvs) {
- if (!check_dev_block_size_for_vg(pvl->pv->dev, vg, &max_phys_block_size_found))
+ if (!check_dev_block_size_for_vg(pvl->pv->dev, vg, &max_logical_block_size_found))
return 0;
}
@@ -750,7 +751,7 @@ int check_pv_dev_sizes(struct volume_group *vg)
int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_params *pp)
{
struct pv_list *pvl;
- unsigned int max_phys_block_size = 0;
+ unsigned int max_logical_block_size = 0;
unsigned int physical_block_size, logical_block_size;
unsigned int prev_lbs = 0;
int inconsistent_existing_lbs = 0;
@@ -790,7 +791,7 @@ int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_params *pp)
if (!(check_dev_block_size_for_vg(pvl->pv->dev,
(const struct volume_group *) vg,
- &max_phys_block_size))) {
+ &max_logical_block_size))) {
log_error("PV %s has wrong block size.", pv_dev_name(pvl->pv));
return 0;
}
4 years, 8 months