master - lvmdbusd: Use timer instead of thread
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c8e8439b3dc037...
Commit: c8e8439b3dc037fd73a2eab94e7e796cfb8283a1
Parent: 68e7d3496517a70e50edaceff906ad1da23821a6
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Nov 1 17:42:14 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Nov 2 16:35:45 2016 -0500
lvmdbusd: Use timer instead of thread
We had a thread sitting around for cleaning up other processes, changed to
a periodic timer task.
---
daemons/lvmdbusd/background.py | 21 +++++++++------------
daemons/lvmdbusd/main.py | 5 ++---
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/daemons/lvmdbusd/background.py b/daemons/lvmdbusd/background.py
index 6190f0d..ab0ac2a 100644
--- a/daemons/lvmdbusd/background.py
+++ b/daemons/lvmdbusd/background.py
@@ -10,7 +10,6 @@
import threading
import subprocess
from . import cfg
-import time
from .cmdhandler import options_to_cli_args
import dbus
from .utils import pv_range_append, pv_dest_ranges, log_error, log_debug
@@ -112,17 +111,15 @@ def merge(interface_name, lv_uuid, lv_name, merge_options, job_state):
def background_reaper():
- while cfg.run.value != 0:
- with _rlock:
- num_threads = len(_thread_list) - 1
- if num_threads >= 0:
- for i in range(num_threads, -1, -1):
- _thread_list[i].join(0)
- if not _thread_list[i].is_alive():
- log_debug("Removing thread: %s" % _thread_list[i].name)
- _thread_list.pop(i)
-
- time.sleep(3)
+ with _rlock:
+ num_threads = len(_thread_list) - 1
+ if num_threads >= 0:
+ for i in range(num_threads, -1, -1):
+ _thread_list[i].join(0)
+ if not _thread_list[i].is_alive():
+ log_debug("Reaping thread: %s" % _thread_list[i].name)
+ _thread_list.pop(i)
+ return True
def background_execute(command, background_job):
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index 9f7b928..2dca703 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -156,9 +156,8 @@ def main():
cfg.db = lvmdb.DataStore(cfg.args.use_json)
- # Start up thread to monitor pv moves
- thread_list.append(
- threading.Thread(target=background_reaper, name="pv_move_reaper"))
+ # Periodically call function to reap threads that are created
+ GLib.timeout_add(5000, background_reaper)
# Using a thread to process requests.
thread_list.append(threading.Thread(target=process_request))
7 years, 5 months
master - pvscan: fix autoactivation of exported VG
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=68e7d3496517a7...
Commit: 68e7d3496517a70e50edaceff906ad1da23821a6
Parent: 4585785613320f2400b5645a47375308f1ee5289
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Nov 2 16:29:52 2016 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Nov 2 16:29:52 2016 -0500
pvscan: fix autoactivation of exported VG
pvscan --cache -aay was activating LVs in exported VGs
when it should not.
It appears that this was a regression from commit 9b640c36841
"pvscan: use process_each_vg for autoactivate".
---
tools/pvscan.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/tools/pvscan.c b/tools/pvscan.c
index f5367e4..e2b0a83 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -194,6 +194,9 @@ static int _pvscan_autoactivate_single(struct cmd_context *cmd, const char *vg_n
if (vg_is_clustered(vg))
return ECMD_PROCESSED;
+ if (vg_is_exported(vg))
+ return ECMD_PROCESSED;
+
if (is_lockd_type(vg->lock_type))
return ECMD_PROCESSED;
7 years, 5 months
master - blkdeactivate: deactivate dev stack if dev on top already unmounted
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4585785613320f...
Commit: 4585785613320f2400b5645a47375308f1ee5289
Parent: a9651adc84210d88828f9c3c82a0f382a899a650
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Nov 1 16:41:30 2016 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Nov 1 16:52:51 2016 +0100
blkdeactivate: deactivate dev stack if dev on top already unmounted
If blkdeactivate finds out that the device on top of device stack
is already unmounted, it still proceeds with device stack deactivation
underneath now.
This situation can happen if blkdeactivate is started and the mount
point is unmounted in parallel by chance (so when blkdeactivate
gets the the actual umount call, the device is not mounted anymore).
Before, the blkdeactivate added such device to skip list which caused
all the stack underneath to be skipped too on deactivation. Now, we
proceed just as if blkdeactivate did the umount itself.
For example, in the example below, the vg-lvol0 is mounted on /mnt/test
when blkdeactivate is called, but it gets unmounted in parallel later
on when blkdeactivate gets to the actual umount call.
Before this patch (vg-lvol0 underneath not deactivated):
$ blkdeactivate -u
Deactivating block devices:
[UMOUNT]: unmounting vg-lvol0 (dm-2) mounted on /mnt/test... skipping
With this patch applied (vg-lvol0 underneath still deactivated):
$ blkdeactivate -u
Deactivating block devices:
[UMOUNT]: unmounting vg-lvol0 (dm-2) mounted on /mnt/test... already unmounted
[LVM]: deactivating Logical Volume vg/lvol0... done
---
WHATS_NEW | 1 +
scripts/blkdeactivate.sh.in | 5 ++++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 49af38a..311f3b6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.167 -
======================================
+ Fix blkdeactivate to deactivate dev stack if dev on top already unmounted.
Prevent non-synced raid1 repair unless --force
Prevent raid4 creation/conversion on non-supporting kernels
Add direct striped -> raid4 conversion
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
index 50ea2d1..443af9c 100644
--- a/scripts/blkdeactivate.sh.in
+++ b/scripts/blkdeactivate.sh.in
@@ -34,6 +34,7 @@ TOOL=blkdeactivate
DEV_DIR='/dev'
SYS_BLK_DIR='/sys/block'
+MOUNTPOINT="/bin/mountpoint"
UMOUNT="/bin/umount"
DMSETUP="@sbindir@/dmsetup"
LVM="@sbindir@/lvm"
@@ -157,9 +158,11 @@ device_umount_one() {
echo -n " [UMOUNT]: unmounting $name ($kname) mounted on $mnt... "
if eval $UMOUNT $UMOUNT_OPTS "$(printf "%s" "$mnt")" $OUT $ERR; then
echo "done"
- else
+ elif $MOUNTPOINT -q "$mnt"; then
echo "skipping"
add_device_to_skip_list
+ else
+ echo "already unmounted"
fi
else
echo " [SKIP]: unmount of $name ($kname) mounted on $mnt"
7 years, 5 months