Compare commits

...

No commits in common. "c8s" and "c8" have entirely different histories.
c8s ... c8

160 changed files with 3 additions and 2462 deletions

102
.gitignore vendored
View File

@ -1,101 +1 @@
/LVM2.2.02.90.tgz
/LVM2.2.02.91.tgz
/LVM2.2.02.92.tgz
/LVM2.2.02.93.tgz
/LVM2.2.02.94.tgz
/LVM2.2.02.95.tgz
/LVM2.2.02.96.tgz
/LVM2.2.02.97.tgz
/LVM2.2.02.98.tgz
/LVM2.2.02.99.tgz
/LVM2.2.02.102.tgz
/LVM2.2.02.103.tgz
/LVM2.2.02.104.tgz
/LVM2.2.02.105.tgz
/LVM2.2.02.106.tgz
/LVM2.2.02.107.tgz
/LVM2.2.02.108.tgz
/LVM2.2.02.109.tgz
/LVM2.2.02.110.tgz
/LVM2.2.02.111.tgz
/LVM2.2.02.112.tgz
/LVM2.2.02.113.tgz
/LVM2.2.02.114.tgz
/LVM2.2.02.115.tgz
/LVM2.2.02.116.tgz
/LVM2.2.02.118.tgz
/LVM2.2.02.119.tgz
/LVM2.2.02.120.tgz
/LVM2.2.02.122.tgz
/LVM2.2.02.123.tgz
/LVM2.2.02.124.tgz
/LVM2.2.02.125.tgz
/LVM2.2.02.126.tgz
/LVM2.2.02.127.tgz
/LVM2.2.02.128.tgz
/LVM2.2.02.129.tgz
/LVM2.2.02.130.tgz
/LVM2.2.02.131.tgz
/LVM2.2.02.132.tgz
/LVM2.2.02.133.tgz
/LVM2.2.02.134.tgz
/LVM2.2.02.135.tgz
/LVM2.2.02.136.tgz
/LVM2.2.02.137.tgz
/LVM2.2.02.138.tgz
/LVM2.2.02.139.tgz
/LVM2.2.02.140.tgz
/LVM2.2.02.141.tgz
/LVM2.2.02.142.tgz
/LVM2.2.02.143.tgz
/LVM2.2.02.144.tgz
/LVM2.2.02.145.tgz
/LVM2.2.02.146.tgz
/LVM2.2.02.147.tgz
/LVM2.2.02.148.tgz
/LVM2.2.02.149.tgz
/LVM2.2.02.150.tgz
/LVM2.2.02.151.tgz
/LVM2.2.02.152.tgz
/LVM2.2.02.153.tgz
/LVM2.2.02.154.tgz
/LVM2.2.02.155.tgz
/LVM2.2.02.156.tgz
/LVM2.2.02.157.tgz
/LVM2.2.02.158.tgz
/LVM2.2.02.159.tgz
/LVM2.2.02.160.tgz
/LVM2.2.02.161.tgz
/LVM2.2.02.162.tgz
/LVM2.2.02.163.tgz
/LVM2.2.02.164.tgz
/LVM2.2.02.165.tgz
/LVM2.2.02.166.tgz
/LVM2.2.02.167.tgz
/LVM2.2.02.168.tgz
/LVM2.2.02.171.tgz
/LVM2.2.02.172.tgz
/LVM2.2.02.173.tgz
/LVM2.2.02.174.tgz
/LVM2.2.02.175.tgz
/LVM2.2.02.176.tgz
/LVM2.2.02.177.tgz
/LVM2.2.02.179.tgz
/LVM2.2.02.180.tgz
/LVM2.2.02.181.tgz
/LVM2.2.03.00.tgz
/LVM2.2.03.01.tgz
/LVM2.2.03.02.tgz
/LVM2.2.03.04.tgz
/LVM2.2.03.05.tgz
/LVM2.2.03.06.tgz
/LVM2.2.03.07.tgz
/LVM2.2.03.08.tgz
/LVM2.2.03.09.tgz
/lvm2-8801a86.tar.gz
/lvm2-9fe7aba.tar.gz
/lvm2-b84a992.tar.gz
/LVM2.2.03.11.tgz
/lvm2-4dc5d4a.tgz
/LVM2.2.03.12.tgz
/LVM2.2.03.14.tgz
SOURCES/LVM2.2.03.14.tgz

1
.lvm2.metadata Normal file
View File

@ -0,0 +1 @@
e5d4364e823d72b9a08b3aecc13cd677972830f0 SOURCES/LVM2.2.03.14.tgz

View File

@ -1,53 +0,0 @@
From b7334daa69e998b604f59697d7614c54d6373160 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 12 Jan 2022 16:42:01 -0600
Subject: [PATCH 09/12] vgsplit: don't reread vg_to
The destination vg is first written with the EXPORTED flag,
then the source vg is written, then the destination vg is
written again without the EXPORTED flag. Remove an unnecessary
vg_read of the destination vg just before the second write.
(cherry picked from commit 5e428d22d9647a294eba65852078947df5ade48f)
---
tools/vgsplit.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 9d6534e89..c7f4b8af4 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -728,30 +728,6 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
backup(vg_from);
}
- /*
- * 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);
-
- /*
- * This command uses the exported vg flag internally, but
- * exported VGs are not allowed to be split from the command
- * level, so ALLOW_EXPORTED is not set in commands.h.
- */
- cmd->include_exported_vgs = 1;
-
- vg_to = vg_read_for_update(cmd, vg_name_to, NULL, 0, 0);
-
- if (!vg_to) {
- log_error("Volume group \"%s\" became inconsistent: "
- "please fix manually", vg_name_to);
- goto bad;
- }
- }
-
vg_to->status &= ~EXPORTED_VG;
if (!vg_write(vg_to) || !vg_commit(vg_to))
--
2.43.0

View File

