Add various fixes from upcoming lvm2 upstream release.
This commit is contained in:
parent
9c541cc7ad
commit
41e4f25c4e
@ -0,0 +1,252 @@
|
||||
commit 03ed86585e1bfbaf5df1e3488b6268b8887ca427
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:17:52 2013 +0200
|
||||
|
||||
lvm2-2_02_99-add-dm-disable-udev-env-var-and-fix-noudevsync-arg.patch
|
||||
---
|
||||
WHATS_NEW | 2 ++
|
||||
WHATS_NEW_DM | 1 +
|
||||
lib/commands/toolcontext.c | 62 ++++++++++++++++++++++++++++++++++------------
|
||||
libdm/libdm-common.c | 43 ++++++++++++++++++++++++++------
|
||||
tools/lvmcmdline.c | 4 +--
|
||||
5 files changed, 86 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 1bdfeb0..8516f40 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,7 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
|
||||
+ Do not verify udev operations if --noudevsync command option is used.
|
||||
Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
|
||||
Fix a crash-inducing race condition in lvmetad while updating metadata.
|
||||
Fix possible race while removing metadata from lvmetad.
|
||||
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
|
||||
index e0b8d51..9574fdf 100644
|
||||
--- a/WHATS_NEW_DM
|
||||
+++ b/WHATS_NEW_DM
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 1.02.78 -
|
||||
===================================
|
||||
+ Add DM_DISABLE_UDEV environment variable to manage dev nodes by libdm only.
|
||||
Automatically deactivate failed preloaded dm tree node.
|
||||
Fix dm_task_set_cookie to properly process udev flags if udev_sync disabled.
|
||||
|
||||
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||
index eb1a90b..80d0f3e 100644
|
||||
--- a/lib/commands/toolcontext.c
|
||||
+++ b/lib/commands/toolcontext.c
|
||||
@@ -211,6 +211,21 @@ static void _init_logging(struct cmd_context *cmd)
|
||||
reset_lvm_errno(1);
|
||||
}
|
||||
|
||||
+static int _check_disable_udev(const char *msg) {
|
||||
+ if (getenv("DM_DISABLE_UDEV")) {
|
||||
+ log_very_verbose("DM_DISABLE_UDEV environment variable set. "
|
||||
+ "Overriding configuration to use "
|
||||
+ "udev_rules=0, udev_sync=0, verify_udev_operations=1.");
|
||||
+ if (udev_is_running())
|
||||
+ log_warn("Udev is running and DM_DISABLE_UDEV environment variable is set. "
|
||||
+ "Bypassing udev, LVM will %s.", msg);
|
||||
+
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
#ifdef UDEV_SYNC_SUPPORT
|
||||
/*
|
||||
* Until the DM_UEVENT_GENERATED_FLAG was introduced in kernel patch
|
||||
@@ -237,6 +252,7 @@ static int _process_config(struct cmd_context *cmd)
|
||||
const struct dm_config_value *cv;
|
||||
int64_t pv_min_kb;
|
||||
const char *lvmetad_socket;
|
||||
+ int udev_disabled = 0;
|
||||
|
||||
/* umask */
|
||||
cmd->default_settings.umask = find_config_tree_int(cmd,
|
||||
@@ -310,13 +326,20 @@ static int _process_config(struct cmd_context *cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- cmd->default_settings.udev_rules = find_config_tree_int(cmd,
|
||||
- "activation/udev_rules",
|
||||
- DEFAULT_UDEV_RULES);
|
||||
+ /*
|
||||
+ * If udev is disabled using DM_DISABLE_UDEV environment
|
||||
+ * variable, override existing config and hardcode these:
|
||||
+ * - udev_rules = 0
|
||||
+ * - udev_sync = 0
|
||||
+ * - udev_fallback = 1
|
||||
+ */
|
||||
+ udev_disabled = _check_disable_udev("manage logical volume symlinks in device directory");
|
||||
|
||||
- cmd->default_settings.udev_sync = find_config_tree_int(cmd,
|
||||
- "activation/udev_sync",
|
||||
- DEFAULT_UDEV_SYNC);
|
||||
+ cmd->default_settings.udev_rules = udev_disabled ? 0 :
|
||||
+ find_config_tree_int(cmd, "activation/udev_rules", DEFAULT_UDEV_RULES);
|
||||
+
|
||||
+ cmd->default_settings.udev_sync = udev_disabled ? 0 :
|
||||
+ find_config_tree_int(cmd, "activation/udev_sync", DEFAULT_UDEV_SYNC);
|
||||
|
||||
init_retry_deactivation(find_config_tree_int(cmd, "activation/retry_deactivation",
|
||||
DEFAULT_RETRY_DEACTIVATION));
|
||||
@@ -326,14 +349,12 @@ static int _process_config(struct cmd_context *cmd)
|
||||
|
||||
#ifdef UDEV_SYNC_SUPPORT
|
||||
/*
|
||||
- * We need udev rules to be applied, otherwise we would end up with no
|
||||
- * nodes and symlinks! However, we can disable the synchronization itself
|
||||
- * in runtime and still have only udev to create the nodes and symlinks
|
||||
- * without any fallback.
|
||||
+ * Use udev fallback automatically in case udev
|
||||
+ * is disabled via DM_DISABLE_UDEV environment
|
||||
+ * variable or udev rules are switched off.
|
||||
*/
|
||||
- cmd->default_settings.udev_fallback = cmd->default_settings.udev_rules ?
|
||||
- find_config_tree_int(cmd, "activation/verify_udev_operations",
|
||||
- DEFAULT_VERIFY_UDEV_OPERATIONS) : 1;
|
||||
+ cmd->default_settings.udev_fallback = !cmd->default_settings.udev_rules || udev_disabled ? 1 :
|
||||
+ find_config_tree_int(cmd, "activation/verify_udev_operations", DEFAULT_VERIFY_UDEV_OPERATIONS);
|
||||
|
||||
/* Do not rely fully on udev if the udev support is known to be incomplete. */
|
||||
if (!cmd->default_settings.udev_fallback && !_dm_driver_has_stable_udev_support()) {
|
||||
@@ -693,9 +714,18 @@ static int _init_dev_cache(struct cmd_context *cmd)
|
||||
if (!dev_cache_init(cmd))
|
||||
return_0;
|
||||
|
||||
- device_list_from_udev = udev_is_running() ?
|
||||
- find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev",
|
||||
- DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0;
|
||||
+ /*
|
||||
+ * Override existing config and hardcode device_list_from_udev = 0 if:
|
||||
+ * - udev is not running
|
||||
+ * - udev is disabled using DM_DISABLE_UDEV environment variable
|
||||
+ */
|
||||
+ if (_check_disable_udev("obtain device list by scanning device directory"))
|
||||
+ device_list_from_udev = 0;
|
||||
+ else
|
||||
+ device_list_from_udev = udev_is_running() ?
|
||||
+ find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev",
|
||||
+ DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0;
|
||||
+
|
||||
init_obtain_device_list_from_udev(device_list_from_udev);
|
||||
|
||||
if (!(cn = find_config_tree_node(cmd, "devices/scan"))) {
|
||||
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
|
||||
index afdac89..075fba8 100644
|
||||
--- a/libdm/libdm-common.c
|
||||
+++ b/libdm/libdm-common.c
|
||||
@@ -74,6 +74,8 @@ static dm_string_mangling_t _name_mangling_mode = DEFAULT_DM_NAME_MANGLING;
|
||||
static struct selabel_handle *_selabel_handle = NULL;
|
||||
#endif
|
||||
|
||||
+static int _udev_disabled = 0;
|
||||
+
|
||||
#ifdef UDEV_SYNC_SUPPORT
|
||||
static int _semaphore_supported = -1;
|
||||
static int _udev_running = -1;
|
||||
@@ -85,6 +87,9 @@ void dm_lib_init(void)
|
||||
{
|
||||
const char *env;
|
||||
|
||||
+ if ((env = getenv("DM_DISABLE_UDEV")))
|
||||
+ _udev_disabled = 1;
|
||||
+
|
||||
env = getenv(DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME);
|
||||
if (env && *env) {
|
||||
if (!strcasecmp(env, "none"))
|
||||
@@ -1814,6 +1819,26 @@ out:
|
||||
return r;
|
||||
}
|
||||
|
||||
+static void _set_cookie_flags(struct dm_task *dmt, uint16_t flags)
|
||||
+{
|
||||
+ if (!dm_cookie_supported())
|
||||
+ return;
|
||||
+
|
||||
+ if (_udev_disabled) {
|
||||
+ /*
|
||||
+ * If udev is disabled, hardcode this functionality:
|
||||
+ * - we want libdm to create the nodes
|
||||
+ * - we don't want the /dev/mapper and any subsystem
|
||||
+ * related content to be created by udev if udev
|
||||
+ * rules are installed
|
||||
+ */
|
||||
+ flags &= ~DM_UDEV_DISABLE_LIBRARY_FALLBACK;
|
||||
+ flags |= DM_UDEV_DISABLE_DM_RULES_FLAG | DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
|
||||
+ }
|
||||
+
|
||||
+ dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
|
||||
+}
|
||||
+
|
||||
#ifndef UDEV_SYNC_SUPPORT
|
||||
void dm_udev_set_sync_support(int sync_with_udev)
|
||||
{
|
||||
@@ -1835,8 +1860,8 @@ int dm_udev_get_checking(void)
|
||||
|
||||
int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
|
||||
{
|
||||
- if (dm_cookie_supported())
|
||||
- dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
|
||||
+ _set_cookie_flags(dmt, flags);
|
||||
+
|
||||
*cookie = 0;
|
||||
dmt->cookie_set = 1;
|
||||
|
||||
@@ -1908,8 +1933,13 @@ static void _check_udev_sync_requirements_once(void)
|
||||
if (_semaphore_supported < 0)
|
||||
_semaphore_supported = _check_semaphore_is_supported();
|
||||
|
||||
- if (_udev_running < 0)
|
||||
+ if (_udev_running < 0) {
|
||||
_udev_running = _check_udev_is_running();
|
||||
+ if (_udev_disabled && _udev_running)
|
||||
+ log_warn("Udev is running and DM_DISABLE_UDEV environment variable is set. "
|
||||
+ "Bypassing udev, device-mapper library will manage device "
|
||||
+ "nodes in device directory.");
|
||||
+ }
|
||||
}
|
||||
|
||||
void dm_udev_set_sync_support(int sync_with_udev)
|
||||
@@ -1922,8 +1952,8 @@ int dm_udev_get_sync_support(void)
|
||||
{
|
||||
_check_udev_sync_requirements_once();
|
||||
|
||||
- return _semaphore_supported && dm_cookie_supported() &&
|
||||
- _udev_running && _sync_with_udev;
|
||||
+ return !_udev_disabled && _semaphore_supported &&
|
||||
+ dm_cookie_supported() &&_udev_running && _sync_with_udev;
|
||||
}
|
||||
|
||||
void dm_udev_set_checking(int checking)
|
||||
@@ -2203,8 +2233,7 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
|
||||
{
|
||||
int semid;
|
||||
|
||||
- if (dm_cookie_supported())
|
||||
- dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
|
||||
+ _set_cookie_flags(dmt, flags);
|
||||
|
||||
if (!dm_udev_get_sync_support()) {
|
||||
*cookie = 0;
|
||||
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
||||
index 39a8c58..652d57e 100644
|
||||
--- a/tools/lvmcmdline.c
|
||||
+++ b/tools/lvmcmdline.c
|
||||
@@ -901,10 +901,8 @@ static int _get_settings(struct cmd_context *cmd)
|
||||
} else
|
||||
init_trust_cache(0);
|
||||
|
||||
- if (arg_count(cmd, noudevsync_ARG)) {
|
||||
+ if (arg_count(cmd, noudevsync_ARG))
|
||||
cmd->current_settings.udev_sync = 0;
|
||||
- cmd->current_settings.udev_fallback = 1;
|
||||
- }
|
||||
|
||||
/* Handle synonyms */
|
||||
if (!_merge_synonym(cmd, resizable_ARG, resizeable_ARG) ||
|
@ -0,0 +1,34 @@
|
||||
commit 9cff3357bd69f15497af8c03774df07081d361dd
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:04:08 2013 +0200
|
||||
|
||||
lvm2-2_02_99-avoid-global-lock-in-pvs-when-lvmetad-is-in-use.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
tools/toollib.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 62efb53..25e07ee 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Avoid a global lock in pvs when lvmetad is in use.
|
||||
Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
||||
Fix lvm2app to return all property sizes in bytes.
|
||||
Add lvm.conf option global/thin_disabled_features.
|
||||
diff --git a/tools/toollib.c b/tools/toollib.c
|
||||
index 5fe94e0..dce42f4 100644
|
||||
--- a/tools/toollib.c
|
||||
+++ b/tools/toollib.c
|
||||
@@ -701,7 +701,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
|
||||
int opt = 0;
|
||||
int ret_max = ECMD_PROCESSED;
|
||||
int ret = 0;
|
||||
- int lock_global = !(flags & READ_WITHOUT_LOCK) && !(flags & READ_FOR_UPDATE);
|
||||
+ int lock_global = !(flags & READ_WITHOUT_LOCK) && !(flags & READ_FOR_UPDATE) && !lvmetad_active();
|
||||
|
||||
struct pv_list *pvl;
|
||||
struct physical_volume *pv;
|
109
lvm2-2_02_99-close-dmeventd-fifo-fds-on-exec.patch
Normal file
109
lvm2-2_02_99-close-dmeventd-fifo-fds-on-exec.patch
Normal file
@ -0,0 +1,109 @@
|
||||
commit b7e453f3821c4a896e00a29800351687d3365f64
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:26:40 2013 +0200
|
||||
|
||||
lvm2-2_02_99-close-dmeventd-fifo-fds-on-exec.patch
|
||||
---
|
||||
WHATS_NEW_DM | 1 +
|
||||
daemons/dmeventd/dmeventd.c | 37 ++++++++++++++++++++++++++++---------
|
||||
2 files changed, 29 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
|
||||
index 9574fdf..30d01f9 100644
|
||||
--- a/WHATS_NEW_DM
|
||||
+++ b/WHATS_NEW_DM
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 1.02.78 -
|
||||
===================================
|
||||
+ Close open dmeventd FIFO file descriptors on exec (FD_CLOEXEC).
|
||||
Add DM_DISABLE_UDEV environment variable to manage dev nodes by libdm only.
|
||||
Automatically deactivate failed preloaded dm tree node.
|
||||
Fix dm_task_set_cookie to properly process udev flags if udev_sync disabled.
|
||||
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
|
||||
index 13148c3..5f2339f 100644
|
||||
--- a/daemons/dmeventd/dmeventd.c
|
||||
+++ b/daemons/dmeventd/dmeventd.c
|
||||
@@ -1237,7 +1237,8 @@ static int _get_timeout(struct message_data *message_data)
|
||||
/* Initialize a fifos structure with path names. */
|
||||
static void _init_fifos(struct dm_event_fifos *fifos)
|
||||
{
|
||||
- memset(fifos, 0, sizeof(*fifos));
|
||||
+ fifos->client = -1;
|
||||
+ fifos->server = -1;
|
||||
|
||||
fifos->client_path = DM_EVENT_FIFO_CLIENT;
|
||||
fifos->server_path = DM_EVENT_FIFO_SERVER;
|
||||
@@ -1254,7 +1255,7 @@ static int _open_fifos(struct dm_event_fifos *fifos)
|
||||
syslog(LOG_ERR, "%s: Failed to create client fifo %s: %m.\n",
|
||||
__func__, fifos->client_path);
|
||||
(void) dm_prepare_selinux_context(NULL, 0);
|
||||
- return 0;
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
/* Create server fifo. */
|
||||
@@ -1263,7 +1264,7 @@ static int _open_fifos(struct dm_event_fifos *fifos)
|
||||
syslog(LOG_ERR, "%s: Failed to create server fifo %s: %m.\n",
|
||||
__func__, fifos->server_path);
|
||||
(void) dm_prepare_selinux_context(NULL, 0);
|
||||
- return 0;
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
(void) dm_prepare_selinux_context(NULL, 0);
|
||||
@@ -1281,31 +1282,49 @@ static int _open_fifos(struct dm_event_fifos *fifos)
|
||||
if (chmod(fifos->client_path, 0600)) {
|
||||
syslog(LOG_ERR, "Unable to set correct file permissions on %s: %m.\n",
|
||||
fifos->client_path);
|
||||
- return 0;
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
if (chmod(fifos->server_path, 0600)) {
|
||||
syslog(LOG_ERR, "Unable to set correct file permissions on %s: %m.\n",
|
||||
fifos->server_path);
|
||||
- return 0;
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
/* Need to open read+write or we will block or fail */
|
||||
if ((fifos->server = open(fifos->server_path, O_RDWR)) < 0) {
|
||||
syslog(LOG_ERR, "Failed to open fifo server %s: %m.\n",
|
||||
fifos->server_path);
|
||||
- return 0;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (fcntl(fifos->server, F_SETFD, FD_CLOEXEC) < 0) {
|
||||
+ syslog(LOG_ERR, "Failed to set FD_CLOEXEC for fifo server %s: %m.\n",
|
||||
+ fifos->server_path);
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
/* Need to open read+write for select() to work. */
|
||||
if ((fifos->client = open(fifos->client_path, O_RDWR)) < 0) {
|
||||
syslog(LOG_ERR, "Failed to open fifo client %s: %m", fifos->client_path);
|
||||
- if (close(fifos->server))
|
||||
- syslog(LOG_ERR, "Failed to close fifo server %s: %m", fifos->server_path);
|
||||
- return 0;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ if (fcntl(fifos->client, F_SETFD, FD_CLOEXEC) < 0) {
|
||||
+ syslog(LOG_ERR, "Failed to set FD_CLOEXEC for fifo client %s: %m.\n",
|
||||
+ fifos->client_path);
|
||||
+ goto fail;
|
||||
}
|
||||
|
||||
return 1;
|
||||
+fail:
|
||||
+ if (fifos->server >= 0 && close(fifos->server))
|
||||
+ syslog(LOG_ERR, "Failed to close fifo server %s: %m", fifos->server_path);
|
||||
+
|
||||
+ if (fifos->client >= 0 && close(fifos->client))
|
||||
+ syslog(LOG_ERR, "Failed to close fifo client %s: %m", fifos->client_path);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/*
|
@ -0,0 +1,93 @@
|
||||
commit 5025178f95b122c6862dc7d925a7c089f5fb61a8
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:05:50 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-blkdeactivate-handling-of-nested-mountpoints-and-mangled-mount-paths.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
scripts/blkdeactivate.sh.in | 30 ++++++++++++++++++++++++------
|
||||
2 files changed, 25 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 35c5e43..1bdfeb0 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
|
||||
Fix a crash-inducing race condition in lvmetad while updating metadata.
|
||||
Fix possible race while removing metadata from lvmetad.
|
||||
Fix possible deadlock when querying and updating lvmetad at the same time.
|
||||
diff --git a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
|
||||
index 740bac5..be00c24 100644
|
||||
--- a/scripts/blkdeactivate.sh.in
|
||||
+++ b/scripts/blkdeactivate.sh.in
|
||||
@@ -39,6 +39,7 @@ LVM="@sbindir@/lvm"
|
||||
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
|
||||
LSBLK_VARS="local devtype local kname local name local mnt"
|
||||
LSBLK_READ="read -r devtype kname name mnt"
|
||||
+SORT_MNT="/bin/sort -r -u -k 4"
|
||||
|
||||
# Do not unmount mounted devices by default.
|
||||
DO_UMOUNT=0
|
||||
@@ -122,9 +123,11 @@ is_top_level_device() {
|
||||
device_umount () {
|
||||
test -z "$mnt" && return 0;
|
||||
|
||||
+ test "$devtype" != "lvm" && test "${kname:0:3}" != "dm-" && return 0
|
||||
+
|
||||
if test -z "${SKIP_UMOUNT_LIST["$mnt"]}" -a "$DO_UMOUNT" -eq "1"; then
|
||||
echo " UMOUNT: unmounting $name ($kname) mounted on $mnt"
|
||||
- $UMOUNT "$mnt" || add_device_to_skip_list
|
||||
+ $UMOUNT "$(printf $mnt)" || add_device_to_skip_list
|
||||
else
|
||||
echo " [SKIP]: unmount of $name ($kname) mounted on $mnt"
|
||||
add_device_to_skip_list
|
||||
@@ -142,9 +145,6 @@ deactivate_holders () {
|
||||
# check if the device not on the skip list already
|
||||
test -z ${SKIP_DEVICE_LIST["$kname"]} || return 1
|
||||
|
||||
- # try to unmount it if mounted
|
||||
- device_umount || return 1
|
||||
-
|
||||
# try to deactivate the holder
|
||||
test $skip -eq 1 && skip=0 && continue
|
||||
deactivate || return 1
|
||||
@@ -226,7 +226,16 @@ deactivate_all() {
|
||||
echo "Deactivating block devices:"
|
||||
|
||||
if test $# -eq 0; then
|
||||
- # Deactivate all devices
|
||||
+ #######################
|
||||
+ # Process all devices #
|
||||
+ #######################
|
||||
+
|
||||
+ # Unmount all relevant mountpoints first
|
||||
+ while $LSBLK_READ; do
|
||||
+ device_umount
|
||||
+ done <<< "`$LSBLK | $SORT_MNT`"
|
||||
+
|
||||
+ # Do deactivate
|
||||
while $LSBLK_READ; do
|
||||
# 'disk' is at the bottom already and it's a real device
|
||||
test "$devtype" = "disk" && continue
|
||||
@@ -249,8 +258,17 @@ deactivate_all() {
|
||||
deactivate || skip=1
|
||||
done <<< "`$LSBLK -s`"
|
||||
else
|
||||
- # Deactivate only specified devices
|
||||
+ ##################################
|
||||
+ # Process only specified devices #
|
||||
+ ##################################
|
||||
+
|
||||
while test $# -ne 0; do
|
||||
+ # Unmount all relevant mountpoints first
|
||||
+ while $LSBLK_READ; do
|
||||
+ device_umount
|
||||
+ done <<< "`$LSBLK $1 | $SORT_MNT`"
|
||||
+
|
||||
+ # Do deactivate
|
||||
# Single dm device tree deactivation.
|
||||
if test -b "$1"; then
|
||||
$LSBLK_READ <<< "`$LSBLK --nodeps $1`"
|
@ -0,0 +1,175 @@
|
||||
commit 5e247adf415942fcc0a5b888567f51a148619b65
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:03:46 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-crash-in-pvscan-cache-aay-triggered-by-non-mda-pv.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
lib/cache/lvmetad.c | 12 ++++------
|
||||
lib/cache/lvmetad.h | 3 ++-
|
||||
test/shell/lvmetad-pvscan-nomda.sh | 49 ++++++++++++++++++++++++++++++++++++++
|
||||
tools/pvscan.c | 22 +++++++++++++++--
|
||||
5 files changed, 76 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 5231745..62efb53 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
||||
Fix lvm2app to return all property sizes in bytes.
|
||||
Add lvm.conf option global/thin_disabled_features.
|
||||
Add lvconvert support to swap thin pool metadata volume.
|
||||
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
|
||||
index 72e07fd..a636f43 100644
|
||||
--- a/lib/cache/lvmetad.c
|
||||
+++ b/lib/cache/lvmetad.c
|
||||
@@ -675,7 +675,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
|
||||
daemon_reply reply;
|
||||
struct lvmcache_info *info;
|
||||
struct dm_config_tree *pvmeta, *vgmeta;
|
||||
- const char *status;
|
||||
+ const char *status, *vgid;
|
||||
int result;
|
||||
|
||||
if (!lvmetad_active() || test_mode())
|
||||
@@ -724,11 +724,6 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
|
||||
NULL);
|
||||
dm_config_destroy(vgmeta);
|
||||
} else {
|
||||
- if (handler) {
|
||||
- log_error(INTERNAL_ERROR "Handler needs existing VG.");
|
||||
- dm_free(pvmeta);
|
||||
- return 0;
|
||||
- }
|
||||
/* There are no MDAs on this PV. */
|
||||
reply = _lvmetad_send("pv_found", "pvmeta = %t", pvmeta, NULL);
|
||||
}
|
||||
@@ -744,10 +739,11 @@ int lvmetad_pv_found(const struct id *pvid, struct device *device, const struct
|
||||
|
||||
if (result && handler) {
|
||||
status = daemon_reply_str(reply, "status", "<missing>");
|
||||
+ vgid = daemon_reply_str(reply, "vgid", "<missing>");
|
||||
if (!strcmp(status, "partial"))
|
||||
- handler(vg, 1, CHANGE_AAY);
|
||||
+ handler(_lvmetad_cmd, vgid, 1, CHANGE_AAY);
|
||||
else if (!strcmp(status, "complete"))
|
||||
- handler(vg, 0, CHANGE_AAY);
|
||||
+ handler(_lvmetad_cmd, vgid, 0, CHANGE_AAY);
|
||||
else if (!strcmp(status, "orphan"))
|
||||
;
|
||||
else
|
||||
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
|
||||
index 5f0f552..c644069 100644
|
||||
--- a/lib/cache/lvmetad.h
|
||||
+++ b/lib/cache/lvmetad.h
|
||||
@@ -22,7 +22,8 @@ struct cmd_context;
|
||||
struct dm_config_tree;
|
||||
enum activation_change;
|
||||
|
||||
-typedef int (*activation_handler) (struct volume_group *vg, int partial,
|
||||
+typedef int (*activation_handler) (struct cmd_context *cmd,
|
||||
+ const char *vgid, int partial,
|
||||
enum activation_change activate);
|
||||
|
||||
#ifdef LVMETAD_SUPPORT
|
||||
diff --git a/test/shell/lvmetad-pvscan-nomda.sh b/test/shell/lvmetad-pvscan-nomda.sh
|
||||
new file mode 100644
|
||||
index 0000000..c04a275
|
||||
--- /dev/null
|
||||
+++ b/test/shell/lvmetad-pvscan-nomda.sh
|
||||
@@ -0,0 +1,49 @@
|
||||
+#!/bin/sh
|
||||
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions
|
||||
+# of the GNU General Public License v.2.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software Foundation,
|
||||
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
+
|
||||
+. lib/test
|
||||
+
|
||||
+test -e LOCAL_LVMETAD || skip
|
||||
+kill $(cat LOCAL_LVMETAD)
|
||||
+rm LOCAL_LVMETAD
|
||||
+
|
||||
+aux prepare_devs 2
|
||||
+
|
||||
+pvcreate --metadatacopies 0 $dev1
|
||||
+pvcreate --metadatacopies 1 $dev2
|
||||
+vgcreate $vg1 $dev1 $dev2
|
||||
+lvcreate -n foo -l 1 -an --zero n $vg1
|
||||
+
|
||||
+# start lvmetad but make sure it doesn't know about $dev1 or $dev2
|
||||
+aux disable_dev $dev1
|
||||
+aux disable_dev $dev2
|
||||
+aux prepare_lvmetad
|
||||
+lvs
|
||||
+mv LOCAL_LVMETAD XXX
|
||||
+aux enable_dev $dev2
|
||||
+aux enable_dev $dev1
|
||||
+mv XXX LOCAL_LVMETAD
|
||||
+
|
||||
+aux lvmconf 'global/use_lvmetad = 0'
|
||||
+check inactive $vg1 foo
|
||||
+aux lvmconf 'global/use_lvmetad = 1'
|
||||
+
|
||||
+pvscan --cache $dev2 -aay
|
||||
+
|
||||
+aux lvmconf 'global/use_lvmetad = 0'
|
||||
+check inactive $vg1 foo
|
||||
+aux lvmconf 'global/use_lvmetad = 1'
|
||||
+
|
||||
+pvscan --cache $dev1 -aay
|
||||
+
|
||||
+aux lvmconf 'global/use_lvmetad = 0'
|
||||
+check active $vg1 foo
|
||||
+aux lvmconf 'global/use_lvmetad = 1'
|
||||
diff --git a/tools/pvscan.c b/tools/pvscan.c
|
||||
index fbd524b..1e844c5 100644
|
||||
--- a/tools/pvscan.c
|
||||
+++ b/tools/pvscan.c
|
||||
@@ -91,18 +91,36 @@ static void _pvscan_display_single(struct cmd_context *cmd,
|
||||
display_size(cmd, (uint64_t) (pv_pe_count(pv) - pv_pe_alloc_count(pv)) * pv_pe_size(pv)));
|
||||
}
|
||||
|
||||
-static int _auto_activation_handler(struct volume_group *vg, int partial,
|
||||
+static int _auto_activation_handler(struct cmd_context *cmd,
|
||||
+ const char *vgid, int partial,
|
||||
activation_change_t activate)
|
||||
{
|
||||
+ struct volume_group *vg;
|
||||
+ int consistent = 0;
|
||||
+ struct id vgid_raw;
|
||||
+
|
||||
/* TODO: add support for partial and clustered VGs */
|
||||
- if (partial || vg_is_clustered(vg))
|
||||
+ if (partial)
|
||||
return 1;
|
||||
|
||||
+ id_read_format(&vgid_raw, vgid);
|
||||
+ /* NB. This is safe because we know lvmetad is running and we won't hit
|
||||
+ * disk. */
|
||||
+ if (!(vg = vg_read_internal(cmd, NULL, (const char *) &vgid_raw, 0, &consistent)))
|
||||
+ return 1;
|
||||
+
|
||||
+ if (vg_is_clustered(vg)) {
|
||||
+ release_vg(vg);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
if (!vgchange_activate(vg->cmd, vg, activate)) {
|
||||
log_error("%s: autoactivation failed.", vg->name);
|
||||
+ release_vg(vg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ release_vg(vg);
|
||||
return 1;
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
commit f03877ecb56f32d91dd98e8e3331164f472f8b77
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:48:51 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-dmsetup-splitname-to-not-fail-if-used-without-c-switch.patch
|
||||
---
|
||||
WHATS_NEW_DM | 1 +
|
||||
tools/dmsetup.c | 8 +++++---
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
|
||||
index 30d01f9..34a0f70 100644
|
||||
--- a/WHATS_NEW_DM
|
||||
+++ b/WHATS_NEW_DM
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 1.02.78 -
|
||||
===================================
|
||||
+ Fix 'dmsetup splitname -o' to not fail if used without '-c' switch (1.02.68).
|
||||
Close open dmeventd FIFO file descriptors on exec (FD_CLOEXEC).
|
||||
Add DM_DISABLE_UDEV environment variable to manage dev nodes by libdm only.
|
||||
Automatically deactivate failed preloaded dm tree node.
|
||||
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
|
||||
index 196c170..2dc3abd 100644
|
||||
--- a/tools/dmsetup.c
|
||||
+++ b/tools/dmsetup.c
|
||||
@@ -3749,9 +3749,6 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (!_process_options(_string_args[OPTIONS_ARG]))
|
||||
- return 0;
|
||||
-
|
||||
if (_switches[TABLE_ARG] && _switches[NOTABLE_ARG]) {
|
||||
fprintf(stderr, "--table and --notable are incompatible.\n");
|
||||
return 0;
|
||||
@@ -3824,6 +3821,11 @@ int main(int argc, char **argv)
|
||||
if (!strcmp(cmd->name, "mangle"))
|
||||
dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
|
||||
|
||||
+ if (!_process_options(_string_args[OPTIONS_ARG])) {
|
||||
+ fprintf(stderr, "Couldn't process command line.\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
if (_switches[COLS_ARG]) {
|
||||
if (!_report_init(cmd))
|
||||
goto out;
|
44
lvm2-2_02_99-fix-lv_is_active-in-lvcreate.patch
Normal file
44
lvm2-2_02_99-fix-lv_is_active-in-lvcreate.patch
Normal file
@ -0,0 +1,44 @@
|
||||
commit 191de7c40463b04ef80b424982221784df0a99ed
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:02:39 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-lv_is_active-in-lvcreate.patch
|
||||
---
|
||||
lib/metadata/lv_manip.c | 10 ++--------
|
||||
test/shell/lvcreate-usage.sh | 2 ++
|
||||
2 files changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
|
||||
index a59e03f..557df58 100644
|
||||
--- a/lib/metadata/lv_manip.c
|
||||
+++ b/lib/metadata/lv_manip.c
|
||||
@@ -4348,14 +4348,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
|
||||
log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
|
||||
}
|
||||
|
||||
- if (!lv_is_active(org)) {
|
||||
- log_error("Check for existence of active snapshot "
|
||||
- "origin '%s' failed.", org->name);
|
||||
- return NULL;
|
||||
- }
|
||||
- origin_active = 1;
|
||||
-
|
||||
- if (vg_is_clustered(vg) &&
|
||||
+ if ((origin_active = lv_is_active(org)) &&
|
||||
+ vg_is_clustered(vg) &&
|
||||
!lv_is_active_exclusive_locally(org)) {
|
||||
log_error("%s must be active exclusively to"
|
||||
" create snapshot", org->name);
|
||||
diff --git a/test/shell/lvcreate-usage.sh b/test/shell/lvcreate-usage.sh
|
||||
index ddde401..c9c906a 100644
|
||||
--- a/test/shell/lvcreate-usage.sh
|
||||
+++ b/test/shell/lvcreate-usage.sh
|
||||
@@ -64,6 +64,8 @@ lvcreate -l1 -n $lv3 $vg
|
||||
not lvcreate -l1 -n $lv4 $vg
|
||||
|
||||
lvremove -ff $vg/$lv3
|
||||
+# check snapshot of inactive origin
|
||||
+lvchange -an $vg/$lv1
|
||||
lvcreate -l1 -s -n $lv3 $vg/$lv1
|
||||
not lvcreate -l1 -n $lv4 $vg
|
||||
not lvcreate -l1 -m1 -n $lv4 $vg
|
@ -0,0 +1,35 @@
|
||||
commit 509ba58eaa537a8db2e0bd41d8c56c52a68e8512
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:04:30 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-possible-deadlock-in-lvmetad-for-parallel-update-and-query.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
daemons/lvmetad/lvmetad-core.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 25e07ee..4728466 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Fix possible deadlock when querying and updating lvmetad at the same time.
|
||||
Avoid a global lock in pvs when lvmetad is in use.
|
||||
Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
||||
Fix lvm2app to return all property sizes in bytes.
|
||||
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
|
||||
index 0a1c884..3f417da 100644
|
||||
--- a/daemons/lvmetad/lvmetad-core.c
|
||||
+++ b/daemons/lvmetad/lvmetad-core.c
|
||||
@@ -675,8 +675,8 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
|
||||
|
||||
lock_vgid_to_metadata(s);
|
||||
old = dm_hash_lookup(s->vgid_to_metadata, _vgid);
|
||||
- lock_vg(s, _vgid);
|
||||
unlock_vgid_to_metadata(s);
|
||||
+ lock_vg(s, _vgid);
|
||||
|
||||
seq = dm_config_find_int(metadata, "metadata/seqno", -1);
|
||||
|
@ -0,0 +1,54 @@
|
||||
commit 8f17dc8027f1d9fd188468c26eb8c0a9957cc9cb
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:04:52 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-possible-race-in-lvmetad-remove_metadata.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
daemons/lvmetad/lvmetad-core.c | 14 +++++++++-----
|
||||
2 files changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 4728466..20a8125 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Fix possible race while removing metadata from lvmetad.
|
||||
Fix possible deadlock when querying and updating lvmetad at the same time.
|
||||
Avoid a global lock in pvs when lvmetad is in use.
|
||||
Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
||||
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
|
||||
index 3f417da..fed9296 100644
|
||||
--- a/daemons/lvmetad/lvmetad-core.c
|
||||
+++ b/daemons/lvmetad/lvmetad-core.c
|
||||
@@ -605,19 +605,23 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
|
||||
lock_vgid_to_metadata(s);
|
||||
old = dm_hash_lookup(s->vgid_to_metadata, vgid);
|
||||
oldname = dm_hash_lookup(s->vgid_to_vgname, vgid);
|
||||
- unlock_vgid_to_metadata(s);
|
||||
|
||||
- if (!old)
|
||||
+ if (!old) {
|
||||
+ unlock_vgid_to_metadata(s);
|
||||
return 0;
|
||||
+ }
|
||||
+
|
||||
assert(oldname);
|
||||
|
||||
- if (update_pvids)
|
||||
- /* FIXME: What should happen when update fails */
|
||||
- update_pvid_to_vgid(s, old, "#orphan", 0);
|
||||
/* need to update what we have since we found a newer version */
|
||||
dm_hash_remove(s->vgid_to_metadata, vgid);
|
||||
dm_hash_remove(s->vgid_to_vgname, vgid);
|
||||
dm_hash_remove(s->vgname_to_vgid, oldname);
|
||||
+ unlock_vgid_to_metadata(s);
|
||||
+
|
||||
+ if (update_pvids)
|
||||
+ /* FIXME: What should happen when update fails */
|
||||
+ update_pvid_to_vgid(s, old, "#orphan", 0);
|
||||
dm_config_destroy(old);
|
||||
return 1;
|
||||
}
|
@ -0,0 +1,182 @@
|
||||
commit 811db05e50b042c7ce3dc3ca9cfd3eccac464caa
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:22:58 2013 +0200
|
||||
|
||||
lvm2-2_02_99-fix-premature-dm-version-checking-which-caused-useless-mapper-control-access.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
lib/activate/dev_manager.c | 58 +++++++++++++++++++++++++++++++++++++++++++---
|
||||
lib/commands/toolcontext.c | 46 +++++++-----------------------------
|
||||
3 files changed, 64 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 8516f40..eb7897d 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Fix premature DM version checking which caused useless mapper/control access.
|
||||
Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
|
||||
Do not verify udev operations if --noudevsync command option is used.
|
||||
Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
|
||||
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
|
||||
index 31c1c27..7abd43b 100644
|
||||
--- a/lib/activate/dev_manager.c
|
||||
+++ b/lib/activate/dev_manager.c
|
||||
@@ -1016,6 +1016,58 @@ int dev_manager_mknodes(const struct logical_volume *lv)
|
||||
return r;
|
||||
}
|
||||
|
||||
+#ifdef UDEV_SYNC_SUPPORT
|
||||
+/*
|
||||
+ * Until the DM_UEVENT_GENERATED_FLAG was introduced in kernel patch
|
||||
+ * 856a6f1dbd8940e72755af145ebcd806408ecedd
|
||||
+ * some operations could not be performed by udev, requiring our fallback code.
|
||||
+ */
|
||||
+static int _dm_driver_has_stable_udev_support(void)
|
||||
+{
|
||||
+ char vsn[80];
|
||||
+ unsigned maj, min, patchlevel;
|
||||
+
|
||||
+ return driver_version(vsn, sizeof(vsn)) &&
|
||||
+ (sscanf(vsn, "%u.%u.%u", &maj, &min, &patchlevel) == 3) &&
|
||||
+ (maj == 4 ? min >= 18 : maj > 4);
|
||||
+}
|
||||
+
|
||||
+static int _check_udev_fallback(struct cmd_context *cmd)
|
||||
+{
|
||||
+ struct config_info *settings = &cmd->current_settings;
|
||||
+
|
||||
+ if (settings->udev_fallback != -1)
|
||||
+ goto out;
|
||||
+
|
||||
+ /*
|
||||
+ * Use udev fallback automatically in case udev
|
||||
+ * is disabled via DM_DISABLE_UDEV environment
|
||||
+ * variable or udev rules are switched off.
|
||||
+ */
|
||||
+ settings->udev_fallback = !settings->udev_rules ? 1 :
|
||||
+ find_config_tree_bool(cmd, "activation/verify_udev_operations",
|
||||
+ DEFAULT_VERIFY_UDEV_OPERATIONS);
|
||||
+
|
||||
+ /* Do not rely fully on udev if the udev support is known to be incomplete. */
|
||||
+ if (!settings->udev_fallback && !_dm_driver_has_stable_udev_support()) {
|
||||
+ log_very_verbose("Kernel driver has incomplete udev support so "
|
||||
+ "LVM will check and perform some operations itself.");
|
||||
+ settings->udev_fallback = 1;
|
||||
+ }
|
||||
+out:
|
||||
+ return settings->udev_fallback;
|
||||
+}
|
||||
+
|
||||
+#else /* UDEV_SYNC_SUPPORT */
|
||||
+
|
||||
+static int _check_udev_fallback(struct cmd_context *cmd)
|
||||
+{
|
||||
+ /* We must use old node/symlink creation code if not compiled with udev support at all! */
|
||||
+ return cmd->current_settings.udev_fallback = 1;
|
||||
+}
|
||||
+
|
||||
+#endif /* UDEV_SYNC_SUPPORT */
|
||||
+
|
||||
static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *lv,
|
||||
const char *layer)
|
||||
{
|
||||
@@ -1025,7 +1077,7 @@ static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *l
|
||||
* Instruct also libdevmapper to disable udev
|
||||
* fallback in accordance to LVM2 settings.
|
||||
*/
|
||||
- if (!dm->cmd->current_settings.udev_fallback)
|
||||
+ if (!_check_udev_fallback(dm->cmd))
|
||||
udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
|
||||
|
||||
/*
|
||||
@@ -2036,7 +2088,7 @@ static int _create_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
|
||||
int r = 1;
|
||||
|
||||
/* Nothing to do if udev fallback is disabled. */
|
||||
- if (!dm->cmd->current_settings.udev_fallback) {
|
||||
+ if (!_check_udev_fallback(dm->cmd)) {
|
||||
fs_set_create();
|
||||
return 1;
|
||||
}
|
||||
@@ -2084,7 +2136,7 @@ static int _remove_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
|
||||
int r = 1;
|
||||
|
||||
/* Nothing to do if udev fallback is disabled. */
|
||||
- if (!dm->cmd->current_settings.udev_fallback)
|
||||
+ if (!_check_udev_fallback(dm->cmd))
|
||||
return 1;
|
||||
|
||||
while ((child = dm_tree_next_child(&handle, root, 0))) {
|
||||
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
|
||||
index 80d0f3e..61d5c26 100644
|
||||
--- a/lib/commands/toolcontext.c
|
||||
+++ b/lib/commands/toolcontext.c
|
||||
@@ -226,23 +226,6 @@ static int _check_disable_udev(const char *msg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#ifdef UDEV_SYNC_SUPPORT
|
||||
-/*
|
||||
- * Until the DM_UEVENT_GENERATED_FLAG was introduced in kernel patch
|
||||
- * 856a6f1dbd8940e72755af145ebcd806408ecedd
|
||||
- * some operations could not be performed by udev, requiring our fallback code.
|
||||
- */
|
||||
-static int _dm_driver_has_stable_udev_support(void)
|
||||
-{
|
||||
- char vsn[80];
|
||||
- unsigned maj, min, patchlevel;
|
||||
-
|
||||
- return driver_version(vsn, sizeof(vsn)) &&
|
||||
- (sscanf(vsn, "%u.%u.%u", &maj, &min, &patchlevel) == 3) &&
|
||||
- (maj == 4 ? min >= 18 : maj > 4);
|
||||
-}
|
||||
-#endif
|
||||
-
|
||||
static int _process_config(struct cmd_context *cmd)
|
||||
{
|
||||
mode_t old_umask;
|
||||
@@ -341,33 +324,20 @@ static int _process_config(struct cmd_context *cmd)
|
||||
cmd->default_settings.udev_sync = udev_disabled ? 0 :
|
||||
find_config_tree_int(cmd, "activation/udev_sync", DEFAULT_UDEV_SYNC);
|
||||
|
||||
+ /*
|
||||
+ * Set udev_fallback lazily on first use since it requires
|
||||
+ * checking DM driver version which is an extra ioctl!
|
||||
+ * This also prevents unnecessary use of mapper/control.
|
||||
+ * If udev is disabled globally, set fallback mode immediately.
|
||||
+ */
|
||||
+ cmd->default_settings.udev_fallback = udev_disabled ? 1 : -1;
|
||||
+
|
||||
init_retry_deactivation(find_config_tree_int(cmd, "activation/retry_deactivation",
|
||||
DEFAULT_RETRY_DEACTIVATION));
|
||||
|
||||
init_activation_checks(find_config_tree_int(cmd, "activation/checks",
|
||||
DEFAULT_ACTIVATION_CHECKS));
|
||||
|
||||
-#ifdef UDEV_SYNC_SUPPORT
|
||||
- /*
|
||||
- * Use udev fallback automatically in case udev
|
||||
- * is disabled via DM_DISABLE_UDEV environment
|
||||
- * variable or udev rules are switched off.
|
||||
- */
|
||||
- cmd->default_settings.udev_fallback = !cmd->default_settings.udev_rules || udev_disabled ? 1 :
|
||||
- find_config_tree_int(cmd, "activation/verify_udev_operations", DEFAULT_VERIFY_UDEV_OPERATIONS);
|
||||
-
|
||||
- /* Do not rely fully on udev if the udev support is known to be incomplete. */
|
||||
- if (!cmd->default_settings.udev_fallback && !_dm_driver_has_stable_udev_support()) {
|
||||
- log_very_verbose("Kernel driver has incomplete udev support so "
|
||||
- "LVM will check and perform some operations itself.");
|
||||
- cmd->default_settings.udev_fallback = 1;
|
||||
- }
|
||||
-
|
||||
-#else
|
||||
- /* We must use old node/symlink creation code if not compiled with udev support at all! */
|
||||
- cmd->default_settings.udev_fallback = 1;
|
||||
-#endif
|
||||
-
|
||||
cmd->use_linear_target = find_config_tree_int(cmd,
|
||||
"activation/use_linear_target",
|
||||
DEFAULT_USE_LINEAR_TARGET);
|
83
lvm2-2_02_99-lvmetad-fix-a-race-in-metadata-update.patch
Normal file
83
lvm2-2_02_99-lvmetad-fix-a-race-in-metadata-update.patch
Normal file
@ -0,0 +1,83 @@
|
||||
commit 6283dc16f6ad54a08aae5f5d0c43bb4973e0ffc1
|
||||
Author: Peter Rajnoha <prajnoha@redhat.com>
|
||||
Date: Tue May 14 11:05:31 2013 +0200
|
||||
|
||||
lvm2-2_02_99-lvmetad-fix-a-race-in-metadata-update.patch
|
||||
---
|
||||
WHATS_NEW | 1 +
|
||||
daemons/lvmetad/lvmetad-core.c | 18 ++++++++++--------
|
||||
2 files changed, 11 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/WHATS_NEW b/WHATS_NEW
|
||||
index 20a8125..35c5e43 100644
|
||||
--- a/WHATS_NEW
|
||||
+++ b/WHATS_NEW
|
||||
@@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
+ Fix a crash-inducing race condition in lvmetad while updating metadata.
|
||||
Fix possible race while removing metadata from lvmetad.
|
||||
Fix possible deadlock when querying and updating lvmetad at the same time.
|
||||
Avoid a global lock in pvs when lvmetad is in use.
|
||||
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
|
||||
index fed9296..1e7470b 100644
|
||||
--- a/daemons/lvmetad/lvmetad-core.c
|
||||
+++ b/daemons/lvmetad/lvmetad-core.c
|
||||
@@ -450,7 +450,8 @@ static response vg_lookup(lvmetad_state *s, request r)
|
||||
|
||||
DEBUGLOG(s, "vg_lookup: updated uuid = %s, name = %s", uuid, name);
|
||||
|
||||
- if (!uuid)
|
||||
+ /* Check the name here. */
|
||||
+ if (!uuid || !name)
|
||||
return reply_unknown("VG not found");
|
||||
|
||||
cft = lock_vg(s, uuid);
|
||||
@@ -679,16 +680,14 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
|
||||
|
||||
lock_vgid_to_metadata(s);
|
||||
old = dm_hash_lookup(s->vgid_to_metadata, _vgid);
|
||||
+ oldname = dm_hash_lookup(s->vgid_to_vgname, _vgid);
|
||||
unlock_vgid_to_metadata(s);
|
||||
lock_vg(s, _vgid);
|
||||
|
||||
seq = dm_config_find_int(metadata, "metadata/seqno", -1);
|
||||
|
||||
- if (old) {
|
||||
+ if (old)
|
||||
haveseq = dm_config_find_int(old->root, "metadata/seqno", -1);
|
||||
- oldname = dm_hash_lookup(s->vgid_to_vgname, _vgid);
|
||||
- assert(oldname);
|
||||
- }
|
||||
|
||||
if (seq < 0)
|
||||
goto out;
|
||||
@@ -740,7 +739,7 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
|
||||
if (haveseq >= 0 && haveseq < seq) {
|
||||
INFO(s, "Updating metadata for %s at %d to %d", _vgid, haveseq, seq);
|
||||
/* temporarily orphan all of our PVs */
|
||||
- remove_metadata(s, vgid, 1);
|
||||
+ update_pvid_to_vgid(s, old, "#orphan", 0);
|
||||
}
|
||||
|
||||
lock_vgid_to_metadata(s);
|
||||
@@ -750,14 +749,17 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
|
||||
dm_hash_insert(s->vgid_to_metadata, vgid, cft) &&
|
||||
dm_hash_insert(s->vgid_to_vgname, vgid, cfgname) &&
|
||||
dm_hash_insert(s->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0;
|
||||
+
|
||||
+ if (retval && oldname && strcmp(name, oldname))
|
||||
+ dm_hash_remove(s->vgname_to_vgid, oldname);
|
||||
+
|
||||
unlock_vgid_to_metadata(s);
|
||||
|
||||
if (retval)
|
||||
- /* FIXME: What should happen when update fails */
|
||||
retval = update_pvid_to_vgid(s, cft, vgid, 1);
|
||||
|
||||
unlock_pvid_to_vgid(s);
|
||||
-out:
|
||||
+out: /* FIXME: We should probably abort() on partial failures. */
|
||||
if (!retval && cft)
|
||||
dm_config_destroy(cft);
|
||||
unlock_vg(s, _vgid);
|
2066
lvm2-2_02_99-various-thin-support-related-fixes.patch
Normal file
2066
lvm2-2_02_99-various-thin-support-related-fixes.patch
Normal file
File diff suppressed because it is too large
Load Diff
50
lvm2.spec
50
lvm2.spec
@ -37,7 +37,7 @@
|
||||
Summary: Userland logical volume management tools
|
||||
Name: lvm2
|
||||
Version: 2.02.98
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
License: GPLv2
|
||||
Group: System Environment/Base
|
||||
URL: http://sources.redhat.com/lvm2
|
||||
@ -58,6 +58,18 @@ Patch12: lvm2-2_02_99-fix-autoactivation-to-not-autoactivate-vg-lv-on-each-pv-ch
|
||||
Patch13: lvm2-2_02_99-synchronize-with-udev-in-pvscan-cache-and-fix-dangling-udev_sync-cookies.patch
|
||||
Patch14: lvm2-2_02_99-also-autoactivate-on-coldplug.patch
|
||||
Patch15: lvm2-2_02_99-fire-pvscan-cache-on-change-event-for-md-devs.patch
|
||||
Patch16: lvm2-2_02_99-various-thin-support-related-fixes.patch
|
||||
Patch17: lvm2-2_02_99-fix-lv_is_active-in-lvcreate.patch
|
||||
Patch18: lvm2-2_02_99-fix-crash-in-pvscan-cache-aay-triggered-by-non-mda-pv.patch
|
||||
Patch19: lvm2-2_02_99-avoid-global-lock-in-pvs-when-lvmetad-is-in-use.patch
|
||||
Patch20: lvm2-2_02_99-fix-possible-deadlock-in-lvmetad-for-parallel-update-and-query.patch
|
||||
Patch21: lvm2-2_02_99-fix-possible-race-in-lvmetad-remove_metadata.patch
|
||||
Patch22: lvm2-2_02_99-lvmetad-fix-a-race-in-metadata-update.patch
|
||||
Patch23: lvm2-2_02_99-fix-blkdeactivate-handling-of-nested-mountpoints-and-mangled-mount-paths.patch
|
||||
Patch24: lvm2-2_02_99-add-dm-disable-udev-env-var-and-fix-noudevsync-arg.patch
|
||||
Patch25: lvm2-2_02_99-fix-premature-dm-version-checking-which-caused-useless-mapper-control-access.patch
|
||||
Patch26: lvm2-2_02_99-close-dmeventd-fifo-fds-on-exec.patch
|
||||
Patch27: lvm2-2_02_99-fix-dmsetup-splitname-to-not-fail-if-used-without-c-switch.patch
|
||||
|
||||
BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
|
||||
BuildRequires: ncurses-devel
|
||||
@ -108,6 +120,18 @@ or more physical volumes and creating one or more logical volumes
|
||||
%patch13 -p1 -b .dangling_cookies
|
||||
%patch14 -p1 -b .coldplug
|
||||
%patch15 -p1 -b .autoactivation_on_md
|
||||
%patch16 -p1 -b .various_thin_fixes
|
||||
%patch17 -p1 -b .lv_is_active
|
||||
%patch18 -p1 -b .pvscan_cache_aay_crash
|
||||
%patch19 -p1 -b .avoid_global_lock
|
||||
%patch20 -p1 -b .lvmetad_deadlock
|
||||
%patch21 -p1 -b .lvmetad_race_on_remove
|
||||
%patch22 -p1 -b .lvmetad_race_on_update
|
||||
%patch23 -p1 -b .blkdeactivate
|
||||
%patch24 -p1 -b .dm_disable_udev
|
||||
%patch25 -p1 -b .premature_dm_version
|
||||
%patch26 -p1 -b .dmeventd_fd_cloexec
|
||||
%patch27 -p1 -b .dmsetup_splitname
|
||||
|
||||
%build
|
||||
%define _default_pid_dir /run
|
||||
@ -604,6 +628,30 @@ the device-mapper event library.
|
||||
%{_libdir}/pkgconfig/devmapper-event.pc
|
||||
|
||||
%changelog
|
||||
* Tue May 14 2013 Peter Rajnoha <prajnoha@redhat.com> - 2.02.98-9
|
||||
- Fix 'dmsetup splitname -o' to not fail if used without '-c' switch (1.02.68).
|
||||
- Close open dmeventd FIFO file descriptors on exec (FD_CLOEXEC).
|
||||
- Fix premature DM version checking which caused useless mapper/control access.
|
||||
- Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
|
||||
- Do not verify udev operations if --noudevsync command option is used.
|
||||
- Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
|
||||
- Fix a crash-inducing race condition in lvmetad while updating metadata.
|
||||
- Fix possible race while removing metadata from lvmetad.
|
||||
- Fix possible deadlock when querying and updating lvmetad at the same time.
|
||||
- Avoid a global lock in pvs when lvmetad is in use.
|
||||
- Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
||||
- Fix lvm2app to return all property sizes in bytes.
|
||||
- Add lvm.conf option global/thin_disabled_features.
|
||||
- Add lvconvert support to swap thin pool metadata volume.
|
||||
- Implement internal function detach_pool_metadata_lv().
|
||||
- Fix lvm2app and return lvseg discards property as string.
|
||||
- Allow forced vgcfgrestore of lvm2 metadata with thin volumes.
|
||||
- Add lvm.conf thin pool defs thin_pool_{chunk_size|discards|zero}.
|
||||
- Support discards for non-power-of-2 thin pool chunks.
|
||||
- Support allocation of pool metadata with lvconvert command.
|
||||
- Move common functionality for thin lvcreate and lvconvert to toollib.
|
||||
- Use lv_is_active() instead of lv_info() call.
|
||||
|
||||
* Fri May 03 2013 Peter Rajnoha <prajnoha@redhat.com> - 2.02.98-8
|
||||
- Fix non-functional autoactivation of LVM volumes on top of MD devices.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user