!14 update lvm2 LTS version to 2.03.09
Merge pull request !14 from wguanghao/develop
This commit is contained in:
commit
c3d277a046
@ -1,19 +1,8 @@
|
||||
From 2327f3997bfb70d67299f3dfa45436132e0a8521 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Wed, 11 Sep 2019 13:52:51 -0500
|
||||
Subject: [PATCH] lvm2 set default preferred names
|
||||
|
||||
Signed-off-by: David Teigland <teigland@redhat.com>
|
||||
---
|
||||
conf/example.conf.in | 2 +-
|
||||
lib/config/config_settings.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/conf/example.conf.in b/conf/example.conf.in
|
||||
index c0afcb7..ec12918 100644
|
||||
index 05b0857..7f0a687 100644
|
||||
--- a/conf/example.conf.in
|
||||
+++ b/conf/example.conf.in
|
||||
@@ -106,7 +106,7 @@ devices {
|
||||
@@ -122,7 +122,7 @@ devices {
|
||||
# Example
|
||||
# preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
|
||||
#
|
||||
@ -23,11 +12,11 @@ index c0afcb7..ec12918 100644
|
||||
# Configuration option devices/filter.
|
||||
# Limit the block devices that are used by LVM commands.
|
||||
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
|
||||
index 9017043..c06b6f0 100644
|
||||
index 2bb72ba..f280156 100644
|
||||
--- a/lib/config/config_settings.h
|
||||
+++ b/lib/config/config_settings.h
|
||||
@@ -205,7 +205,7 @@ cfg(devices_external_device_info_source_CFG, "external_device_info_source", devi
|
||||
" compiled with udev support.\n"
|
||||
@@ -269,7 +269,7 @@ cfg(devices_hints_CFG, "hints", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_
|
||||
" Use no hints.\n"
|
||||
"#\n")
|
||||
|
||||
-cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED , CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL, 0, NULL,
|
||||
@ -1,25 +1,21 @@
|
||||
conf/example.conf.in | 2 +-
|
||||
lib/config/defaults.h | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/conf/example.conf.in b/conf/example.conf.in
|
||||
index 4894d04..48afbd1 100644
|
||||
index 7f0a687..39b5507 100644
|
||||
--- a/conf/example.conf.in
|
||||
+++ b/conf/example.conf.in
|
||||
@@ -311,7 +311,7 @@ devices {
|
||||
@@ -346,7 +346,7 @@ devices {
|
||||
# or activating LVs in it while a PV appears on multiple devices.
|
||||
# Enabling this setting allows the VG to be used as usual even with
|
||||
# uncertain devices.
|
||||
- allow_changes_with_duplicate_pvs = 0
|
||||
+ allow_changes_with_duplicate_pvs = 1
|
||||
}
|
||||
|
||||
# Configuration section allocation.
|
||||
# Configuration option devices/allow_mixed_block_sizes.
|
||||
# Allow PVs in the same VG with different logical block sizes.
|
||||
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
|
||||
index d9e19d9..894b979 100644
|
||||
index be4f5ff..3f0539e 100644
|
||||
--- a/lib/config/defaults.h
|
||||
+++ b/lib/config/defaults.h
|
||||
@@ -45,7 +45,7 @@
|
||||
@@ -56,7 +56,7 @@
|
||||
#define DEFAULT_DATA_ALIGNMENT_DETECTION 1
|
||||
#define DEFAULT_ISSUE_DISCARDS 0
|
||||
#define DEFAULT_PV_MIN_SIZE_KB 2048
|
||||
33
0003-cov-check-result-of-dev_read_bytes.patch
Normal file
33
0003-cov-check-result-of-dev_read_bytes.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 10d448be7aa5dcdafcd4dabc782ce7308af89c30 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Kabelac <zkabelac@redhat.com>
|
||||
Date: Tue, 25 Jun 2019 14:50:05 +0200
|
||||
Subject: [PATCH] cov: check result of dev_read_bytes
|
||||
|
||||
---
|
||||
lib/format_text/format-text.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
|
||||
index 268bd64..7385da5 100644
|
||||
--- a/lib/format_text/format-text.c
|
||||
+++ b/lib/format_text/format-text.c
|
||||
@@ -1545,9 +1545,13 @@ int read_metadata_location_summary(const struct format_type *fmt,
|
||||
|
||||
memset(namebuf, 0, sizeof(namebuf));
|
||||
|
||||
- if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf))
|
||||
- stack;
|
||||
-
|
||||
+ if (!dev_read_bytes(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, namebuf)) {
|
||||
+ log_error("Can't read metadata location on %s at %llu.",
|
||||
+ dev_name(dev_area->dev),
|
||||
+ (unsigned long long)(dev_area->start + rlocn->offset));
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
while (namebuf[len] && !isspace(namebuf[len]) && namebuf[len] != '{' &&
|
||||
len < (NAME_LEN - 1))
|
||||
len++;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
31
0004-devs-check-for-no-dev-when-dropping-aliases.patch
Normal file
31
0004-devs-check-for-no-dev-when-dropping-aliases.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From f50af80199f723f7b1970ee33ddf959ea79fcbef Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Wed, 16 Oct 2019 13:32:28 -0500
|
||||
Subject: [PATCH 134/180] devs: check for no dev when dropping aliases
|
||||
|
||||
When scanning fails to find a device path and
|
||||
looks for device aliases, check if the device
|
||||
itself still exists to avoid a potential segfault.
|
||||
---
|
||||
lib/label/label.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/lib/label/label.c b/lib/label/label.c
|
||||
index 8107e33..e4a1068 100644
|
||||
--- a/lib/label/label.c
|
||||
+++ b/lib/label/label.c
|
||||
@@ -734,6 +734,11 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
|
||||
retried_open = 1;
|
||||
|
||||
dm_list_iterate_items_safe(devl, devl2, &reopen_devs) {
|
||||
+ if (!devl->dev) {
|
||||
+ dm_list_del(&devl->list);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
_drop_bad_aliases(devl->dev);
|
||||
|
||||
if (dm_list_empty(&devl->dev->aliases)) {
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
From 0f30a9d3c2619cbaba323524f7aa9c9c4b01bcdd Mon Sep 17 00:00:00 2001
|
||||
From 61a4f8a2f360b244a2cae2eb39eb7bd3b72ca6b6 Mon Sep 17 00:00:00 2001
|
||||
From: geruijun <geruijun@huawei.com>
|
||||
Date: Thu, 14 Feb 2019 04:55:01 -0500
|
||||
Subject: [PATCH] lvm2: add 0002-bugfix-lvm2-add-SSD.patch
|
||||
@ -9,17 +9,17 @@ Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/conf/example.conf.in b/conf/example.conf.in
|
||||
index 32267e7..1f7b264 100644
|
||||
index 39b5507..5d8f8dd 100644
|
||||
--- a/conf/example.conf.in
|
||||
+++ b/conf/example.conf.in
|
||||
@@ -149,6 +149,7 @@ devices {
|
||||
@@ -164,6 +164,7 @@ devices {
|
||||
# global_filter are not opened by LVM.
|
||||
# This configuration option has an automatic default value.
|
||||
# global_filter = [ "a|.*/|" ]
|
||||
# global_filter = [ "a|.*|" ]
|
||||
+ types = [ "hio", 16 ]
|
||||
|
||||
# Configuration option devices/cache_dir.
|
||||
# Directory in which to store the device cache file.
|
||||
# Configuration option devices/types.
|
||||
# List of additional acceptable block device types.
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -1,46 +1,8 @@
|
||||
From beb01e5eeb2c913854f9df104af089be274eff59 Mon Sep 17 00:00:00 2001
|
||||
From: wangjufeng <wangjufeng@huawei.com>
|
||||
Date: Wed, 15 Apr 2020 21:25:28 +0800
|
||||
Subject: [PATCH] add timeout when fail to wait udev
|
||||
|
||||
Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
---
|
||||
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
|
||||
index 40b366b..0b03106 100644
|
||||
--- a/libdm/libdm-common.c
|
||||
+++ b/libdm/libdm-common.c
|
||||
@@ -59,6 +59,7 @@ union semun
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#define UDEV_SEM_TIMEOUT 300
|
||||
static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
|
||||
static char _sysfs_dir[PATH_MAX] = "/sys/";
|
||||
static char _path0[PATH_MAX]; /* path buffer, safe 4kB on stack */
|
||||
@@ -2611,6 +2612,9 @@ static int _udev_wait(uint32_t cookie, int *nowait)
|
||||
int semid;
|
||||
struct sembuf sb = {0, 0, 0};
|
||||
int val;
|
||||
+ struct timespec timeout;
|
||||
+ timeout.tv_sec = UDEV_SEM_TIMEOUT;
|
||||
+ timeout.tv_nsec = 0;
|
||||
|
||||
if (!cookie || !dm_udev_get_sync_support())
|
||||
return 1;
|
||||
@@ -2646,7 +2650,7 @@ static int _udev_wait(uint32_t cookie, int *nowait)
|
||||
cookie, semid);
|
||||
|
||||
repeat_wait:
|
||||
- if (semop(semid, &sb, 1) < 0) {
|
||||
+ if (semtimedop(semid, &sb, 1,&timeout) < 0) {
|
||||
if (errno == EINTR)
|
||||
goto repeat_wait;
|
||||
else if (errno == EIDRM)
|
||||
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
|
||||
index 3cdf862..af70a02 100644
|
||||
--- a/tools/dmsetup.c
|
||||
+++ b/tools/dmsetup.c
|
||||
@@ -1131,6 +1131,7 @@ out:
|
||||
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
|
||||
index d01b8f2..a5cb551 100644
|
||||
--- a/libdm/dm-tools/dmsetup.c
|
||||
+++ b/libdm/dm-tools/dmsetup.c
|
||||
@@ -1130,6 +1130,7 @@ out:
|
||||
static int _create_one_device(const char *name, const char *file)
|
||||
{
|
||||
int r = 0;
|
||||
@ -48,7 +10,7 @@ index 3cdf862..af70a02 100644
|
||||
struct dm_task *dmt;
|
||||
uint32_t cookie = 0;
|
||||
uint16_t udev_flags = 0;
|
||||
@@ -1203,13 +1204,16 @@ static int _create_one_device(const char *name, const char *file)
|
||||
@@ -1202,13 +1203,15 @@ static int _create_one_device(const char *name, const char *file)
|
||||
|
||||
out:
|
||||
if (!_udev_cookie)
|
||||
@ -60,13 +22,12 @@ index 3cdf862..af70a02 100644
|
||||
|
||||
dm_task_destroy(dmt);
|
||||
|
||||
+ if(!udev_wait_r)
|
||||
+ if (!udev_wait_r)
|
||||
+ return 0;
|
||||
+
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -1430,6 +1434,7 @@ static int _create(CMD_ARGS)
|
||||
@@ -1431,6 +1434,7 @@ static int _create(CMD_ARGS)
|
||||
|
||||
static int _do_rename(const char *name, const char *new_name, const char *new_uuid) {
|
||||
int r = 0;
|
||||
@ -74,12 +35,12 @@ index 3cdf862..af70a02 100644
|
||||
struct dm_task *dmt;
|
||||
uint32_t cookie = 0;
|
||||
uint16_t udev_flags = 0;
|
||||
@@ -1474,10 +1479,13 @@ static int _do_rename(const char *name, const char *new_name, const char *new_uu
|
||||
@@ -1475,10 +1479,13 @@ static int _do_rename(const char *name, const char *new_name, const char *new_uu
|
||||
|
||||
out:
|
||||
if (!_udev_cookie)
|
||||
- (void) dm_udev_wait(cookie);
|
||||
+ udev_wait_r = dm_udev_wait(cookie);
|
||||
+ udev_wait_r = dm_udev_wait(cookie);
|
||||
|
||||
dm_task_destroy(dmt);
|
||||
|
||||
@ -89,7 +50,7 @@ index 3cdf862..af70a02 100644
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -1997,6 +2005,7 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
|
||||
@@ -1999,6 +2006,7 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
|
||||
int udev_wait_flag = task == DM_DEVICE_RESUME ||
|
||||
task == DM_DEVICE_REMOVE;
|
||||
int r = 0;
|
||||
@ -97,7 +58,7 @@ index 3cdf862..af70a02 100644
|
||||
|
||||
struct dm_task *dmt;
|
||||
|
||||
@@ -2056,13 +2065,16 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
|
||||
@@ -2058,13 +2066,16 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
|
||||
|
||||
out:
|
||||
if (!_udev_cookie && udev_wait_flag)
|
||||
@ -109,9 +70,40 @@ index 3cdf862..af70a02 100644
|
||||
|
||||
dm_task_destroy(dmt);
|
||||
|
||||
+ if(!udev_wait_r)
|
||||
+ if (!udev_wait_r)
|
||||
+ return 0;
|
||||
+
|
||||
return r;
|
||||
}
|
||||
|
||||
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
|
||||
index d75c704..e7c00f0 100644
|
||||
--- a/libdm/libdm-common.c
|
||||
+++ b/libdm/libdm-common.c
|
||||
@@ -59,6 +59,7 @@ union semun
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#define UDEV_SEM_TIMEOUT 300
|
||||
static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR;
|
||||
static char _sysfs_dir[PATH_MAX] = "/sys/";
|
||||
static char _path0[PATH_MAX]; /* path buffer, safe 4kB on stack */
|
||||
@@ -2730,6 +2731,9 @@ static int _udev_wait(uint32_t cookie, int *nowait)
|
||||
int semid;
|
||||
struct sembuf sb = {0, 0, 0};
|
||||
int val;
|
||||
+ struct timespec timeout;
|
||||
+ timeout.tv_sec = UDEV_SEM_TIMEOUT;
|
||||
+ timeout.tv_nsec = 0;
|
||||
|
||||
if (!cookie || !dm_udev_get_sync_support())
|
||||
return 1;
|
||||
@@ -2765,7 +2769,7 @@ static int _udev_wait(uint32_t cookie, int *nowait)
|
||||
cookie, semid);
|
||||
|
||||
repeat_wait:
|
||||
- if (semop(semid, &sb, 1) < 0) {
|
||||
+ if (semtimedop(semid, &sb, 1,&timeout) < 0) {
|
||||
if (errno == EINTR)
|
||||
goto repeat_wait;
|
||||
else if (errno == EIDRM)
|
||||
@ -0,0 +1,13 @@
|
||||
diff --git a/tools/command.c b/tools/command.c
|
||||
index 50791b1..3270b26 100644
|
||||
--- a/tools/command.c
|
||||
+++ b/tools/command.c
|
||||
@@ -1375,7 +1375,7 @@ static int _copy_line(char *line, int max_line, int *position)
|
||||
|
||||
memset(line, 0, max_line);
|
||||
|
||||
- while (1) {
|
||||
+ while ( p < strlen(_command_input) ) {
|
||||
line[i] = _command_input[p];
|
||||
i++;
|
||||
p++;
|
||||
@ -1,12 +1,13 @@
|
||||
From 2f257461191b97e47a716f0cd0374e174041ddef Mon Sep 17 00:00:00 2001
|
||||
From: wangjufeng <wangjufeng@huawei.com>
|
||||
From fd36f54943e58db6483472519c118bde68b6ee60 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Tue, 19 Mar 2019 16:43:16 +0800
|
||||
Subject: [PATCH 2/2] add dfx log when error occur, or lvm resource change, it
|
||||
will print the cmdline and ppid
|
||||
Subject: [PATCH] add dfx log when error occur, or lvm resource change, it will
|
||||
print the cmdline and ppid
|
||||
|
||||
Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
---
|
||||
conf/example.conf.in | 5 +++++
|
||||
conf/example.conf.in | 4 ++++
|
||||
conf/example.conf.in.rej | 13 +++++++++++++
|
||||
lib/commands/toolcontext.c | 16 ++++++++++++++++
|
||||
lib/commands/toolcontext.h | 4 ++++
|
||||
lib/config/config_settings.h | 5 +++++
|
||||
@ -15,29 +16,49 @@ Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
lib/misc/lvm-globals.c | 12 ++++++++++++
|
||||
lib/misc/lvm-globals.h | 2 ++
|
||||
tools/lvmcmdline.c | 1 +
|
||||
9 files changed, 67 insertions(+), 3 deletions(-)
|
||||
|
||||
10 files changed, 78 insertions(+), 3 deletions(-)
|
||||
create mode 100644 conf/example.conf.in.rej
|
||||
|
||||
diff --git a/conf/example.conf.in b/conf/example.conf.in
|
||||
index 282cdb7..8c5db9c 100644
|
||||
index f310789..d715d12 100644
|
||||
--- a/conf/example.conf.in
|
||||
+++ b/conf/example.conf.in
|
||||
@@ -601,6 +601,11 @@ log {
|
||||
@@ -775,6 +775,10 @@ log {
|
||||
# There are 6 syslog-like log levels currently in use: 2 to 7 inclusive.
|
||||
# 7 is the most verbose (LOG_DEBUG).
|
||||
level = 3
|
||||
|
||||
+ #When the level of log messages is set as 2 or 3, set log_unless_silent
|
||||
+ #to 1, it will also log some important warning level messages, such as,
|
||||
+ #create/delete/change a lv/vg/pv, 0 is close this option.
|
||||
+ log_unless_silent = 1
|
||||
+
|
||||
|
||||
# Configuration option log/indent.
|
||||
# Indent messages according to their severity.
|
||||
indent = 1
|
||||
diff --git a/conf/example.conf.in.rej b/conf/example.conf.in.rej
|
||||
new file mode 100644
|
||||
index 0000000..d90332a
|
||||
--- /dev/null
|
||||
+++ b/conf/example.conf.in.rej
|
||||
@@ -0,0 +1,13 @@
|
||||
+diff a/conf/example.conf.in b/conf/example.conf.in (rejected hunks)
|
||||
+@@ -587,6 +587,11 @@ log {
|
||||
+ # 7 is the most verbose (LOG_DEBUG).
|
||||
+ level = 3
|
||||
+
|
||||
++ #When the level of log messages is set as 2 or 3, set log_unless_silent
|
||||
++ #to 1, it will also log some important warning level messages, such as,
|
||||
++ #create/delete/change a lv/vg/pv, 0 is close this option.
|
||||
++ log_unless_silent = 1
|
||||
++
|
||||
+ # Configuration option log/indent.
|
||||
+ # Indent messages according to their severity.
|
||||
+ indent = 1
|
||||
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||
index 95fb343..19009f1 100644
|
||||
index 479d499..894c91d 100644
|
||||
--- a/lib/commands/toolcontext.c
|
||||
+++ b/lib/commands/toolcontext.c
|
||||
@@ -49,6 +49,8 @@
|
||||
@@ -46,6 +46,8 @@
|
||||
|
||||
static const size_t _linebuffer_size = 4096;
|
||||
|
||||
@ -46,7 +67,7 @@ index 95fb343..19009f1 100644
|
||||
/*
|
||||
* Copy the input string, removing invalid characters.
|
||||
*/
|
||||
@@ -314,6 +316,9 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
@@ -348,6 +350,9 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
find_config_tree_bool(cmd, log_silent_CFG, NULL);
|
||||
init_silent(cmd->default_settings.silent);
|
||||
|
||||
@ -56,7 +77,7 @@ index 95fb343..19009f1 100644
|
||||
/* Verbose level for tty output */
|
||||
cmd->default_settings.verbose = find_config_tree_int(cmd, log_verbose_CFG, NULL);
|
||||
init_verbose(cmd->default_settings.verbose + VERBOSE_BASE_LEVEL);
|
||||
@@ -2256,6 +2261,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||
@@ -1962,6 +1967,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||
_destroy_segtypes(&cmd->segtypes);
|
||||
_destroy_formats(cmd, &cmd->formats);
|
||||
_destroy_filters(cmd);
|
||||
@ -64,7 +85,7 @@ index 95fb343..19009f1 100644
|
||||
if (cmd->mem)
|
||||
dm_pool_destroy(cmd->mem);
|
||||
dev_cache_exit();
|
||||
@@ -2311,3 +2317,13 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||
@@ -2014,3 +2020,13 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
||||
fin_syslog();
|
||||
reset_lvm_errno(0);
|
||||
}
|
||||
@ -79,10 +100,10 @@ index 95fb343..19009f1 100644
|
||||
+ global_cmdline = cmdline;
|
||||
+}
|
||||
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
|
||||
index 497f4bd..954832e 100644
|
||||
index c09558a..a91174d 100644
|
||||
--- a/lib/commands/toolcontext.h
|
||||
+++ b/lib/commands/toolcontext.h
|
||||
@@ -48,6 +48,7 @@ struct config_info {
|
||||
@@ -47,6 +47,7 @@ struct config_info {
|
||||
mode_t umask;
|
||||
char unit_type;
|
||||
char _padding[1];
|
||||
@ -90,7 +111,7 @@ index 497f4bd..954832e 100644
|
||||
};
|
||||
|
||||
struct dm_config_tree;
|
||||
@@ -268,4 +269,7 @@ struct format_type *get_format_by_name(struct cmd_context *cmd, const char *form
|
||||
@@ -275,4 +276,7 @@ struct format_type *get_format_by_name(struct cmd_context *cmd, const char *form
|
||||
|
||||
const char *system_id_from_string(struct cmd_context *cmd, const char *str);
|
||||
|
||||
@ -99,10 +120,10 @@ index 497f4bd..954832e 100644
|
||||
+void set_global_cmdline(char *cmdline);
|
||||
#endif
|
||||
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
|
||||
index 429bff1..5f28a13 100644
|
||||
index f280156..1b05163 100644
|
||||
--- a/lib/config/config_settings.h
|
||||
+++ b/lib/config/config_settings.h
|
||||
@@ -704,6 +704,11 @@ cfg(log_level_CFG, "level", log_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_LOGLEVEL,
|
||||
@@ -850,6 +850,11 @@ cfg(log_level_CFG, "level", log_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_LOGLEVEL,
|
||||
"There are 6 syslog-like log levels currently in use: 2 to 7 inclusive.\n"
|
||||
"7 is the most verbose (LOG_DEBUG).\n")
|
||||
|
||||
@ -111,22 +132,22 @@ index 429bff1..5f28a13 100644
|
||||
+ "to 1, it will also log some important warning level messages, such as,\n"
|
||||
+ "create/delete/change a lv/vg/pv, 0 is close this option.\n")
|
||||
+
|
||||
cfg(log_indent_CFG, "indent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_INDENT, vsn(1, 0, 0), NULL, 0, NULL,
|
||||
cfg(log_indent_CFG, "indent", log_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_INDENT, vsn(1, 0, 0), NULL, 0, NULL,
|
||||
"Indent messages according to their severity.\n")
|
||||
|
||||
diff --git a/lib/log/log.c b/lib/log/log.c
|
||||
index 79fbd7a..d34e160 100644
|
||||
index ebf26b4..136959e 100644
|
||||
--- a/lib/log/log.c
|
||||
+++ b/lib/log/log.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "defaults.h"
|
||||
#include "report.h"
|
||||
#include "lvm-file.h"
|
||||
+#include "toolcontext.h"
|
||||
#include "lib/config/defaults.h"
|
||||
#include "lib/report/report.h"
|
||||
#include "lib/misc/lvm-file.h"
|
||||
+#include "lib/commands/toolcontext.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
@@ -478,6 +479,7 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
@@ -494,6 +495,7 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
const char *trformat; /* Translated format string */
|
||||
char *newbuf;
|
||||
int use_stderr = log_stderr(level);
|
||||
@ -134,7 +155,7 @@ index 79fbd7a..d34e160 100644
|
||||
int log_once = log_once(level);
|
||||
int log_bypass_report = log_bypass_report(level);
|
||||
int fatal_internal_error = 0;
|
||||
@@ -490,7 +492,9 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
@@ -506,7 +508,9 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
struct dm_report *orig_report;
|
||||
int logged_via_report = 0;
|
||||
|
||||
@ -144,7 +165,7 @@ index 79fbd7a..d34e160 100644
|
||||
|
||||
if (_abort_on_internal_errors_env_present < 0) {
|
||||
if ((env_str = getenv("DM_ABORT_ON_INTERNAL_ERRORS"))) {
|
||||
@@ -632,8 +636,8 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
@@ -670,8 +674,8 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@ -155,7 +176,7 @@ index 79fbd7a..d34e160 100644
|
||||
if (fatal_internal_error)
|
||||
abort();
|
||||
return;
|
||||
@@ -661,6 +665,19 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
@@ -714,6 +718,19 @@ static void _vprint_log(int level, const char *file, int line, int dm_errno_or_c
|
||||
|
||||
if (_syslog && (_log_while_suspended || !critical_section())) {
|
||||
va_copy(ap, orig_ap);
|
||||
@ -176,7 +197,7 @@ index 79fbd7a..d34e160 100644
|
||||
va_end(ap);
|
||||
}
|
||||
diff --git a/lib/log/log.h b/lib/log/log.h
|
||||
index 256fed0..7c22859 100644
|
||||
index d3848a4..07f2eb4 100644
|
||||
--- a/lib/log/log.h
|
||||
+++ b/lib/log/log.h
|
||||
@@ -50,6 +50,8 @@
|
||||
@ -188,7 +209,7 @@ index 256fed0..7c22859 100644
|
||||
#define log_level(x) ((x) & 0x0f) /* obtain message level */
|
||||
#define log_stderr(x) ((x) & _LOG_STDERR) /* obtain stderr bit */
|
||||
#define log_once(x) ((x) & _LOG_ONCE) /* obtain once bit */
|
||||
@@ -100,7 +102,7 @@
|
||||
@@ -107,7 +109,7 @@
|
||||
#define log_very_verbose(args...) log_info(args)
|
||||
#define log_verbose(args...) log_notice(args)
|
||||
#define log_print(args...) LOG_LINE(_LOG_WARN, args)
|
||||
@ -198,10 +219,10 @@ index 256fed0..7c22859 100644
|
||||
#define log_error_suppress(s, args...) log_err_suppress(s, args)
|
||||
#define log_error_once(args...) log_err_once(args)
|
||||
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
|
||||
index 35faf83..8cd7708 100644
|
||||
index 06855ff..37d2fae 100644
|
||||
--- a/lib/misc/lvm-globals.c
|
||||
+++ b/lib/misc/lvm-globals.c
|
||||
@@ -55,12 +55,24 @@ static int _dev_disable_after_error_count = DEFAULT_DISABLE_AFTER_ERROR_COUNT;
|
||||
@@ -54,12 +54,23 @@ static char _sysfs_dir_path[PATH_MAX] = "";
|
||||
static uint64_t _pv_min_size = (DEFAULT_PV_MIN_SIZE_KB * 1024L >> SECTOR_SHIFT);
|
||||
static const char *_unknown_device_name = DEFAULT_UNKNOWN_DEVICE_NAME;
|
||||
static int _io_memory_size_kb = DEFAULT_IO_MEMORY_SIZE_KB;
|
||||
@ -221,28 +242,26 @@ index 35faf83..8cd7708 100644
|
||||
+{
|
||||
+ return _log_unless_silent;
|
||||
+}
|
||||
+
|
||||
+
|
||||
void init_silent(int silent)
|
||||
{
|
||||
_silent = silent;
|
||||
diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h
|
||||
index 27d1919..fc569af 100644
|
||||
index a54001c..8ae55f6 100644
|
||||
--- a/lib/misc/lvm-globals.h
|
||||
+++ b/lib/misc/lvm-globals.h
|
||||
@@ -95,5 +95,7 @@ int dmeventd_monitor_mode(void);
|
||||
#define NO_DEV_ERROR_COUNT_LIMIT 0
|
||||
int dev_disable_after_error_count(void);
|
||||
@@ -89,4 +89,6 @@ int io_memory_size(void);
|
||||
#define DMEVENTD_MONITOR_IGNORE -1
|
||||
int dmeventd_monitor_mode(void);
|
||||
|
||||
+void init_log_unless_silent(int unless_silent);
|
||||
+int get_log_unless_silent(void);
|
||||
|
||||
#endif
|
||||
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
||||
index 9c39f48..a95224c 100644
|
||||
index f147be3..650eff8 100644
|
||||
--- a/tools/lvmcmdline.c
|
||||
+++ b/tools/lvmcmdline.c
|
||||
@@ -2808,6 +2808,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
@@ -2973,6 +2973,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
||||
/* The cmd_line string is only used for logging, not processing. */
|
||||
if (!(cmd->cmd_line = _copy_command_line(cmd, argc, argv)))
|
||||
return_ECMD_FAILED;
|
||||
@ -1,4 +1,4 @@
|
||||
From d644d7f2164022eec1a156761187488861dde056 Mon Sep 17 00:00:00 2001
|
||||
From e4c231700bd3f7f14dad8fe87cfc7b1179e4f3c0 Mon Sep 17 00:00:00 2001
|
||||
From: wangjufeng <wangjufeng@huawei.com>
|
||||
Date: Sat, 16 Nov 2019 17:47:19 +0800
|
||||
Subject: [PATCH] log it when disk slow
|
||||
@ -8,14 +8,13 @@ This patch help to log it when read or write disk take too much time.
|
||||
Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
---
|
||||
lib/device/dev-cache.c | 40 +++++++++++++++++++++++++++++++++++-----
|
||||
lib/device/dev-io.c | 17 +++++++++++++++++
|
||||
2 files changed, 52 insertions(+), 5 deletions(-)
|
||||
1 file changed, 35 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
|
||||
index 8af1de9..da8b9d0 100644
|
||||
index 6af559c..7c144d6 100644
|
||||
--- a/lib/device/dev-cache.c
|
||||
+++ b/lib/device/dev-cache.c
|
||||
@@ -57,6 +57,7 @@ static struct {
|
||||
@@ -58,6 +58,7 @@ static struct {
|
||||
#define _free(x) dm_pool_free(_cache.mem, (x))
|
||||
#define _strdup(x) dm_pool_strdup(_cache.mem, (x))
|
||||
|
||||
@ -23,7 +22,7 @@ index 8af1de9..da8b9d0 100644
|
||||
static int _insert(const char *path, const struct stat *info,
|
||||
int rec, int check_with_udev_db);
|
||||
|
||||
@@ -1062,12 +1063,23 @@ static int _device_in_udev_db(const dev_t d)
|
||||
@@ -1025,12 +1026,23 @@ static int _device_in_udev_db(const dev_t d)
|
||||
static int _insert_udev_dir(struct udev *udev, const char *dir)
|
||||
{
|
||||
struct udev_enumerate *udev_enum = NULL;
|
||||
@ -50,7 +49,7 @@ index 8af1de9..da8b9d0 100644
|
||||
log_error("Failed to udev_enumerate_new.");
|
||||
return 0;
|
||||
}
|
||||
@@ -1099,14 +1111,32 @@ static int _insert_udev_dir(struct udev *udev, const char *dir)
|
||||
@@ -1062,14 +1074,32 @@ static int _insert_udev_dir(struct udev *udev, const char *dir)
|
||||
entry_name);
|
||||
continue;
|
||||
}
|
||||
@ -85,55 +84,6 @@ index 8af1de9..da8b9d0 100644
|
||||
if (!(symlink_name = udev_list_entry_get_name(symlink_entry)))
|
||||
log_very_verbose("udev failed to return a symlink name for entry %s.",
|
||||
entry_name);
|
||||
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
|
||||
index 8bf1847..af273a2 100644
|
||||
--- a/lib/device/dev-io.c
|
||||
+++ b/lib/device/dev-io.c
|
||||
@@ -52,6 +52,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+static long dev_io_maxtime = 50000; // macroseconds
|
||||
+
|
||||
static unsigned _dev_size_seqno = 1;
|
||||
|
||||
static const char *_reasons[] = {
|
||||
@@ -81,6 +83,9 @@ static int _io(struct device_area *where, char *buffer, int should_write, dev_io
|
||||
int fd = dev_fd(where->dev);
|
||||
ssize_t n = 0;
|
||||
size_t total = 0;
|
||||
+ int ret = -1;
|
||||
+ struct timeval start, end;
|
||||
+ long time_use = 0;
|
||||
|
||||
if (fd < 0) {
|
||||
log_error("Attempt to read an unopened device (%s).",
|
||||
@@ -111,6 +116,7 @@ static int _io(struct device_area *where, char *buffer, int should_write, dev_io
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ ret = gettimeofday(&start,NULL);
|
||||
while (total < (size_t) where->size) {
|
||||
do
|
||||
n = should_write ?
|
||||
@@ -132,6 +138,17 @@ static int _io(struct device_area *where, char *buffer, int should_write, dev_io
|
||||
total += n;
|
||||
buffer += n;
|
||||
}
|
||||
+ if (!ret && !gettimeofday(&end,NULL)) {
|
||||
+ time_use = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec);
|
||||
+ if (time_use > dev_io_maxtime) {
|
||||
+ log_print_unless_silent("%s %s:%8" PRIu64 " bytes (sync) at %" PRIu64 "%s (for %s),"
|
||||
+ " spend %ld usec",
|
||||
+ should_write ? "Write" : "Read ", dev_name(where->dev),
|
||||
+ where->size, (uint64_t) where->start,
|
||||
+ (should_write && test_mode()) ? " (test mode - suppressed)" : "",
|
||||
+ _reason_text(reason), time_use);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
return (total == (size_t) where->size);
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
1.8.3.1
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
From 2327f3997bfb70d67299f3dfa45436132e0a8521 Mon Sep 17 00:00:00 2001
|
||||
From: David Teigland <teigland@redhat.com>
|
||||
Date: Wed, 11 Sep 2019 13:52:51 -0500
|
||||
Subject: [PATCH] lvm2 lvmetad timeout
|
||||
|
||||
Signed-off-by: David Teigland <teigland@redhat.com>
|
||||
---
|
||||
scripts/lvm2_lvmetad_systemd_red_hat.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
|
||||
index 8f4c60d..a1cedd2 100644
|
||||
--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
|
||||
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
|
||||
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
|
||||
[Service]
|
||||
Type=simple
|
||||
NonBlocking=true
|
||||
-ExecStart=@SBINDIR@/lvmetad -f
|
||||
+ExecStart=@SBINDIR@/lvmetad -f -t 3600
|
||||
Environment=SD_ACTIVATION=1
|
||||
Restart=on-abort
|
||||
PIDFile=@LVMETAD_PIDFILE@
|
||||
@ -1,194 +0,0 @@
|
||||
From 80f7f6e0fdd7672a3bbb781b5edbc73c0699c539 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 17:13:26 +0800
|
||||
Subject: [PATCH 01/19] Remove VG lock ordering check
|
||||
|
||||
Four commands lock two VGs at a time:
|
||||
|
||||
- vgsplit and vgmerge already have their own logic to
|
||||
acquire the locks in the correct order.
|
||||
|
||||
- vgimportclone and vgrename disable this ordering check.
|
||||
---
|
||||
lib/cache/lvmcache.c | 66 -------------------------------------------
|
||||
lib/cache/lvmcache.h | 1 -
|
||||
lib/locking/locking.c | 5 ----
|
||||
tools/toollib.c | 8 ------
|
||||
tools/vgimportclone.c | 4 ---
|
||||
tools/vgrename.c | 5 ----
|
||||
6 files changed, 89 deletions(-)
|
||||
|
||||
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
|
||||
index 3e681a2..1a2e987 100644
|
||||
--- a/lib/cache/lvmcache.c
|
||||
+++ b/lib/cache/lvmcache.c
|
||||
@@ -105,7 +105,6 @@ static int _has_scanned = 0;
|
||||
static int _vgs_locked = 0;
|
||||
static int _vg_global_lock_held = 0; /* Global lock held when cache wiped? */
|
||||
static int _found_duplicate_pvs = 0; /* If we never see a duplicate PV we can skip checking for them later. */
|
||||
-static int _suppress_lock_ordering = 0;
|
||||
|
||||
int lvmcache_init(struct cmd_context *cmd)
|
||||
{
|
||||
@@ -547,71 +546,6 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
|
||||
_drop_metadata(vgname, drop_precommitted);
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Ensure vgname2 comes after vgname1 alphabetically.
|
||||
- * Orphan locks come last.
|
||||
- * VG_GLOBAL comes first.
|
||||
- */
|
||||
-static int _vgname_order_correct(const char *vgname1, const char *vgname2)
|
||||
-{
|
||||
- if (is_global_vg(vgname1))
|
||||
- return 1;
|
||||
-
|
||||
- if (is_global_vg(vgname2))
|
||||
- return 0;
|
||||
-
|
||||
- if (is_orphan_vg(vgname1))
|
||||
- return 0;
|
||||
-
|
||||
- if (is_orphan_vg(vgname2))
|
||||
- return 1;
|
||||
-
|
||||
- if (strcmp(vgname1, vgname2) < 0)
|
||||
- return 1;
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-void lvmcache_lock_ordering(int enable)
|
||||
-{
|
||||
- _suppress_lock_ordering = !enable;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Ensure VG locks are acquired in alphabetical order.
|
||||
- */
|
||||
-int lvmcache_verify_lock_order(const char *vgname)
|
||||
-{
|
||||
- struct dm_hash_node *n;
|
||||
- const char *vgname2;
|
||||
-
|
||||
- if (_suppress_lock_ordering)
|
||||
- return 1;
|
||||
-
|
||||
- if (!_lock_hash)
|
||||
- return 1;
|
||||
-
|
||||
- dm_hash_iterate(n, _lock_hash) {
|
||||
- if (!dm_hash_get_data(_lock_hash, n))
|
||||
- return_0;
|
||||
-
|
||||
- if (!(vgname2 = dm_hash_get_key(_lock_hash, n))) {
|
||||
- log_error(INTERNAL_ERROR "VG lock %s hits NULL.",
|
||||
- vgname);
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (!_vgname_order_correct(vgname2, vgname)) {
|
||||
- log_errno(EDEADLK, INTERNAL_ERROR "VG lock %s must "
|
||||
- "be requested before %s, not after.",
|
||||
- vgname, vgname2);
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
void lvmcache_lock_vgname(const char *vgname, int read_only __attribute__((unused)))
|
||||
{
|
||||
if (dm_hash_lookup(_lock_hash, vgname))
|
||||
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
|
||||
index bf976e9..e9e6932 100644
|
||||
--- a/lib/cache/lvmcache.h
|
||||
+++ b/lib/cache/lvmcache.h
|
||||
@@ -87,7 +87,6 @@ int lvmcache_update_vg(struct volume_group *vg, unsigned precommitted);
|
||||
|
||||
void lvmcache_lock_vgname(const char *vgname, int read_only);
|
||||
void lvmcache_unlock_vgname(const char *vgname);
|
||||
-int lvmcache_verify_lock_order(const char *vgname);
|
||||
|
||||
/* Queries */
|
||||
const struct format_type *lvmcache_fmt_from_vgname(struct cmd_context *cmd, const char *vgname, const char *vgid, unsigned revalidate_labels);
|
||||
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
|
||||
index 2584227..093dbbd 100644
|
||||
--- a/lib/locking/locking.c
|
||||
+++ b/lib/locking/locking.c
|
||||
@@ -319,11 +319,6 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, const str
|
||||
/* Global VG_ORPHANS lock covers all orphan formats. */
|
||||
if (is_orphan_vg(vol))
|
||||
vol = VG_ORPHANS;
|
||||
- /* VG locks alphabetical, ORPHAN lock last */
|
||||
- if ((lck_type != LCK_UNLOCK) &&
|
||||
- !(flags & LCK_CACHE) &&
|
||||
- !lvmcache_verify_lock_order(vol))
|
||||
- return_0;
|
||||
|
||||
if ((flags == LCK_VG_DROP_CACHE) ||
|
||||
(strcmp(vol, VG_GLOBAL) && strcmp(vol, VG_SYNC_NAMES))) {
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index 01686b0..ce877cc 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -5514,14 +5514,6 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
||||
dm_list_add(&pp->arg_devices, &pd->list);
|
||||
}
|
||||
|
||||
- /*
|
||||
- * This function holds the orphans lock while reading VGs to look for
|
||||
- * devices. This means the orphans lock is held while VG locks are
|
||||
- * acquired, which is against lvmcache lock ordering rules, so disable
|
||||
- * the lvmcache lock ordering checks.
|
||||
- */
|
||||
- lvmcache_lock_ordering(0);
|
||||
-
|
||||
/*
|
||||
* Clear the cache before acquiring the orphan lock. (Clearing the
|
||||
* cache with locks held is an error.) We want the orphan lock
|
||||
diff --git a/tools/vgimportclone.c b/tools/vgimportclone.c
|
||||
index c4c5d4c..087078a 100644
|
||||
--- a/tools/vgimportclone.c
|
||||
+++ b/tools/vgimportclone.c
|
||||
@@ -342,9 +342,6 @@ retry_name:
|
||||
|
||||
log_debug("Changing VG %s to %s.", vp.old_vgname, vp.new_vgname);
|
||||
|
||||
- /* We don't care if the new name comes before the old in lock order. */
|
||||
- lvmcache_lock_ordering(0);
|
||||
-
|
||||
if (!lock_vol(cmd, vp.new_vgname, LCK_VG_WRITE, NULL)) {
|
||||
log_error("Can't get lock for new VG name %s", vp.new_vgname);
|
||||
goto out;
|
||||
@@ -363,7 +360,6 @@ out:
|
||||
unlock_vg(cmd, NULL, VG_GLOBAL);
|
||||
internal_filter_clear();
|
||||
init_internal_filtering(0);
|
||||
- lvmcache_lock_ordering(1);
|
||||
destroy_processing_handle(cmd, handle);
|
||||
|
||||
/* Enable lvmetad again if no duplicates are left. */
|
||||
diff --git a/tools/vgrename.c b/tools/vgrename.c
|
||||
index 4f2a08b..bbc3087 100644
|
||||
--- a/tools/vgrename.c
|
||||
+++ b/tools/vgrename.c
|
||||
@@ -99,13 +99,8 @@ static int _vgrename_single(struct cmd_context *cmd, const char *vg_name,
|
||||
* this uuid-for-name case.
|
||||
*/
|
||||
if (vp->lock_vg_old_first || vp->old_name_is_uuid) {
|
||||
- if (vp->old_name_is_uuid)
|
||||
- lvmcache_lock_ordering(0);
|
||||
-
|
||||
if (!_lock_new_vg_for_rename(cmd, vp->vg_name_new))
|
||||
return ECMD_FAILED;
|
||||
-
|
||||
- lvmcache_lock_ordering(1);
|
||||
}
|
||||
|
||||
dev_dir = cmd->dev_dir;
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,223 +0,0 @@
|
||||
From b71954e7599a651470e51020c9aa9205a1551ad5 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 17:23:43 +0800
|
||||
Subject: [PATCH 02/19] Fix use of orphan lock in commands
|
||||
|
||||
vgreduce, vgremove and vgcfgrestore were acquiring
|
||||
the orphan lock in the midst of command processing
|
||||
instead of at the start of the command. (The orphan
|
||||
lock moved to being acquired at the start of the
|
||||
command back when pvcreate/vgcreate/vgextend were
|
||||
reworked based on pvcreate_each_device.)
|
||||
|
||||
vgsplit also needed a small update to avoid reacquiring
|
||||
a VG lock that it already held (for the new VG name).
|
||||
---
|
||||
lib/metadata/metadata-exported.h | 4 ++++
|
||||
lib/metadata/metadata.c | 10 ++--------
|
||||
lib/metadata/vg.c | 14 ++++++--------
|
||||
tools/vgcfgrestore.c | 12 ++++++------
|
||||
tools/vgreduce.c | 7 +++++++
|
||||
tools/vgremove.c | 7 +++++++
|
||||
tools/vgsplit.c | 2 ++
|
||||
7 files changed, 34 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
|
||||
index f4fb112..e2fe76b 100644
|
||||
--- a/lib/metadata/metadata-exported.h
|
||||
+++ b/lib/metadata/metadata-exported.h
|
||||
@@ -704,6 +704,10 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name,
|
||||
const char *vgid, uint32_t read_flags, uint32_t lockd_state);
|
||||
struct volume_group *vg_read_for_update(struct cmd_context *cmd, const char *vg_name,
|
||||
const char *vgid, uint32_t read_flags, uint32_t lockd_state);
|
||||
+struct volume_group *vg_read_orphans(struct cmd_context *cmd,
|
||||
+ uint32_t warn_flags,
|
||||
+ const char *orphan_vgname,
|
||||
+ int *consistent);
|
||||
|
||||
/*
|
||||
* Test validity of a VG handle.
|
||||
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
|
||||
index 2292568..2c81623 100644
|
||||
--- a/lib/metadata/metadata.c
|
||||
+++ b/lib/metadata/metadata.c
|
||||
@@ -600,14 +600,8 @@ int vg_remove(struct volume_group *vg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
- if (!lock_vol(vg->cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
- log_error("Can't get lock for orphan PVs");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
ret = vg_remove_direct(vg);
|
||||
|
||||
- unlock_vg(vg->cmd, vg, VG_ORPHANS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3377,7 +3371,7 @@ static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
|
||||
}
|
||||
|
||||
/* Make orphan PVs look like a VG. */
|
||||
-static struct volume_group *_vg_read_orphans(struct cmd_context *cmd,
|
||||
+struct volume_group *vg_read_orphans(struct cmd_context *cmd,
|
||||
uint32_t warn_flags,
|
||||
const char *orphan_vgname,
|
||||
int *consistent)
|
||||
@@ -3768,7 +3762,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
|
||||
"with pre-commit.");
|
||||
return NULL;
|
||||
}
|
||||
- return _vg_read_orphans(cmd, warn_flags, vgname, consistent);
|
||||
+ return vg_read_orphans(cmd, warn_flags, vgname, consistent);
|
||||
}
|
||||
|
||||
uuid[0] = '\0';
|
||||
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
|
||||
index b8b1501..3bde1fd 100644
|
||||
--- a/lib/metadata/vg.c
|
||||
+++ b/lib/metadata/vg.c
|
||||
@@ -722,6 +722,7 @@ int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
{
|
||||
struct pv_list *pvl;
|
||||
struct volume_group *orphan_vg = NULL;
|
||||
+ int consistent;
|
||||
int r = 0;
|
||||
const char *name = pv_dev_name(pv);
|
||||
|
||||
@@ -730,6 +731,8 @@ int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
return r;
|
||||
}
|
||||
|
||||
+ log_debug("vgreduce_single VG %s PV %s", vg->name, pv_dev_name(pv));
|
||||
+
|
||||
if (pv_pe_alloc_count(pv)) {
|
||||
log_error("Physical volume \"%s\" still in use", name);
|
||||
return r;
|
||||
@@ -741,11 +744,6 @@ int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
return r;
|
||||
}
|
||||
|
||||
- if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
- log_error("Can't get lock for orphan PVs");
|
||||
- return r;
|
||||
- }
|
||||
-
|
||||
pvl = find_pv_in_vg(vg, name);
|
||||
|
||||
if (!archive(vg))
|
||||
@@ -767,8 +765,8 @@ int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
|
||||
vg->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv);
|
||||
vg->extent_count -= pv_pe_count(pv);
|
||||
|
||||
- orphan_vg = vg_read_for_update(cmd, vg->fid->fmt->orphan_vg_name,
|
||||
- NULL, 0, 0);
|
||||
+ /* FIXME: we don't need to vg_read the orphan vg here */
|
||||
+ orphan_vg = vg_read_orphans(cmd, 0, vg->fid->fmt->orphan_vg_name, &consistent);
|
||||
|
||||
if (vg_read_error(orphan_vg))
|
||||
goto bad;
|
||||
@@ -806,6 +804,6 @@ bad:
|
||||
/* If we are committing here or we had an error then we will free fid */
|
||||
if (pvl && (commit || r != 1))
|
||||
free_pv_fid(pvl->pv);
|
||||
- unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS);
|
||||
+ release_vg(orphan_vg);
|
||||
return r;
|
||||
}
|
||||
diff --git a/tools/vgcfgrestore.c b/tools/vgcfgrestore.c
|
||||
index 48a2fa4..37df8cf 100644
|
||||
--- a/tools/vgcfgrestore.c
|
||||
+++ b/tools/vgcfgrestore.c
|
||||
@@ -136,14 +136,14 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
|
||||
lvmetad_rescan = 1;
|
||||
}
|
||||
|
||||
- if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL)) {
|
||||
- log_error("Unable to lock volume group %s", vg_name);
|
||||
+ if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
+ log_error("Unable to lock orphans.");
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
- if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
- log_error("Unable to lock orphans");
|
||||
- unlock_vg(cmd, NULL, vg_name);
|
||||
+ if (!lock_vol(cmd, vg_name, LCK_VG_WRITE, NULL)) {
|
||||
+ log_error("Unable to lock volume group %s.", vg_name);
|
||||
+ unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
|
||||
arg_str_value(cmd, file_ARG, ""),
|
||||
arg_count(cmd, force_long_ARG)) :
|
||||
backup_restore(cmd, vg_name, arg_count(cmd, force_long_ARG)))) {
|
||||
- unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
unlock_vg(cmd, NULL, vg_name);
|
||||
+ unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
log_error("Restore failed.");
|
||||
ret = ECMD_FAILED;
|
||||
goto rescan;
|
||||
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
|
||||
index e8479a8..aa35453 100644
|
||||
--- a/tools/vgreduce.c
|
||||
+++ b/tools/vgreduce.c
|
||||
@@ -231,9 +231,16 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
|
||||
handle->custom_handle = &vp;
|
||||
|
||||
if (!repairing) {
|
||||
+ if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
+ log_error("Can't get lock for orphan PVs");
|
||||
+ ret = ECMD_FAILED;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
/* FIXME: Pass private struct through to all these functions */
|
||||
/* and update in batch afterwards? */
|
||||
ret = process_each_pv(cmd, argc, argv, vg_name, 0, READ_FOR_UPDATE, handle, _vgreduce_single);
|
||||
+ unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
goto out;
|
||||
}
|
||||
|
||||
diff --git a/tools/vgremove.c b/tools/vgremove.c
|
||||
index 8bf3841..5010e7d 100644
|
||||
--- a/tools/vgremove.c
|
||||
+++ b/tools/vgremove.c
|
||||
@@ -108,10 +108,17 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
|
||||
*/
|
||||
cmd->lockd_gl_disable = 1;
|
||||
|
||||
+ if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
+ log_error("Can't get lock for orphan PVs");
|
||||
+ return ECMD_FAILED;
|
||||
+ }
|
||||
+
|
||||
cmd->handles_missing_pvs = 1;
|
||||
ret = process_each_vg(cmd, argc, argv, NULL, NULL,
|
||||
READ_FOR_UPDATE, 0,
|
||||
NULL, &_vgremove_single);
|
||||
|
||||
+ unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
+
|
||||
return ret;
|
||||
}
|
||||
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
|
||||
index 2d39111..fb1fb6b 100644
|
||||
--- a/tools/vgsplit.c
|
||||
+++ b/tools/vgsplit.c
|
||||
@@ -749,8 +749,10 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
/*
|
||||
* Finally, remove the EXPORTED flag from the new VG and write it out.
|
||||
+ * We need to unlock vg_to because vg_read_for_update wants to lock it.
|
||||
*/
|
||||
if (!test_mode()) {
|
||||
+ unlock_vg(cmd, NULL, vg_name_to);
|
||||
release_vg(vg_to);
|
||||
vg_to = vg_read_for_update(cmd, vg_name_to, NULL,
|
||||
READ_ALLOW_EXPORTED, 0);
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
From d5b2f439a1a36938b4f7659bc7c40870db928c4a Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 17:38:14 +0800
|
||||
Subject: [PATCH 03/19] metadata: remove an unused and incorrect overflow check
|
||||
|
||||
Remove another instance of an invalid check for metadata
|
||||
overflow during read. The previous instance was removed
|
||||
in commit 5fb15b193.
|
||||
|
||||
This was checking for metadata that that overflowed the
|
||||
circular disk metadata buffer during read, but such metadata
|
||||
cannot be written, so it shouldn't be possible to find see.
|
||||
Also, the check was incorrect and could trigger when there
|
||||
was no overflow.
|
||||
---
|
||||
lib/format_text/format-text.c | 15 ---------------
|
||||
1 file changed, 15 deletions(-)
|
||||
|
||||
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
|
||||
index 4160ba8..4e5b08e 100644
|
||||
--- a/lib/format_text/format-text.c
|
||||
+++ b/lib/format_text/format-text.c
|
||||
@@ -553,14 +553,6 @@ static struct volume_group *_vg_read_raw_area(struct format_instance *fid,
|
||||
if (rlocn->offset + rlocn->size > mdah->size)
|
||||
wrap = (uint32_t) ((rlocn->offset + rlocn->size) - mdah->size);
|
||||
|
||||
- if (wrap > rlocn->offset) {
|
||||
- log_error("Metadata for VG %s on %s at %llu size %llu is too large for circular buffer.",
|
||||
- vgname, dev_name(area->dev),
|
||||
- (unsigned long long)(area->start + rlocn->offset),
|
||||
- (unsigned long long)rlocn->size);
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
vg = text_read_metadata(fid, NULL, vg_fmtdata, use_previous_vg, area->dev, primary_mda,
|
||||
(off_t) (area->start + rlocn->offset),
|
||||
(uint32_t) (rlocn->size - wrap),
|
||||
@@ -1249,13 +1241,6 @@ int read_metadata_location_summary(const struct format_type *fmt,
|
||||
if (rlocn->offset + rlocn->size > mdah->size)
|
||||
wrap = (uint32_t) ((rlocn->offset + rlocn->size) - mdah->size);
|
||||
|
||||
- if (wrap > rlocn->offset) {
|
||||
- log_error("Metadata location on %s at %llu is too large for circular buffer.",
|
||||
- dev_name(dev_area->dev),
|
||||
- (unsigned long long)(dev_area->start + rlocn->offset));
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* Did we see this metadata before?
|
||||
* Look in lvmcache to see if there is vg info matching
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
From 3d3b47975f25027b0dbc454f64fddea04a8c01f8 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 19:35:31 +0800
|
||||
Subject: [PATCH 04/19] cov: dmeventd plugin fix memleak
|
||||
|
||||
Fix memory leak when policy command fails too frequently and
|
||||
plugin decided to skip it.
|
||||
---
|
||||
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 2 +-
|
||||
daemons/dmeventd/plugins/vdo/dmeventd_vdo.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
|
||||
index 29b0391..0330947 100644
|
||||
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
|
||||
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
|
||||
@@ -286,7 +286,7 @@ void process_event(struct dm_task *dmt,
|
||||
if (state->fails++ <= state->max_fails) {
|
||||
log_debug("Postponing frequently failing policy (%u <= %u).",
|
||||
state->fails - 1, state->max_fails);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
if (state->max_fails < MAX_FAILS)
|
||||
state->max_fails <<= 1;
|
||||
diff --git a/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c b/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c
|
||||
index 389632c..6b35b2f 100644
|
||||
--- a/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c
|
||||
+++ b/daemons/dmeventd/plugins/vdo/dmeventd_vdo.c
|
||||
@@ -261,7 +261,7 @@ void process_event(struct dm_task *dmt,
|
||||
if (state->fails++ <= state->max_fails) {
|
||||
log_debug("Postponing frequently failing policy (%u <= %u).",
|
||||
state->fails - 1, state->max_fails);
|
||||
- return;
|
||||
+ goto out;
|
||||
}
|
||||
if (state->max_fails < MAX_FAILS)
|
||||
state->max_fails <<= 1;
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From ce4e728a2d7b9fd8fda7cb8cabb0af763abac886 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 20:14:33 +0800
|
||||
Subject: [PATCH 10/19] cov: add missing error path check for label_scan_open
|
||||
|
||||
---
|
||||
lib/label/label.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/label/label.c b/lib/label/label.c
|
||||
index 86c84d8..63300d2 100644
|
||||
--- a/lib/label/label.c
|
||||
+++ b/lib/label/label.c
|
||||
@@ -1087,7 +1087,11 @@ int label_read_sector(struct device *dev, uint64_t read_sector)
|
||||
block_sector = block_num * BCACHE_BLOCK_SIZE_IN_SECTORS;
|
||||
start_sector = read_sector % BCACHE_BLOCK_SIZE_IN_SECTORS;
|
||||
|
||||
- label_scan_open(dev);
|
||||
+ if (!label_scan_open(dev)) {
|
||||
+ log_error("Error opening device %s for prefetch %llu sector.",
|
||||
+ dev_name(dev), (unsigned long long)block_num);
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
bcache_prefetch(scan_bcache, dev->bcache_fd, block_num);
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From ec6ba10081488699edaba1c80ef69f5a14bced00 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 22:20:42 +0800
|
||||
Subject: [PATCH 15/19] lvmlockd: fix missing LV lock for lvconvert repair
|
||||
|
||||
Add missing lvmlockd LV lock for lvconvert repair
|
||||
on mirror and thin/cache pools.
|
||||
---
|
||||
tools/lvconvert.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
||||
index d7a618d..794877e 100644
|
||||
--- a/tools/lvconvert.c
|
||||
+++ b/tools/lvconvert.c
|
||||
@@ -3461,6 +3461,18 @@ static int _lvconvert_repair_pvs_mirror(struct cmd_context *cmd, struct logical_
|
||||
struct lvinfo info;
|
||||
int ret;
|
||||
|
||||
+ /*
|
||||
+ * We want to allow cmirror active on multiple nodes to be repaired,
|
||||
+ * but normal mirror to only be repaired if active exclusively here.
|
||||
+ * If the LV is active it already has the necessary lock, but if not
|
||||
+ * active, then require ex since we cannot know the active state on
|
||||
+ * other hosts.
|
||||
+ */
|
||||
+ if (!lv_is_active(lv)) {
|
||||
+ if (!lockd_lv(cmd, lv, "ex", 0))
|
||||
+ return_0;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* FIXME: temporary use of lp because _lvconvert_mirrors_repair()
|
||||
* and _aux() still use lp fields everywhere.
|
||||
@@ -3594,6 +3606,10 @@ static int _lvconvert_repair_cachepool_thinpool(struct cmd_context *cmd, struct
|
||||
int poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG, DEFAULT_POOL_METADATA_SPARE);
|
||||
struct dm_list *use_pvh;
|
||||
|
||||
+ /* ensure it's not active elsewhere. */
|
||||
+ if (!lockd_lv(cmd, lv, "ex", 0))
|
||||
+ return_0;
|
||||
+
|
||||
if (cmd->position_argc > 1) {
|
||||
/* First pos arg is required LV, remaining are optional PVs. */
|
||||
if (!(use_pvh = create_pv_list(cmd->mem, lv->vg, cmd->position_argc - 1, cmd->position_argv + 1, 0)))
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
From 9b898dc260048071fb5f0ab2d85580c73225e9d3 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 22:30:24 +0800
|
||||
Subject: [PATCH 16/19] lvconvert: ensure proper init of pv_list
|
||||
|
||||
---
|
||||
tools/lvconvert.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
|
||||
index 794877e..9e9029e 100644
|
||||
--- a/tools/lvconvert.c
|
||||
+++ b/tools/lvconvert.c
|
||||
@@ -483,7 +483,7 @@ static struct dm_list *_failed_pv_list(struct volume_group *vg)
|
||||
if (pvl->pv->pe_alloc_count == 0)
|
||||
continue;
|
||||
|
||||
- if (!(new_pvl = dm_pool_alloc(vg->vgmem, sizeof(*new_pvl)))) {
|
||||
+ if (!(new_pvl = dm_pool_zalloc(vg->vgmem, sizeof(*new_pvl)))) {
|
||||
log_error("Allocation of failed_pvs list entry failed.");
|
||||
return NULL;
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
From a805a5254b06f30574f8d322fa451763335c1ee1 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 22:37:32 +0800
|
||||
Subject: [PATCH 18/19] mangenerator: check strdup was successfull
|
||||
|
||||
Check for strdup != NULL
|
||||
and drop unneeded zeroing when buffer is overwritten.
|
||||
---
|
||||
tools/command.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/command.c b/tools/command.c
|
||||
index f2a2722..9516fde 100644
|
||||
--- a/tools/command.c
|
||||
+++ b/tools/command.c
|
||||
@@ -1465,7 +1465,7 @@ int define_commands(struct cmd_context *cmdtool, const char *run_name)
|
||||
|
||||
if (_is_desc_line(line_argv[0]) && !skip && cmd) {
|
||||
char *desc = dm_pool_strdup(cmdtool->libmem, line_orig);
|
||||
- if (cmd->desc) {
|
||||
+ if (cmd->desc && desc) {
|
||||
int newlen = strlen(cmd->desc) + strlen(desc) + 2;
|
||||
char *newdesc = dm_pool_alloc(cmdtool->libmem, newlen);
|
||||
if (newdesc) {
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
From 3ac89d45f3b5091fa3864248a50a4d15ebacb6d9 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Wed, 13 Mar 2019 22:51:19 +0800
|
||||
Subject: [PATCH 19/19] cov: ensure lock_type is not NULL
|
||||
|
||||
---
|
||||
tools/vgchange.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/tools/vgchange.c b/tools/vgchange.c
|
||||
index 623517b..40c3c4d 100644
|
||||
--- a/tools/vgchange.c
|
||||
+++ b/tools/vgchange.c
|
||||
@@ -932,7 +932,7 @@ static int _vgchange_locktype(struct cmd_context *cmd, struct volume_group *vg)
|
||||
int lv_lock_count = 0;
|
||||
|
||||
/* Special recovery case. */
|
||||
- if (lockopt && !strcmp(lock_type, "none") && !strcmp(lockopt, "force")) {
|
||||
+ if (lock_type && lockopt && !strcmp(lock_type, "none") && !strcmp(lockopt, "force")) {
|
||||
vg->status &= ~CLUSTERED;
|
||||
vg->lock_type = "none";
|
||||
vg->lock_args = NULL;
|
||||
@@ -997,7 +997,7 @@ static int _vgchange_locktype(struct cmd_context *cmd, struct volume_group *vg)
|
||||
}
|
||||
|
||||
/* none to clvm */
|
||||
- if (!strcmp(vg->lock_type, "none") && !strcmp(lock_type, "clvm")) {
|
||||
+ if (lock_type && !strcmp(vg->lock_type, "none") && !strcmp(lock_type, "clvm")) {
|
||||
log_warn("New clvm lock type will not be usable with lvmlockd.");
|
||||
vg->status |= CLUSTERED;
|
||||
vg->lock_type = "clvm"; /* this is optional */
|
||||
@@ -1110,7 +1110,7 @@ static int _vgchange_locktype(struct cmd_context *cmd, struct volume_group *vg)
|
||||
}
|
||||
|
||||
/* ... to none */
|
||||
- if (!strcmp(lock_type, "none")) {
|
||||
+ if (lock_type && !strcmp(lock_type, "none")) {
|
||||
vg->lock_type = NULL;
|
||||
vg->system_id = cmd->system_id ? dm_pool_strdup(vg->vgmem, cmd->system_id) : NULL;
|
||||
return 1;
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,411 +0,0 @@
|
||||
From afb4ce9833dd60220f48a273c7b50c692c900164 Mon Sep 17 00:00:00 2001
|
||||
From: root <root@localhost.localdomain>
|
||||
Date: Sat, 23 Mar 2019 18:25:27 +0800
|
||||
Subject: [PATCH] Remove checking for locked VGs
|
||||
|
||||
A few places were calling a function to check if a
|
||||
VG lock was held. The only place it was actually
|
||||
needed is for pvcreate which wants to do its own
|
||||
locking (and scanning) around process_each_pv.
|
||||
|
||||
The locking/scanning exceptions for pvcreate in
|
||||
process_each_pv/vg_read can be enabled by just passing
|
||||
a couple of flags instead of checking if the VG is
|
||||
already locked. This also means that these special
|
||||
cases won't be enabled unknowingly in other places
|
||||
where they shouldn't be used.
|
||||
---
|
||||
lib/cache/lvmcache.c | 13 -----
|
||||
lib/cache/lvmcache.h | 1 -
|
||||
lib/metadata/metadata-exported.h | 2 +
|
||||
lib/metadata/metadata.c | 18 ++----
|
||||
liblvm/lvm_vg.c | 2 -
|
||||
tools/toollib.c | 94 +++++++++-----------------------
|
||||
tools/vgreduce.c | 2 +-
|
||||
7 files changed, 35 insertions(+), 97 deletions(-)
|
||||
|
||||
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
|
||||
index 1a2e987..a48c5e7 100644
|
||||
--- a/lib/cache/lvmcache.c
|
||||
+++ b/lib/cache/lvmcache.c
|
||||
@@ -536,9 +536,6 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
|
||||
if (!_saved_vg_hash)
|
||||
return;
|
||||
|
||||
- if (lvmcache_vgname_is_locked(VG_GLOBAL))
|
||||
- return;
|
||||
-
|
||||
/* For VG_ORPHANS, we need to invalidate all labels on orphan PVs. */
|
||||
if (!strcmp(vgname, VG_ORPHANS)) {
|
||||
_drop_metadata(FMT_TEXT_ORPHAN_VG_NAME, 0);
|
||||
@@ -561,14 +558,6 @@ void lvmcache_lock_vgname(const char *vgname, int read_only __attribute__((unuse
|
||||
}
|
||||
}
|
||||
|
||||
-int lvmcache_vgname_is_locked(const char *vgname)
|
||||
-{
|
||||
- if (!_lock_hash)
|
||||
- return 0;
|
||||
-
|
||||
- return dm_hash_lookup(_lock_hash, is_orphan_vg(vgname) ? VG_ORPHANS : vgname) ? 1 : 0;
|
||||
-}
|
||||
-
|
||||
void lvmcache_unlock_vgname(const char *vgname)
|
||||
{
|
||||
if (!dm_hash_lookup(_lock_hash, vgname))
|
||||
@@ -1997,8 +1986,6 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info,
|
||||
else if (!_lvmcache_update_vgid(NULL, vginfo, vgid)) /* Orphans */
|
||||
return_0;
|
||||
|
||||
- _update_cache_vginfo_lock_state(vginfo, lvmcache_vgname_is_locked(vgname));
|
||||
-
|
||||
/* FIXME Check consistency of list! */
|
||||
vginfo->fmt = fmt;
|
||||
|
||||
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
|
||||
index e9e6932..0567a81 100644
|
||||
--- a/lib/cache/lvmcache.h
|
||||
+++ b/lib/cache/lvmcache.h
|
||||
@@ -107,7 +107,6 @@ char *lvmcache_vgname_from_pvid(struct cmd_context *cmd, const char *pvid);
|
||||
const char *lvmcache_vgname_from_info(struct lvmcache_info *info);
|
||||
const struct format_type *lvmcache_fmt_from_info(struct lvmcache_info *info);
|
||||
int lvmcache_vgs_locked(void);
|
||||
-int lvmcache_vgname_is_locked(const char *vgname);
|
||||
|
||||
void lvmcache_seed_infos_from_lvmetad(struct cmd_context *cmd);
|
||||
|
||||
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
|
||||
index e2fe76b..a4ca17f 100644
|
||||
--- a/lib/metadata/metadata-exported.h
|
||||
+++ b/lib/metadata/metadata-exported.h
|
||||
@@ -178,6 +178,8 @@
|
||||
#define READ_OK_NOTFOUND 0x00040000U
|
||||
#define READ_WARN_INCONSISTENT 0x00080000U
|
||||
#define READ_FOR_UPDATE 0x00100000U /* A meta-flag, useful with toollib for_each_* functions. */
|
||||
+#define PROCESS_SKIP_SCAN 0x00200000U /* skip lvmcache_label_scan in process_each_pv */
|
||||
+#define PROCESS_SKIP_ORPHAN_LOCK 0x00400000U /* skip lock_vol(VG_ORPHAN) in vg_read */
|
||||
|
||||
/* vg's "read_status" field */
|
||||
#define FAILED_INCONSISTENT 0x00000001U
|
||||
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
|
||||
index 2c81623..237e57b 100644
|
||||
--- a/lib/metadata/metadata.c
|
||||
+++ b/lib/metadata/metadata.c
|
||||
@@ -3118,12 +3118,6 @@ int vg_commit(struct volume_group *vg)
|
||||
int cache_updated = 0;
|
||||
struct pv_list *pvl;
|
||||
|
||||
- if (!lvmcache_vgname_is_locked(vg->name)) {
|
||||
- log_error(INTERNAL_ERROR "Attempt to write new VG metadata "
|
||||
- "without locking %s", vg->name);
|
||||
- return cache_updated;
|
||||
- }
|
||||
-
|
||||
cache_updated = _vg_commit_mdas(vg);
|
||||
|
||||
set_vg_notify(vg->cmd);
|
||||
@@ -5465,8 +5459,8 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
|
||||
uint32_t failure = 0;
|
||||
uint32_t warn_flags = 0;
|
||||
int is_shared = 0;
|
||||
- int already_locked;
|
||||
int write_lock_held = (lock_flags == LCK_VG_WRITE);
|
||||
+ int skip_lock = is_orphan_vg(vg_name) && (read_flags & PROCESS_SKIP_ORPHAN_LOCK);
|
||||
|
||||
if ((read_flags & READ_ALLOW_INCONSISTENT) || (lock_flags != LCK_VG_WRITE))
|
||||
consistent = 0;
|
||||
@@ -5477,15 +5471,13 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- already_locked = lvmcache_vgname_is_locked(vg_name);
|
||||
-
|
||||
- if (!already_locked &&
|
||||
+ if (!skip_lock &&
|
||||
!lock_vol(cmd, vg_name, lock_flags, NULL)) {
|
||||
log_error("Can't get lock for %s", vg_name);
|
||||
return _vg_make_handle(cmd, vg, FAILED_LOCKING);
|
||||
}
|
||||
|
||||
- if (already_locked)
|
||||
+ if (skip_lock)
|
||||
log_very_verbose("Locking %s already done", vg_name);
|
||||
|
||||
if (is_orphan_vg(vg_name))
|
||||
@@ -5553,13 +5545,13 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
|
||||
goto_bad;
|
||||
|
||||
if (!(vg = _vg_make_handle(cmd, vg, failure)) || vg_read_error(vg))
|
||||
- if (!already_locked)
|
||||
+ if (!skip_lock)
|
||||
unlock_vg(cmd, vg, vg_name);
|
||||
|
||||
return vg;
|
||||
|
||||
bad:
|
||||
- if (!already_locked)
|
||||
+ if (!skip_lock)
|
||||
unlock_vg(cmd, vg, vg_name);
|
||||
|
||||
bad_no_unlock:
|
||||
diff --git a/liblvm/lvm_vg.c b/liblvm/lvm_vg.c
|
||||
index ee6fa4e..616c78f 100644
|
||||
--- a/liblvm/lvm_vg.c
|
||||
+++ b/liblvm/lvm_vg.c
|
||||
@@ -186,8 +186,6 @@ int lvm_vg_close(vg_t vg)
|
||||
struct saved_env e = store_user_env(vg->cmd);
|
||||
if (vg_read_error(vg) == FAILED_LOCKING)
|
||||
release_vg(vg);
|
||||
- else if (!lvmcache_vgname_is_locked(vg->name))
|
||||
- release_vg(vg);
|
||||
else
|
||||
unlock_and_release_vg(vg->cmd, vg, vg->name);
|
||||
restore_user_env(&e);
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index ce877cc..3210e28 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -1969,7 +1969,6 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t read_flags,
|
||||
int skip;
|
||||
int notfound;
|
||||
int process_all = 0;
|
||||
- int already_locked;
|
||||
int do_report_ret_code = 1;
|
||||
|
||||
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_VG);
|
||||
@@ -2012,8 +2011,6 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t read_flags,
|
||||
continue;
|
||||
}
|
||||
|
||||
- already_locked = lvmcache_vgname_is_locked(vg_name);
|
||||
-
|
||||
vg = vg_read(cmd, vg_name, vg_uuid, read_flags, lockd_state);
|
||||
if (_ignore_vg(vg, vg_name, arg_vgnames, read_flags, &skip, ¬found)) {
|
||||
stack;
|
||||
@@ -2041,7 +2038,7 @@ static int _process_vgnameid_list(struct cmd_context *cmd, uint32_t read_flags,
|
||||
ret_max = ret;
|
||||
}
|
||||
|
||||
- if (!vg_read_error(vg) && !already_locked)
|
||||
+ if (!vg_read_error(vg))
|
||||
unlock_vg(cmd, vg, vg_name);
|
||||
endvg:
|
||||
release_vg(vg);
|
||||
@@ -3681,8 +3678,6 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t read_flag
|
||||
continue;
|
||||
}
|
||||
|
||||
- already_locked = lvmcache_vgname_is_locked(vg_name);
|
||||
-
|
||||
vg = vg_read(cmd, vg_name, vg_uuid, read_flags, lockd_state);
|
||||
if (_ignore_vg(vg, vg_name, arg_vgnames, read_flags, &skip, ¬found)) {
|
||||
stack;
|
||||
@@ -3701,8 +3696,7 @@ static int _process_lv_vgnameid_list(struct cmd_context *cmd, uint32_t read_flag
|
||||
if (ret > ret_max)
|
||||
ret_max = ret;
|
||||
|
||||
- if (!already_locked)
|
||||
- unlock_vg(cmd, vg, vg_name);
|
||||
+ unlock_vg(cmd, vg, vg_name);
|
||||
endvg:
|
||||
release_vg(vg);
|
||||
if (!lockd_vg(cmd, vg_name, "un", 0, &lockd_state))
|
||||
@@ -4400,7 +4394,7 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t read_flags,
|
||||
int ret;
|
||||
int skip;
|
||||
int notfound;
|
||||
- int already_locked;
|
||||
+ int skip_lock;
|
||||
int do_report_ret_code = 1;
|
||||
|
||||
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_VG);
|
||||
@@ -4434,7 +4428,7 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t read_flags,
|
||||
|
||||
log_debug("Processing PVs in VG %s", vg_name);
|
||||
|
||||
- already_locked = lvmcache_vgname_is_locked(vg_name);
|
||||
+ skip_lock = is_orphan_vg(vg_name) && (read_flags & PROCESS_SKIP_ORPHAN_LOCK);
|
||||
|
||||
vg = vg_read(cmd, vg_name, vg_uuid, read_flags, lockd_state);
|
||||
if (_ignore_vg(vg, vg_name, NULL, read_flags, &skip, ¬found)) {
|
||||
@@ -4462,7 +4456,7 @@ static int _process_pvs_in_vgs(struct cmd_context *cmd, uint32_t read_flags,
|
||||
if (ret > ret_max)
|
||||
ret_max = ret;
|
||||
|
||||
- if (!skip && !already_locked)
|
||||
+ if (!skip && !skip_lock)
|
||||
unlock_vg(cmd, vg, vg->name);
|
||||
endvg:
|
||||
release_vg(vg);
|
||||
@@ -4501,7 +4495,6 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
struct device_id_list *dil;
|
||||
int process_all_pvs;
|
||||
int process_all_devices;
|
||||
- int orphans_locked;
|
||||
int ret_max = ECMD_PROCESSED;
|
||||
int ret;
|
||||
|
||||
@@ -4549,8 +4542,6 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
- orphans_locked = lvmcache_vgname_is_locked(VG_ORPHANS);
|
||||
-
|
||||
process_all_pvs = dm_list_empty(&arg_pvnames) && dm_list_empty(&arg_tags);
|
||||
|
||||
process_all_devices = process_all_pvs && (cmd->cname->flags & ENABLE_ALL_DEVS) && all_is_set;
|
||||
@@ -4561,22 +4552,8 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
goto_out;
|
||||
}
|
||||
|
||||
- /*
|
||||
- * This full scan would be done by _get_all_devices() if
|
||||
- * it were not done here first. It's called here first
|
||||
- * so that get_vgnameids() will look at any new devices.
|
||||
- * When orphans is already locked, these steps are done
|
||||
- * before process_each_pv is called.
|
||||
- */
|
||||
- if (!trust_cache() && !orphans_locked) {
|
||||
- lvmcache_destroy(cmd, 1, 0);
|
||||
-
|
||||
- /*
|
||||
- * Scan all devices to populate lvmcache with initial
|
||||
- * list of PVs and VGs.
|
||||
- */
|
||||
+ if (!(read_flags & PROCESS_SKIP_SCAN))
|
||||
lvmcache_label_scan(cmd);
|
||||
- }
|
||||
|
||||
if (!get_vgnameids(cmd, &all_vgnameids, only_this_vgname, 1)) {
|
||||
ret_max = ret;
|
||||
@@ -4647,11 +4624,9 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
ret_max = ret;
|
||||
|
||||
/*
|
||||
- * If the orphans lock was held, there shouldn't be missed devices. If
|
||||
- * there were, we cannot clear the cache while holding the orphans lock
|
||||
- * anyway.
|
||||
+ * If the orphans lock was held, there shouldn't be missed devices.
|
||||
*/
|
||||
- if (orphans_locked)
|
||||
+ if (read_flags & PROCESS_SKIP_ORPHAN_LOCK)
|
||||
goto skip_missed;
|
||||
|
||||
/*
|
||||
@@ -4678,12 +4653,7 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
|
||||
log_verbose("Some PVs were not found in first search, retrying.");
|
||||
|
||||
- lvmcache_destroy(cmd, 0, 0);
|
||||
- if (!lvmcache_init(cmd)) {
|
||||
- log_error("Failed to initalize lvm cache.");
|
||||
- ret_max = ECMD_FAILED;
|
||||
- goto out;
|
||||
- }
|
||||
+ lvmcache_label_scan(cmd);
|
||||
lvmcache_seed_infos_from_lvmetad(cmd);
|
||||
|
||||
ret = _process_pvs_in_vgs(cmd, read_flags, &all_vgnameids, &all_devices,
|
||||
@@ -5514,25 +5484,16 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
||||
dm_list_add(&pp->arg_devices, &pd->list);
|
||||
}
|
||||
|
||||
- /*
|
||||
- * Clear the cache before acquiring the orphan lock. (Clearing the
|
||||
- * cache with locks held is an error.) We want the orphan lock
|
||||
- * acquired before process_each_pv. If the orphan lock is not held
|
||||
- * when process_each_pv is called, then process_each_pv clears the
|
||||
- * cache.
|
||||
- */
|
||||
- lvmcache_destroy(cmd, 1, 0);
|
||||
-
|
||||
- /*
|
||||
- * If no prompts require a user response, this orphan lock is held
|
||||
- * throughout, and pvcreate_each_device() returns with it held so that
|
||||
- * vgcreate/vgextend use the PVs created here to add to a VG.
|
||||
- */
|
||||
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
log_error("Can't get lock for orphan PVs.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Scan before calling process_each_pv so we can set up the PV args
|
||||
+ * first. We can then skip the scan that would normally occur at the
|
||||
+ * beginning of process_each_pv.
|
||||
+ */
|
||||
lvmcache_label_scan(cmd);
|
||||
|
||||
/*
|
||||
@@ -5556,9 +5517,8 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
||||
* If it's added to arg_process but needs a prompt or force option, then
|
||||
* a corresponding prompt entry is added to pp->prompts.
|
||||
*/
|
||||
- process_each_pv(cmd, 0, NULL, NULL, 1, 0, handle,
|
||||
- pp->is_remove ? _pvremove_check_single : _pvcreate_check_single);
|
||||
-
|
||||
+ process_each_pv(cmd, 0, NULL, NULL, 1, PROCESS_SKIP_SCAN | PROCESS_SKIP_ORPHAN_LOCK,
|
||||
+ handle, pp->is_remove ? _pvremove_check_single : _pvcreate_check_single);
|
||||
/*
|
||||
* A fatal error was found while checking.
|
||||
*/
|
||||
@@ -5639,9 +5599,11 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
||||
goto do_command;
|
||||
|
||||
/*
|
||||
- * Prompts require asking the user, so release the orphans lock, ask
|
||||
- * the questions, reacquire the orphans lock, verify that the PVs were
|
||||
- * not used during the questions, then do the create steps.
|
||||
+ * Prompts require asking the user and make take some time, during
|
||||
+ * which we don't want to block other commands. So, release the lock
|
||||
+ * to prevent blocking other commands while we wait. After a response
|
||||
+ * from the user, reacquire the lock, verify that the PVs were not used
|
||||
+ * during the wait, then do the create steps.
|
||||
*/
|
||||
unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
|
||||
@@ -5676,14 +5638,11 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
/*
|
||||
- * Clear the cache, reacquire the orphans write lock, then check again
|
||||
- * that the devices can still be used. If the second loop finds them
|
||||
- * changed, or can't find them any more, then they aren't used.
|
||||
- * Clear the cache here before locking orphans, since it won't be
|
||||
- * done by process_each_pv with orphans already locked.
|
||||
+ * Reacquire the lock that was released above before waiting, then
|
||||
+ * check again that the devices can still be used. If the second loop
|
||||
+ * finds them changed, or can't find them any more, then they aren't
|
||||
+ * used.
|
||||
*/
|
||||
- lvmcache_destroy(cmd, 1, 0);
|
||||
-
|
||||
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
|
||||
log_error("Can't get lock for orphan PVs.");
|
||||
goto out;
|
||||
@@ -5705,7 +5664,8 @@ int pvcreate_each_device(struct cmd_context *cmd,
|
||||
*/
|
||||
dm_list_splice(&pp->arg_confirm, &pp->arg_process);
|
||||
|
||||
- process_each_pv(cmd, 0, NULL, NULL, 1, 0, handle, _pv_confirm_single);
|
||||
+ process_each_pv(cmd, 0, NULL, NULL, 1, PROCESS_SKIP_SCAN | PROCESS_SKIP_ORPHAN_LOCK,
|
||||
+ handle, _pv_confirm_single);
|
||||
|
||||
dm_list_iterate_items(pd, &pp->arg_confirm)
|
||||
log_error("Device %s %s.", pd->name, dev_cache_filtered_reason(pd->name));
|
||||
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
|
||||
index aa35453..aa68f0f 100644
|
||||
--- a/tools/vgreduce.c
|
||||
+++ b/tools/vgreduce.c
|
||||
@@ -239,7 +239,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
/* FIXME: Pass private struct through to all these functions */
|
||||
/* and update in batch afterwards? */
|
||||
- ret = process_each_pv(cmd, argc, argv, vg_name, 0, READ_FOR_UPDATE, handle, _vgreduce_single);
|
||||
+ ret = process_each_pv(cmd, argc, argv, vg_name, 0, READ_FOR_UPDATE | PROCESS_SKIP_ORPHAN_LOCK, handle, _vgreduce_single);
|
||||
unlock_vg(cmd, NULL, VG_ORPHANS);
|
||||
goto out;
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
From 4e7c9c0e627d9814f0502488fb830fc47b6a71e0 Mon Sep 17 00:00:00 2001
|
||||
Date: Wed, 11 Sep 2019 01:35:09 +0800
|
||||
Subject: [PATCH] lvm2: revert to use label_read in lvmetad_pvscan_single
|
||||
|
||||
reason: In e3e5beec74ac0037917f5e9a2693c6ccb16debac of stable-2.02
|
||||
branch, it reduce scan disk.It may lead to the metadate cache
|
||||
outdate when send pv_found to lvmetad.Revert it by calling
|
||||
label_read in lvmetad_pvscan_single
|
||||
---
|
||||
lib/cache/lvmetad.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
|
||||
index 4b1b095..80aee66 100644
|
||||
--- a/lib/cache/lvmetad.c
|
||||
+++ b/lib/cache/lvmetad.c
|
||||
@@ -2256,6 +2256,7 @@ int lvmetad_pvscan_single(struct cmd_context *cmd, struct device *dev,
|
||||
return 1;
|
||||
}
|
||||
|
||||
+ label_read(dev);
|
||||
if (!(info = lvmcache_info_from_pvid(dev->pvid, dev, 0))) {
|
||||
log_print_unless_silent("No PV info found on %s for PVID %s.", dev_name(dev), dev->pvid);
|
||||
if (!lvmetad_pv_gone_by_dev(dev))
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
From 7517074585ca042c0bd06481a359d617fabdc032 Mon Sep 17 00:00:00 2001
|
||||
From: wangjufeng <wangjufeng@huawei.com>
|
||||
Date: Wed, 20 Nov 2019 17:37:03 +0800
|
||||
Subject: [PATCH] revert "label_scan: remove extra label scan and read for
|
||||
orphan PVs"
|
||||
|
||||
In commit 79c4971210a6337563ffa2fca08fb636423d93d4, it removed the
|
||||
modification of *consistent in vg_read_orphans(), it will lead to pvs
|
||||
--readonly return failure.
|
||||
---
|
||||
lib/metadata/metadata.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
|
||||
index 237e57b..35f35bd 100644
|
||||
--- a/lib/metadata/metadata.c
|
||||
+++ b/lib/metadata/metadata.c
|
||||
@@ -3426,6 +3426,7 @@ struct volume_group *vg_read_orphans(struct cmd_context *cmd,
|
||||
if (!lvmcache_foreach_pv(vginfo, _vg_read_orphan_pv, &baton))
|
||||
return_NULL;
|
||||
|
||||
+ *consistent = 1;
|
||||
return vg;
|
||||
}
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
From beb01e5eeb2c913854f9df104af089be274eff59 Mon Sep 17 00:00:00 2001
|
||||
From: wangjufeng <wangjufeng@huawei.com>
|
||||
Date: Wed, 15 Apr 2020 21:25:28 +0800
|
||||
Subject: [PATCH] fix the code maybe lead to buffer over bound
|
||||
|
||||
Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
---
|
||||
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
|
||||
index a1ab41a..e743a58 100644
|
||||
--- a/lib/cache/lvmetad.c
|
||||
+++ b/lib/cache/lvmetad.c
|
||||
@@ -1467,7 +1467,9 @@ int lvmetad_get_vgnameids(struct cmd_context *cmd, struct dm_list *vgnameids)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- vgnl->vgid = dm_pool_strdup(cmd->mem, (char *)&vgid);
|
||||
+ char vgid_buffer[ID_LEN+1] = {0x0};
|
||||
+ memcpy(vgid_buffer, vgid.uuid, ID_LEN);
|
||||
+ vgnl->vgid = dm_pool_strdup(cmd->mem, vgid_buffer);
|
||||
vgnl->vg_name = dm_pool_strdup(cmd->mem, vg_name);
|
||||
|
||||
if (!vgnl->vgid || !vgnl->vg_name) {
|
||||
diff --git a/tools/command.c b/tools/command.c
|
||||
index 377d03f..f2a2722 100644
|
||||
--- a/tools/command.c
|
||||
+++ b/tools/command.c
|
||||
@@ -1364,7 +1364,7 @@ static int _copy_line(char *line, int max_line, int *position)
|
||||
|
||||
memset(line, 0, max_line);
|
||||
|
||||
- while (1) {
|
||||
+ while ( p < strlen(_command_input) ) {
|
||||
line[i] = _command_input[p];
|
||||
i++;
|
||||
p++;
|
||||
@ -1,28 +0,0 @@
|
||||
From 1e927d2e8c828b6502d871ab882ded509b83e9c6 Mon Sep 17 00:00:00 2001
|
||||
From: wangjufeng <wangjufeng@huawei.com>
|
||||
Date: Sat, 16 Nov 2019 15:02:41 +0800
|
||||
Subject: [PATCH] increase log level of lvmetad
|
||||
|
||||
This patch add fatal,error,warn log of lvmetad to syslog.
|
||||
|
||||
Signed-off-by: wangjufeng<wangjufeng@huawei.com>
|
||||
---
|
||||
scripts/lvm2_lvmetad_systemd_red_hat.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
|
||||
index 2135101..08a4b73 100644
|
||||
--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
|
||||
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
|
||||
@@ -10,7 +10,7 @@ Conflicts=shutdown.target
|
||||
[Service]
|
||||
Type=simple
|
||||
NonBlocking=true
|
||||
-ExecStart=@SBINDIR@/lvmetad -f -t 3600
|
||||
+ExecStart=@SBINDIR@/lvmetad -f -t 3600 -l fatal,error,warn
|
||||
Environment=SD_ACTIVATION=1
|
||||
Restart=on-abort
|
||||
PIDFile=@LVMETAD_PIDFILE@
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
Binary file not shown.
BIN
LVM2.2.03.09.tgz
Normal file
BIN
LVM2.2.03.09.tgz
Normal file
Binary file not shown.
80
lvm2.spec
80
lvm2.spec
@ -32,7 +32,7 @@
|
||||
%global libselinux_version 1.30.19-4
|
||||
%global persistent_data_version 0.7.0-0.1.rc6
|
||||
%global sanlock_version 3.3.0-2
|
||||
%global device_mapper_version 1.02.170
|
||||
%global device_mapper_version 1.02.171
|
||||
%global systemd_version 189-3
|
||||
%global dracut_version 002-18
|
||||
%global util_linux_version 2.24
|
||||
@ -42,38 +42,25 @@
|
||||
%global dlm_version 4.0.6-2
|
||||
|
||||
Name: lvm2
|
||||
Version: 2.02.187
|
||||
Version: 2.03.09
|
||||
Release: 3
|
||||
Epoch: 8
|
||||
Summary: Tools for logical volume management
|
||||
License: GPLv2 and LGPLv2
|
||||
URL: http://sourceware.org/lvm2
|
||||
Source0: ftp://sourceware.org/pub/lvm2/releases/LVM2.%{version}.tgz
|
||||
Patch6000: 6000-lvm2-set-default-preferred_names.patch
|
||||
Patch6001: 6001-lvm2-lvmetad-timeout.patch
|
||||
Patch6002: 6002-Remove-VG-lock-ordering-check.patch
|
||||
Patch6003: 6003-Fix-use-of-orphan-lock-in-commands.patch
|
||||
Patch6004: 6004-metadata-remove-an-unused-and-incorrect-overflow-che.patch
|
||||
Patch6005: 6005-cov-dmeventd-plugin-fix-memleak.patch
|
||||
Patch6006: 6006-cov-add-missing-error-path-check-for-label_scan_open.patch
|
||||
Patch6007: 6007-lvmlockd-fix-missing-LV-lock-for-lvconvert-repair.patch
|
||||
Patch6008: 6008-lvconvert-ensure-proper-init-of-pv_list.patch
|
||||
Patch6009: 6009-mangenerator-check-strdup-was-successfull.patch
|
||||
Patch6010: 6010-cov-ensure-lock_type-is-not-NULL.patch
|
||||
Patch6011: 6011-Remove-checking-for-locked-VGs.patch
|
||||
Patch6012: 6012-lvm2-default-allow-changes-with-duplicate-pvs.patch
|
||||
Patch6013: 6013-lvm2-revert-to-use-label_read-in-lvmetad_pvscan_sing.patch
|
||||
Patch6014: 6014-revert-label_scan-remove-extra-label-scan-and-read-f.patch
|
||||
|
||||
Patch9000: 9000-bugfix-lvm2-add-SSD.patch
|
||||
Patch9001: 9001-bugfix-add-timeout-when-fail-to-wait-udev.patch
|
||||
Patch9002: 9002-bugfix-fix-the-code-maybe-lead-to-buffer-over-bound-access.patch
|
||||
Patch9003: 9003-enhancement-modify-default-log-level-to-error-level.patch
|
||||
Patch9004: 9004-enhancement-add-dfx-log.patch
|
||||
Patch9005: 9005-enhancement-increase-log-level-of-lvmetad.patch
|
||||
Patch9006: 9006-enhancement-syslog-more-when-use-libdevmapper-so.patch
|
||||
Patch9007: 9007-enhancement-log-it-when-disk-slow.patch
|
||||
Patch9008: 9008-bugfix-lvm2-fix-the-reuse-of-va_list.patch
|
||||
Source0: https://sourceware.org/pub/lvm2/releases/LVM2.2.03.09.tgz
|
||||
Patch1: 0001-lvm2-set-default-preferred_names.patch
|
||||
Patch2: 0002-lvm2-default-allow-changes-with-duplicate-pvs.patch
|
||||
Patch3: 0003-cov-check-result-of-dev_read_bytes.patch
|
||||
Patch4: 0004-devs-check-for-no-dev-when-dropping-aliases.patch
|
||||
Patch5: 0005-bugfix-lvm2-add-SSD.patch
|
||||
Patch6: 0006-bugfix-add-timeout-when-fail-to-wait-udev.patch
|
||||
Patch7: 0007-bugfix-fix-the-code-maybe-lead-to-buffer-over-bound-access.patch
|
||||
Patch8: 0008-enhancement-modify-default-log-level-to-error-level.patch
|
||||
Patch9: 0009-enhancement-add-dfx-log.patch
|
||||
Patch10: 0010-enhancement-syslog-more-when-use-libdevmapper-so.patch
|
||||
Patch11: 0011-enhancement-log-it-when-disk-slow.patch
|
||||
Patch12: 0012-bugfix-lvm2-fix-the-reuse-of-va_list.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
@ -273,8 +260,6 @@ if [ "$1" = "1" ] ; then
|
||||
systemctl enable lvm2-monitor.service
|
||||
systemctl start lvm2-monitor.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
%systemd_post lvm2-lvmetad.socket
|
||||
systemctl start lvm2-lvmetad.socket >/dev/null 2>&1 || :
|
||||
|
||||
%systemd_post lvm2-lvmpolld.socket
|
||||
systemctl enable lvm2-lvmpolld.socket
|
||||
@ -282,12 +267,10 @@ systemctl start lvm2-lvmpolld.socket >/dev/null 2>&1 || :
|
||||
|
||||
%preun
|
||||
%systemd_preun blk-availability.service lvm2-monitor.service
|
||||
%systemd_preun lvm2-lvmetad.service lvm2-lvmetad.socket
|
||||
%systemd_preun lvm2-lvmpolld.service lvm2-lvmpolld.socket
|
||||
|
||||
%postun
|
||||
%systemd_postun lvm2-monitor.service
|
||||
%systemd_postun_with_restart lvm2-lvmetad.service
|
||||
%systemd_postun_with_restart lvm2-lvmpolld.service
|
||||
/sbin/ldconfig
|
||||
|
||||
@ -314,13 +297,11 @@ fi
|
||||
|
||||
%if %{use_lockd_dlm} || %{use_lockd_sanlock}
|
||||
%post lockd
|
||||
%systemd_post lvm2-lvmlockd.service lvm2-lvmlocking.service
|
||||
|
||||
%systemd_post lvmlockd.service lvmlocks.service
|
||||
%preun lockd
|
||||
%systemd_preun lvm2-lvmlockd.service lvm2-lvmlocking.service
|
||||
|
||||
%systemd_preun lvmlockd.service lvmlocks.service
|
||||
%postun lockd
|
||||
%systemd_postun lvm2-lvmlockd.service lvm2-lvmlocking.service
|
||||
%systemd_postun lvmlockd.service lvmlocks.service
|
||||
%endif
|
||||
|
||||
%if %{use_cluster}
|
||||
@ -366,12 +347,9 @@ fi
|
||||
%defattr(555,root,root,-)
|
||||
%{_sbindir}/fsadm
|
||||
%{_sbindir}/lvm
|
||||
%{_sbindir}/lvmconf
|
||||
%{_sbindir}/lvmconfig
|
||||
%{_sbindir}/lvmdump
|
||||
%{_sbindir}/lvmetad
|
||||
%{_sbindir}/lvmpolld
|
||||
%{_libdir}/liblvm2app.so.*
|
||||
%{_libdir}/liblvm2cmd.so.*
|
||||
%{_libdir}/libdevmapper-event-lvm2.so.*
|
||||
|
||||
@ -418,8 +396,6 @@ fi
|
||||
%{_unitdir}/blk-availability.service
|
||||
%{_unitdir}/lvm2-monitor.service
|
||||
%attr(555, -, -) %{_prefix}/lib/systemd/system-generators/lvm2-activation-generator
|
||||
%{_unitdir}/lvm2-lvmetad.socket
|
||||
%{_unitdir}/lvm2-lvmetad.service
|
||||
%{_unitdir}/lvm2-pvscan@.service
|
||||
%{_unitdir}/lvm2-lvmpolld.socket
|
||||
%{_unitdir}/lvm2-lvmpolld.service
|
||||
@ -449,16 +425,13 @@ fi
|
||||
|
||||
%files devel
|
||||
%defattr(444,root,root,-)
|
||||
%{_libdir}/liblvm2app.so
|
||||
%{_libdir}/liblvm2cmd.so
|
||||
%{_libdir}/libdevmapper-event-lvm2.so
|
||||
%{_libdir}/libdevmapper.so
|
||||
%{_libdir}/libdevmapper-event.so
|
||||
%{_includedir}/lvm2app.h
|
||||
%{_includedir}/lvm2cmd.h
|
||||
%{_includedir}/libdevmapper.h
|
||||
%{_includedir}/libdevmapper-event.h
|
||||
%{_libdir}/pkgconfig/lvm2app.pc
|
||||
%{_libdir}/pkgconfig/devmapper.pc
|
||||
%{_libdir}/pkgconfig/devmapper-event.pc
|
||||
|
||||
@ -467,17 +440,13 @@ fi
|
||||
%{_mandir}/man7/*
|
||||
%{_mandir}/man8/*
|
||||
|
||||
%files -n python3-lvm-deprecated
|
||||
%{python3_sitearch}/*.so
|
||||
%{python3_sitearch}/*.egg-info
|
||||
|
||||
%if %{use_lockd_dlm} || %{use_lockd_sanlock}
|
||||
%files lockd
|
||||
%defattr(444,root,root,-)
|
||||
%%attr(555, -, -) %{_sbindir}/lvmlockd
|
||||
%%attr(555, -, -) %{_sbindir}/lvmlockctl
|
||||
%{_unitdir}/lvm2-lvmlockd.service
|
||||
%{_unitdir}/lvm2-lvmlocking.service
|
||||
%{_unitdir}/lvmlockd.service
|
||||
%{_unitdir}/lvmlocks.service
|
||||
%endif
|
||||
|
||||
%if %{use_cluster}
|
||||
@ -514,6 +483,15 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Aug 6 2020 wuguanghao <wuguanghao3@huawei.com> - 8.2.03.09-3
|
||||
- update master branch device-mapper-version more than LTS branch
|
||||
|
||||
* Fri Jul 24 2020 wuguanghao <wuguanghao3@huawei.com> - 8.2.03.09-2
|
||||
- update device-mapper-version to 1.02.151
|
||||
|
||||
* Thu Jul 14 2020 wuguanghao <wuguanghao3@huawei.com> - 8:2.03.09-1
|
||||
- update lvm2 version to 2.03.09-1
|
||||
|
||||
* Tue Aug 18 2020 smileknife<jackshan2010@aliyun.com> - 8:2.02.187-3
|
||||
- update release for rebuilding
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user