@ -1,113 +0,0 @@
From 2ae69ffd78d3dd65843c48e3369b75ae49787fd4 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Wed, 12 Jan 2022 16:46:26 -0600
Subject: [PATCH 10/12] lvmcache: remove lvmcache_update_vg_from_write
After a vg_write, this function was used to attempt to
make lvmcache data match the new state written to disk.
It was not updated correctly in a many or most cases,
and the resulting lvmcache is not actually used after
vg_write, making the update unnecessary.
(cherry picked from commit cb798ee1c102aadde93965a894c5aa59d4e76e4a)
---
lib/cache/lvmcache.c | 44 -----------------------------------------
lib/cache/lvmcache.h | 1 -
lib/metadata/metadata.c | 7 -------
3 files changed, 52 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 04e9f0605..85a1d4806 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -2233,50 +2233,6 @@ int lvmcache_update_vgname_and_id(struct cmd_context *cmd, struct lvmcache_info
return 1;
}
-/*
- * FIXME: quit trying to mirror changes that a command is making into lvmcache.
- *
- * First, it's complicated and hard to ensure it's done correctly in every case
- * (it would be much easier and safer to just toss out what's in lvmcache and
- * reread the info to recreate it from scratch instead of trying to make sure
- * every possible discrete state change is correct.)
- *
- * Second, it's unnecessary if commands just use the vg they are modifying
- * rather than also trying to get info from lvmcache. The lvmcache state
- * should be populated by label_scan, used to perform vg_read's, and then
- * ignored (or dropped so it can't be used).
- *
- * lvmcache info is already used very little after a command begins its
- * operation. The code that's supposed to keep the lvmcache in sync with
- * changes being made to disk could be half wrong and we wouldn't know it.
- * That creates a landmine for someone who might try to use a bit of it that
- * isn't being updated correctly.
- */
-
-int lvmcache_update_vg_from_write(struct volume_group *vg)
-{
- char vgid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
- struct pv_list *pvl;
- struct lvmcache_info *info;
- struct lvmcache_vgsummary vgsummary = {
- .vgname = vg->name,
- .vgstatus = vg->status,
- .system_id = vg->system_id,
- .lock_type = vg->lock_type
- };
-
- memcpy(vgid, &vg->id, ID_LEN);
- memcpy(vgsummary.vgid, vgid, ID_LEN);
-
- dm_list_iterate_items(pvl, &vg->pvs) {
- if ((info = lvmcache_info_from_pv_id(&pvl->pv->id, pvl->pv->dev, 0)) &&
- !lvmcache_update_vgname_and_id(vg->cmd, info, &vgsummary))
- return_0;
- }
-
- return 1;
-}
-
/*
* The lvmcache representation of a VG after label_scan can be incorrect
* because the label_scan does not use the full VG metadata to construct
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index 9511bb9e9..2a48786e1 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -84,7 +84,6 @@ void lvmcache_del_dev(struct device *dev);
int lvmcache_update_vgname_and_id(struct cmd_context *cmd, struct lvmcache_info *info,
struct lvmcache_vgsummary *vgsummary);
int lvmcache_update_vg_from_read(struct volume_group *vg, unsigned precommitted);
-int lvmcache_update_vg_from_write(struct volume_group *vg);
void lvmcache_lock_vgname(const char *vgname, int read_only);
void lvmcache_unlock_vgname(const char *vgname);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c4f65366b..fabc6529a 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3102,7 +3102,6 @@ static int _vg_commit_mdas(struct volume_group *vg)
DM_LIST_INIT(ignored);
int failed = 0;
int good = 0;
- int cache_updated = 0;
/* Rearrange the metadata_areas_in_use so ignored mdas come first. */
dm_list_iterate_items_safe(mda, tmda, &vg->fid->metadata_areas_in_use)
@@ -3123,12 +3122,6 @@ static int _vg_commit_mdas(struct volume_group *vg)
failed = 1;
} else
good++;
-
- /* Update cache first time we succeed */
- if (!failed && !cache_updated) {
- lvmcache_update_vg_from_write(vg);
- cache_updated = 1;
- }
}
if (good)
return 1;
--
2.43.0

View File

@ -1,124 +0,0 @@
From 05bb44d8216fb258fa6d4d0c237ea5c00085dc9e Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 6 Jan 2022 10:15:16 -0600
Subject: [PATCH 11/12] handle duplicate vgids
The approach to duplicate VGIDs has been that it is not possible
or not allowed, so the behavior has been undefined. The actual
result was unpredictable and/or broken, and generally unhelpful.
Improve this by recognizing the problem, displaying the VGs,
and printing a warning to fix the problem. Beyond this,
using VGs with duplicate VGIDs remains undefined, but should
work well enough to correct the problem with vgchange -u.
It's possible to create this condition without too much difficulty
by cloning PVs, followed by an incomplete attempt at making the two
VGs unique (vgrename and pvchange -u, but missing vgchange -u.)
(cherry picked from commit 18f451e09e943eb3d51f8394f6fe8967e1e9f565)
---
lib/cache/lvmcache.c | 20 +++++++++++---
test/shell/duplicate-vgid.sh | 52 ++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 4 deletions(-)
create mode 100644 test/shell/duplicate-vgid.sh
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 85a1d4806..9b3c83736 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -354,9 +354,11 @@ static struct lvmcache_vginfo *_vginfo_lookup(const char *vgname, const char *vg
if (vgid_arg) {
if ((vginfo = dm_hash_lookup(_vgid_hash, vgid))) {
if (vgname && strcmp(vginfo->vgname, vgname)) {
- /* should never happen */
- log_error(INTERNAL_ERROR "vginfo_lookup vgid %s has two names %s %s",
- vgid, vginfo->vgname, vgname);
+ log_warn("WARNING: lookup found duplicate VGID %s for VGs %s and %s.", vgid, vginfo->vgname, vgname);
+ if ((vginfo = dm_hash_lookup(_vgname_hash, vgname))) {
+ if (!memcmp(vginfo->vgid, vgid, ID_LEN))
+ return vginfo;
+ }
return NULL;
}
return vginfo;
@@ -1878,7 +1880,17 @@ static int _lvmcache_update_vgname(struct cmd_context *cmd,
_drop_vginfo(info, info->vginfo);
- if (!(vginfo = lvmcache_vginfo_from_vgid(vgid))) {
+ vginfo = lvmcache_vginfo_from_vgid(vgid);
+ if (vginfo && strcmp(vginfo->vgname, vgname)) {
+ log_warn("WARNING: fix duplicate VGID %s for VGs %s and %s (see vgchange -u).", vgid_dashed, vgname, vginfo->vgname);
+ vginfo = lvmcache_vginfo_from_vgname(vgname, NULL);
+ if (vginfo && memcmp(vginfo->vgid, vgid, ID_LEN)) {
+ log_error("Ignoring %s with conflicting VG info %s %s.", dev_name(info->dev), vgid_dashed, vgname);
+ return_0;
+ }
+ }
+
+ if (!vginfo) {
/*
* Create a vginfo struct for this VG and put the vginfo
* into the hash table.
diff --git a/test/shell/duplicate-vgid.sh b/test/shell/duplicate-vgid.sh
new file mode 100644
index 000000000..12163c2f0
--- /dev/null
+++ b/test/shell/duplicate-vgid.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2008-2013 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.
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux prepare_devs 2
+
+vgcreate $vg1 "$dev1"
+vgchange --setautoactivation n $vg1
+UUID1=$(vgs --noheading -o vg_uuid $vg1 | xargs)
+lvcreate -l1 -an -n $lv1 $vg1
+dd if="$dev1" of="$dev2" bs=1M count=1
+aux disable_dev "$dev1"
+vgrename $vg1 $vg2
+pvchange -u "$dev2"
+aux enable_dev "$dev1"
+
+vgs -o+uuid |tee out
+grep $vg1 out | tee out1
+grep $UUID1 out1
+grep $vg2 out | tee out2
+grep $UUID1 out2
+
+vgs $vg1
+vgs $vg2
+lvs $vg1/$lv1
+lvs $vg2/$lv1
+
+lvremove $vg1/$lv1
+lvremove $vg2/$lv1
+
+lvcreate -l1 -an -n $lv2 $vg1
+lvcreate -l1 -an -n $lv3 $vg2
+
+vgchange -u $vg2
+
+vgs -o uuid $vg1 |tee out
+grep $UUID1 out
+
+vgs -o uuid $vg2 |tee out
+not grep $UUID1 out
+
+vgremove -ff $vg1
+vgremove -ff $vg2
--
2.43.0

View File

@ -1,40 +0,0 @@
From c78f2e6ee218d12fb71fc70cd66a21f4ea324a91 Mon Sep 17 00:00:00 2001
From: David Teigland <teigland@redhat.com>
Date: Thu, 13 Jan 2022 11:41:09 -0600
Subject: [PATCH 12/12] remove unused variable
resulting from commit cb798ee1c102aadde93965a894c5aa59d4e76e4a
"lvmcache: remove lvmcache_update_vg_from_write"
(cherry picked from commit 0c80ea88477b3511562036748d3bf837bf7b3e8b)
---
lib/metadata/metadata.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index fabc6529a..4f947401f 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3100,7 +3100,6 @@ static int _vg_commit_mdas(struct volume_group *vg)
{
struct metadata_area *mda, *tmda;
DM_LIST_INIT(ignored);
- int failed = 0;
int good = 0;
/* Rearrange the metadata_areas_in_use so ignored mdas come first. */
@@ -3115,11 +3114,9 @@ static int _vg_commit_mdas(struct volume_group *vg)
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->status & MDA_FAILED)
continue;
- failed = 0;
if (mda->ops->vg_commit &&
!mda->ops->vg_commit(vg->fid, vg, mda)) {
stack;
- failed = 1;
} else
good++;
}
--
2.43.0

View File

@ -1,31 +0,0 @@
From 068897bbd15e16b666079952f465239d933d2228 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Thu, 31 Aug 2023 18:45:30 +0200
Subject: [PATCH 131/139] dmeventd: move var set to locked section
It should not change the actual code flow, however make the
set of the current_event variable inside locked section.
(cherry picked from commit 29630b2d7fcb28827f0c928edd6cd638f6ea2591)
---
daemons/dmeventd/dmeventd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index d89ab4af8..fa60b6f31 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1043,9 +1043,9 @@ static void *_monitor_thread(void *arg)
_unlock_mutex();
_do_process_event(thread);
- thread->current_events = 0; /* Current events processed */
_lock_mutex();
+ thread->current_events = 0; /* Current events processed */
thread->processing = 0;
/*
--
2.48.1

View File

@ -1,50 +0,0 @@
From d7f61ce3933f75f3ebcd74c2a815cdcea28ea8d5 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 25 Sep 2023 11:51:25 +0200
Subject: [PATCH 132/139] dmeventd: use return
Use 'return' instead of calling exit() when possible.
(cherry picked from commit c31dcf3632988ef4e8d1c62a685f4c436b5f115e)
---
daemons/dmeventd/dmeventd.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index fa60b6f31..9d7118ced 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -2169,17 +2169,17 @@ int main(int argc, char *argv[])
.server_path = DM_EVENT_FIFO_SERVER
};
time_t now, idle_exit_timeout = DMEVENTD_IDLE_EXIT_TIMEOUT;
- opterr = 0;
- optind = 0;
+ optopt = optind = opterr = 0;
+ optarg = (char*) "";
while ((opt = getopt(argc, argv, "?fhVdlR")) != EOF) {
switch (opt) {
case 'h':
_usage(argv[0], stdout);
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
case '?':
_usage(argv[0], stderr);
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
case 'R':
_restart++;
break;
@@ -2194,7 +2194,7 @@ int main(int argc, char *argv[])
break;
case 'V':
printf("dmeventd version: %s\n", DM_LIB_VERSION);
- exit(EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
}
--
2.48.1

View File

@ -1,117 +0,0 @@
From bc94a75dc4705023d7e074363867129563b0d469 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 25 Sep 2023 11:42:53 +0200
Subject: [PATCH 133/139] dmeventd: unregister all devices on restart
Instead of just exiting in the middle of monitoring,
unregisted all monitored devices first and then exit.
To speedup this path, all send internal SIGINT when thread
unregiters itself, to wakup-up main sleeping loop.
(cherry picked from commit 637d812df56440d792ab403f63e50583d78cdfef)
---
daemons/dmeventd/dmeventd.c | 55 ++++++++++++++++++++++++++++---------
1 file changed, 42 insertions(+), 13 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 9d7118ced..e05545403 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -997,6 +997,8 @@ static void _monitor_unregister(void *arg)
_lock_mutex();
thread->status = DM_THREAD_DONE; /* Last access to thread memory! */
_unlock_mutex();
+ if (_exit_now) /* Exit is already in-progress, wake-up sleeping select() */
+ kill(getpid(), SIGINT);
}
/* Device monitoring thread. */
@@ -1161,6 +1163,36 @@ static int _unregister_for_event(struct message_data *message_data)
return ret;
}
+static void _unregister_all_threads(void)
+{
+ struct thread_status *thread, *tmp;
+
+ _lock_mutex();
+
+ dm_list_iterate_items_safe(thread, tmp, &_thread_registry)
+ _update_events(thread, 0);
+
+ _unlock_mutex();
+}
+
+static void _wait_for_new_pid(void)
+{
+ unsigned long st_ino = 0;
+ struct stat st;
+ int i;
+
+ for (i = 0; i < 400000; ++i) {
+ if (lstat(DMEVENTD_PIDFILE, &st) == 0) {
+ if (!st_ino)
+ st_ino = st.st_ino;
+ else if (st_ino != st.st_ino)
+ break; /* different pidfile */
+ } else if (errno == ENOENT)
+ break; /* pidfile is removed */
+ usleep(100);
+ }
+}
+
/*
* Register for an event.
*
@@ -1677,9 +1709,9 @@ static void _process_request(struct dm_event_fifos *fifos)
free(msg.data);
if (cmd == DM_EVENT_CMD_DIE) {
- if (unlink(DMEVENTD_PIDFILE))
- log_sys_error("unlink", DMEVENTD_PIDFILE);
- _exit(0);
+ _unregister_all_threads();
+ _exit_now = DM_SCHEDULED_EXIT;
+ log_info("dmeventd exiting for restart.");
}
}
@@ -1769,7 +1801,8 @@ static void _init_thread_signals(void)
*/
static void _exit_handler(int sig __attribute__((unused)))
{
- _exit_now = DM_SIGNALED_EXIT;
+ if (!_exit_now)
+ _exit_now = DM_SIGNALED_EXIT;
}
#ifdef __linux__
@@ -2116,19 +2149,15 @@ static void _restart_dmeventd(void)
((e = getenv(SD_ACTIVATION_ENV_VAR_NAME)) && strcmp(e, "1")))
_systemd_activation = 1;
- for (i = 0; i < 10; ++i) {
- if ((access(DMEVENTD_PIDFILE, F_OK) == -1) && (errno == ENOENT))
- break;
- usleep(10);
- }
+ fini_fifos(&fifos);
- if (!_systemd_activation) {
- fini_fifos(&fifos);
+ /* Give a few seconds dmeventd to finish */
+ _wait_for_new_pid();
+
+ if (!_systemd_activation)
return;
- }
/* Reopen fifos. */
- fini_fifos(&fifos);
if (!init_fifos(&fifos)) {
fprintf(stderr, "Could not initiate communication with new instance of dmeventd.\n");
exit(EXIT_FAILURE);
--
2.48.1

View File

@ -1,149 +0,0 @@
From 7dfa1f3d0d03cc682bb3bb503d2ad44ff4e836a6 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 25 Sep 2023 11:49:14 +0200
Subject: [PATCH 134/139] dmeventd: info status report
To quickly get info about some internal dmeventd status,
implment 'dmeventd -i' support.
Reported messages are some 'raw' internal informations mainly
useful to developers.
(cherry picked from commit 80d34abf4974e45471f947fb2b85146a30feb87d)
---
daemons/dmeventd/dmeventd.c | 69 +++++++++++++++++++++++++++++++++++--
man/dmeventd.8_main | 7 ++++
2 files changed, 74 insertions(+), 2 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index e05545403..46c34ada2 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -2063,6 +2063,68 @@ static int _reinstate_registrations(struct dm_event_fifos *fifos)
return 1;
}
+static int _info_dmeventd(const char *name, struct dm_event_fifos *fifos)
+{
+ struct dm_event_daemon_message msg = { 0 };
+ int i, count = 0;
+ char *line;
+ int version;
+ int ret = 0;
+
+ /* Get the list of registrations from the running daemon. */
+ if (!init_fifos(fifos)) {
+ fprintf(stderr, "Could not initiate communication with existing dmeventd.\n");
+ return 0;
+ }
+
+ if (!dm_event_get_version(fifos, &version)) {
+ fprintf(stderr, "Could not communicate with existing dmeventd.\n");
+ goto out;
+ }
+
+ if (version < 1) {
+ fprintf(stderr, "The running dmeventd instance is too old.\n"
+ "Protocol version %d (required: 1). Action cancelled.\n", version);
+ goto out;
+ }
+
+ if (daemon_talk(fifos, &msg, DM_EVENT_CMD_GET_STATUS, "-", "-", 0, 0)) {
+ fprintf(stderr, "Failed to acquire status from existing dmeventd.\n");
+ goto out;
+ }
+
+ line = strchr(msg.data, ' ') + 1;
+ for (i = 0; msg.data[i]; ++i)
+ if (msg.data[i] == ';') {
+ msg.data[i] = 0;
+ if (!count)
+ printf("%s is monitoring:\n", name);
+ printf("%s\n", line);
+ line = msg.data + i + 1;
+ ++count;
+ }
+
+ free(msg.data);
+
+ if (!count)
+ printf("%s does not monitor any device.\n", name);
+
+ if (version >= 2) {
+ if (daemon_talk(fifos, &msg, DM_EVENT_CMD_GET_PARAMETERS, "-", "-", 0, 0)) {
+ fprintf(stderr, "Failed to acquire parameters from existing dmeventd.\n");
+ goto out;
+ }
+ printf("%s internal status: %s\n", name, msg.data);
+ free(msg.data);
+ }
+
+ ret = 1;
+out:
+ fini_fifos(fifos);
+
+ return ret;
+}
+
static void _restart_dmeventd(void)
{
struct dm_event_fifos fifos = {
@@ -2178,10 +2240,11 @@ bad:
static void _usage(char *prog, FILE *file)
{
fprintf(file, "Usage:\n"
- "%s [-d [-d [-d]]] [-f] [-h] [-l] [-R] [-V] [-?]\n\n"
+ "%s [-d [-d [-d]]] [-f] [-h] [i] [-l] [-R] [-V] [-?]\n\n"
" -d Log debug messages to syslog (-d, -dd, -ddd)\n"
" -f Don't fork, run in the foreground\n"
" -h Show this help information\n"
+ " -i Query running instance of dmeventd for info\n"
" -l Log to stdout,stderr instead of syslog\n"
" -? Show this help information on stderr\n"
" -R Restart dmeventd\n"
@@ -2201,7 +2264,7 @@ int main(int argc, char *argv[])
optopt = optind = opterr = 0;
optarg = (char*) "";
- while ((opt = getopt(argc, argv, "?fhVdlR")) != EOF) {
+ while ((opt = getopt(argc, argv, "?fhiVdlR")) != EOF) {
switch (opt) {
case 'h':
_usage(argv[0], stdout);
@@ -2209,6 +2272,8 @@ int main(int argc, char *argv[])
case '?':
_usage(argv[0], stderr);
return EXIT_SUCCESS;
+ case 'i':
+ return _info_dmeventd(argv[0], &fifos) ? EXIT_SUCCESS : EXIT_FAILURE;
case 'R':
_restart++;
break;
diff --git a/man/dmeventd.8_main b/man/dmeventd.8_main
index 77b07e4d8..75926bae5 100644
--- a/man/dmeventd.8_main
+++ b/man/dmeventd.8_main
@@ -12,6 +12,7 @@ dmeventd \(em Device-mapper event daemon
.RB [ -d ]]]
.RB [ -f ]
.RB [ -h ]
+.RB [ -i ]
.RB [ -l ]
.RB [ -R ]
.RB [ -V ]
@@ -44,6 +45,12 @@ Don't fork, run in the foreground.
Show help information.
.
.TP
+.B -i
+Query the running daemon instance for the status informations. The format is
+internal and unstable and it is targeted for developers.
+Format may change between versions.
+.
+.TP
.B -l
Log through stdout and stderr instead of syslog.
This option works only with option -f, otherwise it is ignored.
--
2.48.1

View File

@ -1,68 +0,0 @@
From ebe966020d2378bcc1a7f61551d4278bde6b8f6c Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 25 Sep 2023 15:48:06 +0200
Subject: [PATCH 135/139] configure.ac: add --with-dmeventd-exit-on-path
(cherry picked from commit 744cdc3ba885f9dc8e1444cb77a190d5ea0007ed)
---
configure.ac | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6cdf1a7e6..01e0b4d51 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1715,24 +1715,29 @@ AC_DEFINE_UNQUOTED(LVMIMPORTVDO_PATH, ["$LVMIMPORTVDO_PATH"], [Path to lvm_impor
################################################################################
dnl -- dmeventd pidfile and executable path
+AC_ARG_WITH(dmeventd-pidfile,
+ AS_HELP_STRING([--with-dmeventd-pidfile=PATH],
+ [dmeventd pidfile [PID_DIR/dmeventd.pid]]),
+ DMEVENTD_PIDFILE=$withval,
+ DMEVENTD_PIDFILE="$DEFAULT_PID_DIR/dmeventd.pid")
+AC_ARG_WITH(dmeventd-path,
+ AS_HELP_STRING([--with-dmeventd-path=PATH],
+ [dmeventd path [EPREFIX/sbin/dmeventd]]),
+ DMEVENTD_PATH=$withval,
+ DMEVENTD_PATH="$SBINDIR/dmeventd")
+AC_ARG_WITH(dmeventd-exit-on-path,
+ AS_HELP_STRING([--with-dmeventd-exit-on-path=PATH],
+ [Default path to exit-on file in dmeventd [/run/nologin]]),
+ DEFAULT_DMEVENTD_EXIT_ON_PATH=$withval,
+ DEFAULT_DMEVENTD_EXIT_ON_PATH="/run/nologin")
+
if test "$BUILD_DMEVENTD" = yes; then
- AC_ARG_WITH(dmeventd-pidfile,
- AS_HELP_STRING([--with-dmeventd-pidfile=PATH],
- [dmeventd pidfile [PID_DIR/dmeventd.pid]]),
- DMEVENTD_PIDFILE=$withval,
- DMEVENTD_PIDFILE="$DEFAULT_PID_DIR/dmeventd.pid")
AC_DEFINE_UNQUOTED(DMEVENTD_PIDFILE, ["$DMEVENTD_PIDFILE"],
[Path to dmeventd pidfile.])
-fi
-
-if test "$BUILD_DMEVENTD" = yes; then
- AC_ARG_WITH(dmeventd-path,
- AS_HELP_STRING([--with-dmeventd-path=PATH],
- [dmeventd path [EPREFIX/sbin/dmeventd]]),
- DMEVENTD_PATH=$withval,
- DMEVENTD_PATH="$SBINDIR/dmeventd")
AC_DEFINE_UNQUOTED(DMEVENTD_PATH, ["$DMEVENTD_PATH"],
[Path to dmeventd binary.])
+ AC_DEFINE_UNQUOTED(DEFAULT_DMEVENTD_EXIT_ON_PATH, ["$DEFAULT_DMEVENTD_EXIT_ON_PATH"],
+ [Path to exit-on dmeventd file.])
fi
################################################################################
@@ -1861,6 +1866,7 @@ AC_SUBST(DEFAULT_ARCHIVE_SUBDIR)
AC_SUBST(DEFAULT_BACKUP_SUBDIR)
AC_SUBST(DEFAULT_CACHE_SUBDIR)
AC_SUBST(DEFAULT_DM_RUN_DIR)
+AC_SUBST(DEFAULT_DMEVENTD_EXIT_ON_PATH)
AC_SUBST(DEFAULT_LOCK_DIR)
AC_SUBST(DEFAULT_MIRROR_SEGTYPE)
AC_SUBST(DEFAULT_PID_DIR)
--
2.48.1

View File

@ -1,111 +0,0 @@
From c499428897b8ea51eefd7a90f4141e532ec9fbb9 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 25 Sep 2023 15:49:52 +0200
Subject: [PATCH 136/139] configure: autoreconf
(cherry picked from commit 3da18a06d8e0671374f9bf8b841017cfd5d1e5ea)
---
configure | 33 +++++++++++++++++++++++----------
include/configure.h.in | 3 +++
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/configure b/configure
index cfad36e51..17083e7ff 100755
--- a/configure
+++ b/configure
@@ -730,6 +730,7 @@ DEFAULT_PROFILE_SUBDIR
DEFAULT_PID_DIR
DEFAULT_MIRROR_SEGTYPE
DEFAULT_LOCK_DIR
+DEFAULT_DMEVENTD_EXIT_ON_PATH
DEFAULT_DM_RUN_DIR
DEFAULT_CACHE_SUBDIR
DEFAULT_BACKUP_SUBDIR
@@ -989,6 +990,7 @@ with_systemdsystemunitdir
with_tmpfilesdir
with_dmeventd_pidfile
with_dmeventd_path
+with_dmeventd_exit_on_path
with_default_system_dir
with_default_profile_subdir
with_default_archive_subdir
@@ -1793,6 +1795,9 @@ Optional Packages:
dmeventd pidfile [PID_DIR/dmeventd.pid]
--with-dmeventd-path=PATH
dmeventd path [EPREFIX/sbin/dmeventd]
+ --with-dmeventd-exit-on-path=PATH
+ Default path to exit-on file in dmeventd
+ [/run/nologin]
--with-default-system-dir=DIR
default LVM system directory [/etc/lvm]
--with-default-profile-subdir=SUBDIR
@@ -14081,8 +14086,6 @@ _ACEOF
################################################################################
-if test "$BUILD_DMEVENTD" = yes; then
-
# Check whether --with-dmeventd-pidfile was given.
if test "${with_dmeventd_pidfile+set}" = set; then :
withval=$with_dmeventd_pidfile; DMEVENTD_PIDFILE=$withval
@@ -14091,14 +14094,6 @@ else
fi
-cat >>confdefs.h <<_ACEOF
-#define DMEVENTD_PIDFILE "$DMEVENTD_PIDFILE"
-_ACEOF
-
-fi
-
-if test "$BUILD_DMEVENTD" = yes; then
-
# Check whether --with-dmeventd-path was given.
if test "${with_dmeventd_path+set}" = set; then :
withval=$with_dmeventd_path; DMEVENTD_PATH=$withval
@@ -14107,10 +14102,28 @@ else
fi
+# Check whether --with-dmeventd-exit-on-path was given.
+if test "${with_dmeventd_exit_on_path+set}" = set; then :
+ withval=$with_dmeventd_exit_on_path; DEFAULT_DMEVENTD_EXIT_ON_PATH=$withval
+else
+ DEFAULT_DMEVENTD_EXIT_ON_PATH="/run/nologin"
+fi
+
+
+if test "$BUILD_DMEVENTD" = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define DMEVENTD_PIDFILE "$DMEVENTD_PIDFILE"
+_ACEOF
+
cat >>confdefs.h <<_ACEOF
#define DMEVENTD_PATH "$DMEVENTD_PATH"
_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_DMEVENTD_EXIT_ON_PATH "$DEFAULT_DMEVENTD_EXIT_ON_PATH"
+_ACEOF
+
fi
################################################################################
diff --git a/include/configure.h.in b/include/configure.h.in
index e0d971bbf..b8b728b73 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -48,6 +48,9 @@
/* Name of default metadata cache subdirectory. */
#undef DEFAULT_CACHE_SUBDIR
+/* Path to exit-on dmeventd file. */
+#undef DEFAULT_DMEVENTD_EXIT_ON_PATH
+
/* Define default node creation behavior with dmsetup create */
#undef DEFAULT_DM_ADD_NODE
--
2.48.1

View File

@ -1,196 +0,0 @@
From b7dd2a9e5973544f248aeeb7bc0b5e7afbd27d9b Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 25 Sep 2023 13:07:00 +0200
Subject: [PATCH 137/139] dmeventd: implement exit_on file check
When exit on file is present in a system and term/break signal is
catched, them dmeventd is no longger refusing to exit.
For the correct shutdown, there should be ideally unmonitoring call,
however in some case it's very hard to implement this correct procedure.
With this 'exit on' file dmeventd at least avoid 'blocking' shutdown,
before systemd kills use with -9 anyway possibly even in some unwanted
stated of internal dmeventd processing (i.e. in the middle of some lvm
command processing).
(cherry picked from commit a9d7a9d1289d7cafa1db5fd1e41417bf4f7709d1)
---
daemons/dmeventd/dmeventd.c | 57 ++++++++++++++++++++++++++++---------
make.tmpl.in | 1 +
man/Makefile.in | 1 +
man/dmeventd.8_main | 12 ++++++++
4 files changed, 58 insertions(+), 13 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 46c34ada2..828bc0c7a 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -98,6 +98,7 @@ static int _systemd_activation = 0;
static int _foreground = 0;
static int _restart = 0;
static time_t _idle_since = 0;
+static const char *_exit_on = DEFAULT_DMEVENTD_EXIT_ON_PATH;
static char **_initial_registrations = 0;
/* FIXME Make configurable at runtime */
@@ -723,12 +724,18 @@ static int _get_status(struct message_data *message_data)
static int _get_parameters(struct message_data *message_data) {
struct dm_event_daemon_message *msg = message_data->msg;
int size;
+ char idle_buf[32] = "";
+
+ if (_idle_since)
+ (void)dm_snprintf(idle_buf, sizeof(idle_buf), " idle=%lu", (long unsigned) (time(NULL) - _idle_since));
free(msg->data);
- if ((size = dm_asprintf(&msg->data, "%s pid=%d daemon=%s exec_method=%s",
+ if ((size = dm_asprintf(&msg->data, "%s pid=%d daemon=%s exec_method=%s exit_on=\"%s\"%s",
message_data->id, getpid(),
_foreground ? "no" : "yes",
- _systemd_activation ? "systemd" : "direct")) < 0) {
+ _systemd_activation ? "systemd" : "direct",
+ _exit_on,
+ idle_buf)) < 0) {
stack;
return -ENOMEM;
}
@@ -2240,8 +2247,9 @@ bad:
static void _usage(char *prog, FILE *file)
{
fprintf(file, "Usage:\n"
- "%s [-d [-d [-d]]] [-f] [-h] [i] [-l] [-R] [-V] [-?]\n\n"
+ "%s [-d [-d [-d]]] [-e path] [-f] [-h] [i] [-l] [-R] [-V] [-?]\n\n"
" -d Log debug messages to syslog (-d, -dd, -ddd)\n"
+ " -e Select a file path checked on exit\n"
" -f Don't fork, run in the foreground\n"
" -h Show this help information\n"
" -i Query running instance of dmeventd for info\n"
@@ -2264,7 +2272,7 @@ int main(int argc, char *argv[])
optopt = optind = opterr = 0;
optarg = (char*) "";
- while ((opt = getopt(argc, argv, "?fhiVdlR")) != EOF) {
+ while ((opt = getopt(argc, argv, ":?e:fhiVdlR")) != EOF) {
switch (opt) {
case 'h':
_usage(argv[0], stdout);
@@ -2277,6 +2285,13 @@ int main(int argc, char *argv[])
case 'R':
_restart++;
break;
+ case 'e':
+ if (strchr(optarg, '"')) {
+ fprintf(stderr, "dmeventd: option -e does not accept path \"%s\" with '\"' character.\n", optarg);
+ return EXIT_FAILURE;
+ }
+ _exit_on=optarg;
+ break;
case 'f':
_foreground++;
break;
@@ -2289,6 +2304,9 @@ int main(int argc, char *argv[])
case 'V':
printf("dmeventd version: %s\n", DM_LIB_VERSION);
return EXIT_SUCCESS;
+ case ':':
+ fprintf(stderr, "dmeventd: option -%c requires an argument.\n", optopt);
+ return EXIT_FAILURE;
}
}
@@ -2379,15 +2397,28 @@ int main(int argc, char *argv[])
break;
}
}
- } else if (_exit_now == DM_SIGNALED_EXIT) {
- _exit_now = DM_SCHEDULED_EXIT;
- /*
- * When '_exit_now' is set, signal has been received,
- * but can not simply exit unless all
- * threads are done processing.
- */
- log_info("dmeventd received break, scheduling exit.");
- }
+ } else
+ switch (_exit_now) {
+ case DM_SIGNALED_EXIT:
+ _exit_now = DM_SCHEDULED_EXIT;
+ /*
+ * When '_exit_now' is set, signal has been received,
+ * but can not simply exit unless all
+ * threads are done processing.
+ */
+ log_info("dmeventd received break, scheduling exit.");
+ /* fall through */
+ case DM_SCHEDULED_EXIT:
+ /* While exit is scheduled, check for exit_on file */
+ DEBUGLOG("Checking exit on file \"%s\".", _exit_on);
+ if (_exit_on[0] && (access(_exit_on, F_OK) == 0)) {
+ log_info("dmeventd detected exit on file %s, unregistering all monitored devices.",
+ _exit_on);
+ _unregister_all_threads();
+ }
+ break;
+ }
+
_process_request(&fifos);
_cleanup_unused_threads();
}
diff --git a/make.tmpl.in b/make.tmpl.in
index 7799a8adb..99170ca7f 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -147,6 +147,7 @@ DEFAULT_LOCK_DIR = @DEFAULT_LOCK_DIR@
DEFAULT_RUN_DIR = @DEFAULT_RUN_DIR@
DEFAULT_PID_DIR = @DEFAULT_PID_DIR@
DEFAULT_MANGLING = @MANGLING@
+DEFAULT_DMEVENTD_EXIT_ON_PATH = @DEFAULT_DMEVENTD_EXIT_ON_PATH@
# Setup vpath search paths for some suffixes
vpath %.c $(srcdir)
diff --git a/man/Makefile.in b/man/Makefile.in
index ba6f2046f..f324150de 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -181,6 +181,7 @@ $(SED) -e "s+#VERSION#+$(LVM_VERSION)+" \
-e "s+#DEFAULT_PID_DIR#+$(DEFAULT_PID_DIR)+" \
-e "s+#SYSTEMD_GENERATOR_DIR#+$(SYSTEMD_GENERATOR_DIR)+" \
-e "s+#DEFAULT_LIBLINE#+$(DEFAULT_LIBLINE)+" \
+ -e "s+#DEFAULT_DMEVENTD_EXIT_ON_PATH#+$(DEFAULT_DMEVENTD_EXIT_ON_PATH)+" \
-e "s+#DEFAULT_MANGLING#+$(DEFAULT_MANGLING)+" $< > $@
endef
diff --git a/man/dmeventd.8_main b/man/dmeventd.8_main
index 75926bae5..7a780da7c 100644
--- a/man/dmeventd.8_main
+++ b/man/dmeventd.8_main
@@ -10,6 +10,8 @@ dmeventd \(em Device-mapper event daemon
.RB [ -d
.RB [ -d
.RB [ -d ]]]
+.RB [ -e
+.BR exit_on_path ]
.RB [ -f ]
.RB [ -h ]
.RB [ -i ]
@@ -37,6 +39,16 @@ debug messages sent to syslog.
Each extra d adds more debugging information.
.
.TP
+.B -e exit_on_path
+Specifies the file path whose presence is checked by the daemon when it
+receives a signal (SIGINT, SIGTERM) and allows to exit even if there are still
+monitored devices.
+This can help with system shutdown where devices
+have not been unmonitored properly.
+To disable this behavior set this to the empty string "".
+Default value is "\fI#DEFAULT_DMEVENTD_EXIT_ON_PATH#\fP".
+.
+.TP
.B -f
Don't fork, run in the foreground.
.
--
2.48.1

View File

@ -1,118 +0,0 @@
From 490631e2cd0947116f21192837703b2e563b863c Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Wed, 20 Sep 2023 15:36:54 +0200
Subject: [PATCH 138/139] debug: correct level
No error for just tracing message.
(cherry picked from commit e930ee93f7361a7b0b7a357acc4187bf630b7f14)
---
daemons/dmeventd/dmeventd.c | 20 ++++++++++----------
device_mapper/ioctl/libdm-iface.c | 2 +-
libdm/ioctl/libdm-iface.c | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 828bc0c7a..f529f8ac5 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1765,7 +1765,7 @@ static void _cleanup_unused_threads(void)
DEBUGLOG("Destroying Thr %x.", (int)thread->thread);
if (pthread_join(thread->thread, NULL))
- log_sys_error("pthread_join", "");
+ log_sys_debug("pthread_join", "");
_free_thread_status(thread);
_lock_mutex();
@@ -1796,7 +1796,7 @@ static void _init_thread_signals(void)
sigdelset(&my_sigset, SIGQUIT);
if (pthread_sigmask(SIG_BLOCK, &my_sigset, NULL))
- log_sys_error("pthread_sigmask", "SIG_BLOCK");
+ log_sys_debug("pthread_sigmask", "SIG_BLOCK");
}
/*
@@ -1825,7 +1825,7 @@ static int _set_oom_adj(const char *oom_adj_path, int val)
fprintf(fp, "%i", val);
if (dm_fclose(fp))
- log_sys_error("fclose", oom_adj_path);
+ log_sys_debug("fclose", oom_adj_path);
return 1;
}
@@ -1839,11 +1839,11 @@ static int _protect_against_oom_killer(void)
if (stat(OOM_ADJ_FILE, &st) == -1) {
if (errno != ENOENT)
- log_sys_error("stat", OOM_ADJ_FILE);
+ log_sys_debug("stat", OOM_ADJ_FILE);
/* Try old oom_adj interface as a fallback */
if (stat(OOM_ADJ_FILE_OLD, &st) == -1) {
- log_sys_error("stat", OOM_ADJ_FILE_OLD);
+ log_sys_debug("stat", OOM_ADJ_FILE_OLD);
return 1;
}
@@ -1932,14 +1932,14 @@ out:
static void _remove_files_on_exit(void)
{
if (unlink(DMEVENTD_PIDFILE))
- log_sys_error("unlink", DMEVENTD_PIDFILE);
+ log_sys_debug("unlink", DMEVENTD_PIDFILE);
if (!_systemd_activation) {
if (unlink(DM_EVENT_FIFO_CLIENT))
- log_sys_error("unlink", DM_EVENT_FIFO_CLIENT);
+ log_sys_debug("unlink", DM_EVENT_FIFO_CLIENT);
if (unlink(DM_EVENT_FIFO_SERVER))
- log_sys_error("unlink", DM_EVENT_FIFO_SERVER);
+ log_sys_debug("unlink", DM_EVENT_FIFO_SERVER);
}
}
@@ -2428,9 +2428,9 @@ int main(int argc, char *argv[])
log_notice("dmeventd shutting down.");
if (fifos.client >= 0 && close(fifos.client))
- log_sys_error("client close", fifos.client_path);
+ log_sys_debug("client close", fifos.client_path);
if (fifos.server >= 0 && close(fifos.server))
- log_sys_error("server close", fifos.server_path);
+ log_sys_debug("server close", fifos.server_path);
if (_use_syslog)
closelog();
diff --git a/device_mapper/ioctl/libdm-iface.c b/device_mapper/ioctl/libdm-iface.c
index 533bb9eea..b09284118 100644
--- a/device_mapper/ioctl/libdm-iface.c
+++ b/device_mapper/ioctl/libdm-iface.c
@@ -397,7 +397,7 @@ static void _close_control_fd(void)
{
if (_control_fd != -1) {
if (close(_control_fd) < 0)
- log_sys_error("close", "_control_fd");
+ log_sys_debug("close", "_control_fd");
_control_fd = -1;
}
}
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 28589a15c..7c7259874 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -396,7 +396,7 @@ static void _close_control_fd(void)
{
if (_control_fd != -1) {
if (close(_control_fd) < 0)
- log_sys_error("close", "_control_fd");
+ log_sys_debug("close", "_control_fd");
_control_fd = -1;
}
}
--
2.48.1

View File

@ -1,54 +0,0 @@
From 4f4a5c39ae768714925809970598b15268cd4ddb Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 26 Sep 2023 01:21:41 +0200
Subject: [PATCH 139/139] tests: check exit_on works
(cherry picked from commit cb8486a9b2d6f3c73749f98287cad6adbc4f857f)
---
test/shell/dmeventd-restart.sh | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/test/shell/dmeventd-restart.sh b/test/shell/dmeventd-restart.sh
index 0def8c1fa..96e4c7cff 100644
--- a/test/shell/dmeventd-restart.sh
+++ b/test/shell/dmeventd-restart.sh
@@ -46,8 +46,8 @@ rm LOCAL_DMEVENTD debug.log*
dmeventd -R -f &
echo $! >LOCAL_DMEVENTD
-# wait longer as tries to communicate with killed daemon
-sleep 9
+# wait longer as tries 5s to communicate with killed daemon
+sleep 7
# now dmeventd should not be running
not pgrep dmeventd
rm LOCAL_DMEVENTD
@@ -63,4 +63,24 @@ test -e LOCAL_CLVMD || not grep 'already monitored' lvchange.out
lvchange --monitor y --verbose $vg/$lv2 2>&1 | tee lvchange.out
test -e LOCAL_CLVMD || not grep 'already monitored' lvchange.out
-vgremove -ff $vg
+rm -f debug.log*
+dmeventd -R -f -e "$PWD/test_nologin" -ldddd > debug.log_DMEVENTD_$RANDOM 2>&1 &
+echo $! >LOCAL_DMEVENTD
+
+pgrep -o dmeventd
+kill -INT "$(< LOCAL_DMEVENTD)"
+sleep 1
+
+# dmeventd should be still present (although in 'exit-mode')
+pgrep -o dmeventd
+
+# Create a file simulating 'shutdown in progress'
+touch test_nologin
+sleep 1.1
+
+# Should be now dead (within 1 second)
+not pgrep -o dmeventd
+rm -f LOCAL_DMEVENTD
+
+# Do not run dmeventd here again
+vgremove -ff --config 'activation/monitoring = 0' $vg
--
2.48.1

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAABAgAGBQJhb+6rAAoJELkRJDHlCQOfBO4P/3d0ccQfFany0wbXfYRuS+1G
HYc0S5LPyhhhTIKRGpBOCEGnSwPlUxcP6mnxhwfrcDOYLl4z9Pj1NGnaYoQxpCHw
fQ4Lzzr6Fdt5TFIkGiVSbQynh/ybyOxfTuD5fMzWmEKrJ1ZNhTv0sDOqPoqLrS8o
W4C573IW9BEGN7CeHTcbcdpnUwt4GGsbsR2S5fGdKUo0Jw/PTY67wiCCTM0F92Qp
S3fkPQ+GWagXTTecrX5MeFjMrQIk3cOMBDvxccHMthzDEyjNtGoOJfmZV66eMzs2
XDW0r6t/h5tX535QOWEjqazYavfUcTQn99+0X4dwbVxVa9h1baKo9bhOM4k7PyOx
XUXDiZYVvsCP/W+Sr69rxOSbzhClg3Y/8riw5Ttf2ygXdUgI7ce0Rnc8irslJCwJ
PyYKFMDxHDaor4LbRJL3ZpaWopoARkRKGJYMsU8VOHDPf0cIfN1JdbOiatqj5CQz
DfCKWzxqz88ZM8GyHxSHZ6bRtEOM6RtCiIONn66AgMHxObKxZ3604BFvv2jaJiVt
MvditBmlvjYaPjNjomSwxgdhs5gkbERJH7kkXgB8RNR2UIPNZhcTSd1xLrkeRpP2
jt7kUR0NR4lab8qal8paIyQLSrcBTsngAI9EYxIgwN1gLcUWfxDJOOJt4tyrqy5v
qcvHOjD884RQSdTYXfe0
=VTpu
-----END PGP SIGNATURE-----