public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW ./WHATS_NEW_DM doc/example.co ...
@ 2011-07-01 14:09 agk
0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2011-07-01 14:09 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2011-07-01 14:09:21
Modified files:
. : WHATS_NEW WHATS_NEW_DM
doc : example.conf.in
lib/activate : activate.c dev_manager.c
lib/commands : toolcontext.c
lib/config : defaults.h
lib/misc : lvm-globals.c lvm-globals.h
libdm : libdevmapper.h libdm-common.c
libdm/ioctl : libdm-iface.c libdm-targets.h
man : dmsetup.8.in
test/lib : aux.sh
tools : dmsetup.c
Log message:
Add framework for validation of ioctls. Doesn't do any checks yet.
dmsetup --checks
libdevmapper: dm_task_enable_checks()
lvm.conf: activation/checks=1
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2034&r2=1.2035
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.476&r2=1.477
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.204&r2=1.205
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.221&r2=1.222
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.123&r2=1.124
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-globals.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-globals.h.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.138&r2=1.139
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.111&r2=1.112
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/lib/aux.sh.diff?cvsroot=lvm2&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.163&r2=1.164
--- LVM2/WHATS_NEW 2011/06/30 18:25:18 1.2034
+++ LVM2/WHATS_NEW 2011/07/01 14:09:19 1.2035
@@ -1,5 +1,6 @@
Version 2.02.86 -
=================================
+ Add activation/checks to lvm.conf to perform additional ioctl validation.
When suspending, automatically preload newly-visible existing LVs.
Report internal error when parameters are missing on table load.
Teardown any stray devices with $COMMON_PREFIX during test runs.
--- LVM2/WHATS_NEW_DM 2011/06/29 21:56:46 1.476
+++ LVM2/WHATS_NEW_DM 2011/07/01 14:09:19 1.477
@@ -1,5 +1,6 @@
Version 1.02.65 -
==================================
+ Add dmsetup --checks and dm_task_enable_checks framework to validate ioctls.
Add age_in_minutes parameter to dmsetup udevcomplete_all.
Return immediately from dm_lib_exit() if called more than once.
Disable udev fallback by default and add --verifyudev option to dmsetup.
--- LVM2/doc/example.conf.in 2011/06/27 21:43:59 1.27
+++ LVM2/doc/example.conf.in 2011/07/01 14:09:19 1.28
@@ -411,6 +411,12 @@
}
activation {
+ # Set to 1 to perform internal checks on the operations issued to
+ # libdevmapper. Useful for debugging problems with activation.
+ # Some of the checks may be expensive, so it's best to use this
+ # only when there seems to be a problem.
+ checks = 0
+
# Set to 0 to disable udev synchronisation (if compiled into the binaries).
# Processes will not wait for notification from udev.
# They will continue irrespective of any possible udev processing
--- LVM2/lib/activate/activate.c 2011/06/30 18:25:18 1.204
+++ LVM2/lib/activate/activate.c 2011/07/01 14:09:19 1.205
@@ -394,6 +394,9 @@
if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
return_0;
+ if (activation_checks() && !dm_task_enable_checks(dmt))
+ goto_out;
+
if (!dm_task_run(dmt)) {
log_debug("Failed to get %s target version", target_name);
/* Assume this was because LIST_VERSIONS isn't supported */
--- LVM2/lib/activate/dev_manager.c 2011/06/30 18:25:18 1.221
+++ LVM2/lib/activate/dev_manager.c 2011/07/01 14:09:19 1.222
@@ -88,6 +88,9 @@
if (major && !dm_task_set_major_minor(dmt, major, minor, 1))
goto_out;
+ if (activation_checks() && !dm_task_enable_checks(dmt))
+ goto_out;
+
return dmt;
out:
dm_task_destroy(dmt);
@@ -148,6 +151,9 @@
if (!dm_task_set_major_minor(dmt, MAJOR(dev->dev), MINOR(dev->dev), 1))
goto_out;
+ if (activation_checks() && !dm_task_enable_checks(dmt))
+ goto_out;
+
if (!dm_task_run(dmt)) {
log_error("Failed to get state of mapped device");
goto out;
--- LVM2/lib/commands/toolcontext.c 2011/06/28 00:23:06 1.123
+++ LVM2/lib/commands/toolcontext.c 2011/07/01 14:09:19 1.124
@@ -285,6 +285,9 @@
"activation/udev_sync",
DEFAULT_UDEV_SYNC);
+ init_activation_checks(find_config_tree_int(cmd, "activation/checks",
+ DEFAULT_ACTIVATION_CHECKS));
+
#ifdef UDEV_SYNC_SUPPORT
/*
* We need udev rules to be applied, otherwise we would end up with no
--- LVM2/lib/config/defaults.h 2011/06/27 21:43:59 1.77
+++ LVM2/lib/config/defaults.h 2011/07/01 14:09:20 1.78
@@ -79,6 +79,7 @@
#define DEFAULT_UDEV_RULES 1
#define DEFAULT_UDEV_SYNC 0
#define DEFAULT_VERIFY_UDEV_OPERATIONS 0
+#define DEFAULT_ACTIVATION_CHECKS 0
#define DEFAULT_EXTENT_SIZE 4096 /* In KB */
#define DEFAULT_MAX_PV 0
#define DEFAULT_MAX_LV 0
--- LVM2/lib/misc/lvm-globals.c 2011/04/22 12:05:33 1.11
+++ LVM2/lib/misc/lvm-globals.c 2011/07/01 14:09:20 1.12
@@ -42,6 +42,7 @@
static int _error_message_produced = 0;
static unsigned _is_static = 0;
static int _udev_checking = 1;
+static int _activation_checks = 0;
static char _sysfs_dir_path[PATH_MAX] = "";
static int _dev_disable_after_error_count = DEFAULT_DISABLE_AFTER_ERROR_COUNT;
static uint64_t _pv_min_size = (DEFAULT_PV_MIN_SIZE_KB * 1024L >> SECTOR_SHIFT);
@@ -131,6 +132,14 @@
log_debug("LVM udev checking disabled");
}
+void init_activation_checks(int checks)
+{
+ if ((_activation_checks = checks))
+ log_debug("LVM activation checks enabled");
+ else
+ log_debug("LVM activation checks disabled");
+}
+
void init_dev_disable_after_error_count(int value)
{
_dev_disable_after_error_count = value;
@@ -256,6 +265,11 @@
return _udev_checking;
}
+int activation_checks(void)
+{
+ return _activation_checks;
+}
+
const char *sysfs_dir_path(void)
{
return _sysfs_dir_path;
--- LVM2/lib/misc/lvm-globals.h 2011/04/28 17:33:34 1.11
+++ LVM2/lib/misc/lvm-globals.h 2011/07/01 14:09:20 1.12
@@ -40,6 +40,7 @@
void init_udev_checking(int checking);
void init_dev_disable_after_error_count(int value);
void init_pv_min_size(uint64_t sectors);
+void init_activation_checks(int checks);
void set_cmd_name(const char *cmd_name);
void set_sysfs_dir_path(const char *path);
@@ -63,6 +64,7 @@
int udev_checking(void);
const char *sysfs_dir_path(void);
uint64_t pv_min_size(void);
+int activation_checks(void);
#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void);
--- LVM2/libdm/libdevmapper.h 2011/06/13 03:32:46 1.138
+++ LVM2/libdm/libdevmapper.h 2011/07/01 14:09:20 1.139
@@ -190,6 +190,12 @@
int dm_task_query_inactive_table(struct dm_task *dmt);
int dm_task_suppress_identical_reload(struct dm_task *dmt);
int dm_task_secure_data(struct dm_task *dmt);
+
+/*
+ * Enable checks for common mistakes such as issuing ioctls in an unsafe order.
+ */
+int dm_task_enable_checks(struct dm_task *dmt);
+
typedef enum {
DM_ADD_NODE_ON_RESUME, /* add /dev/mapper node with dmsetup resume */
DM_ADD_NODE_ON_CREATE /* add /dev/mapper node with dmsetup create */
--- LVM2/libdm/libdm-common.c 2011/06/28 09:24:13 1.121
+++ LVM2/libdm/libdm-common.c 2011/07/01 14:09:20 1.122
@@ -395,6 +395,13 @@
return 1;
}
+int dm_task_enable_checks(struct dm_task *dmt)
+{
+ dmt->enable_checks = 1;
+
+ return 1;
+}
+
int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size,
const char *ttype, const char *params)
{
--- LVM2/libdm/ioctl/libdm-iface.c 2011/06/29 16:08:33 1.111
+++ LVM2/libdm/ioctl/libdm-iface.c 2011/07/01 14:09:20 1.112
@@ -1884,6 +1884,16 @@
return r;
}
+static int _suspend_with_validation_v4(struct dm_task *dmt)
+{
+ /*
+ * FIXME Ensure we can't leave any I/O trapped between suspended devices.
+ */
+ dmt->enable_checks = 0;
+
+ return dm_task_run(dmt);
+}
+
static const char *_sanitise_message(char *message)
{
const char *sanitised_message = message ?: "";
@@ -1963,7 +1973,7 @@
}
log_debug("dm %s %s%s %s%s%s %s%.0d%s%.0d%s"
- "%s%c%c%s%s%s%s %.0" PRIu64 " %s [%u]",
+ "%s%c%c%s%s%s%s%s %.0" PRIu64 " %s [%u]",
_cmd_data_v4[dmt->type].name,
dmt->new_uuid ? "UUID " : "",
dmi->name, dmi->uuid, dmt->newname ? " " : "",
@@ -1980,6 +1990,7 @@
dmt->skip_lockfs ? "S " : "",
dmt->secure_data ? "W " : "",
dmt->query_inactive_table ? "I " : "",
+ dmt->enable_checks ? "C" : "",
dmt->sector, _sanitise_message(dmt->message),
dmi->data_size);
#ifdef DM_IOCTLS
@@ -2054,6 +2065,9 @@
if ((dmt->type == DM_DEVICE_RELOAD) && dmt->suppress_identical_reload)
return _reload_with_suppression_v4(dmt);
+ if ((dmt->type == DM_DEVICE_SUSPEND) && dmt->enable_checks)
+ return _suspend_with_validation_v4(dmt);
+
if (!_open_control()) {
_udev_complete(dmt);
return 0;
--- LVM2/libdm/ioctl/libdm-targets.h 2011/02/04 19:33:54 1.29
+++ LVM2/libdm/ioctl/libdm-targets.h 2011/07/01 14:09:20 1.30
@@ -65,6 +65,7 @@
int cookie_set;
int new_uuid;
int secure_data;
+ int enable_checks;
char *uuid;
};
--- LVM2/man/dmsetup.8.in 2011/06/29 21:56:46 1.41
+++ LVM2/man/dmsetup.8.in 2011/07/01 14:09:20 1.42
@@ -114,6 +114,10 @@
.br
\fBdmsetup info -c --noheadings -j \fImajor\fB -m \fIminor\fP.
.SH OPTIONS
+.IP \fB--checks
+Perform additional checks on the operations requested and report
+potential problems. Useful when debugging scripts.
+In some cases these checks may slow down operations noticeably.
.IP \fB-c|-C|--columns
.br
Display output in columns rather than as Field: Value lines.
--- LVM2/test/lib/aux.sh 2011/06/30 09:17:49 1.25
+++ LVM2/test/lib/aux.sh 2011/07/01 14:09:20 1.26
@@ -381,6 +381,7 @@
global/locking_type=$LVM_TEST_LOCKING
global/si_unit_consistency = 1
global/fallback_to_local_locking = 0
+activation/checks = 1
activation/udev_sync = 1
activation/udev_rules = 1
activation/verify_udev_operations = $VERIFY_UDEV
--- LVM2/tools/dmsetup.c 2011/06/29 21:56:46 1.163
+++ LVM2/tools/dmsetup.c 2011/07/01 14:09:20 1.164
@@ -117,6 +117,9 @@
*/
enum {
READ_ONLY = 0,
+ ADD_NODE_ON_CREATE_ARG,
+ ADD_NODE_ON_RESUME_ARG,
+ CHECKS_ARG,
COLS_ARG,
EXEC_ARG,
FORCE_ARG,
@@ -153,8 +156,6 @@
VERIFYUDEV_ARG,
VERSION_ARG,
YES_ARG,
- ADD_NODE_ON_RESUME_ARG,
- ADD_NODE_ON_CREATE_ARG,
NUM_SWITCHES
};
@@ -317,6 +318,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto err;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto err;
+
if (!dm_task_run(dmt))
goto err;
@@ -572,6 +576,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -645,6 +652,8 @@
udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
if (!_set_task_add_node(dmt))
goto out;
@@ -699,6 +708,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (_switches[NOUDEVRULES_ARG])
udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
@@ -778,6 +790,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -816,6 +831,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
/* run the task */
if (!dm_task_run(dmt))
goto out;
@@ -1234,6 +1252,9 @@
if (_switches[NOLOCKFS_ARG] && !dm_task_skip_lockfs(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
/* FIXME: needs to coperate with udev */
if (!_set_task_add_node(dmt))
goto out;
@@ -1314,6 +1335,9 @@
if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
return 0;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt)) {
r = 0;
goto out;
@@ -1362,6 +1386,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -1411,6 +1438,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto error;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto error;
+
if (!dm_task_run(dmt))
goto error;
@@ -1586,6 +1616,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -1659,6 +1692,9 @@
if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
return 0;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -1709,6 +1745,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -1749,6 +1788,9 @@
if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
goto out;
+ if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
@@ -2764,7 +2806,7 @@
fprintf(out, "Usage:\n\n");
fprintf(out, "dmsetup [--version] [-h|--help [-c|-C|--columns]]\n"
- " [-v|--verbose [-v|--verbose ...]]\n"
+ " [--checks] [-v|--verbose [-v|--verbose ...]]\n"
" [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
" [--udevcookie [cookie]] [--noudevrules] [--noudevsync] [--verifyudev]\n"
" [-y|--yes] [--readahead [+]<sectors>|auto|none]\n"
@@ -3119,6 +3161,7 @@
#ifdef HAVE_GETOPTLONG
static struct option long_options[] = {
{"readonly", 0, &ind, READ_ONLY},
+ {"checks", 0, &ind, CHECKS_ARG},
{"columns", 0, &ind, COLS_ARG},
{"exec", 1, &ind, EXEC_ARG},
{"force", 0, &ind, FORCE_ARG},
@@ -3258,6 +3301,8 @@
_switches[ADD_NODE_ON_RESUME_ARG]++;
if (ind == ADD_NODE_ON_CREATE_ARG)
_switches[ADD_NODE_ON_CREATE_ARG]++;
+ if (ind == CHECKS_ARG)
+ _switches[CHECKS_ARG]++;
if (ind == UDEVCOOKIE_ARG) {
_switches[UDEVCOOKIE_ARG]++;
_udev_cookie = _get_cookie_value(optarg);
^ permalink raw reply [flat|nested] 3+ messages in thread
* LVM2 ./WHATS_NEW ./WHATS_NEW_DM doc/example.co ...
@ 2011-06-27 21:44 agk
0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2011-06-27 21:44 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk@sourceware.org 2011-06-27 21:43:59
Modified files:
. : WHATS_NEW WHATS_NEW_DM
doc : example.conf.in
lib/commands : toolcontext.c
lib/config : defaults.h
libdm : libdm-common.c libdm-common.h libdm-deptree.c
libdm/ioctl : libdm-iface.c
man : dmsetup.8.in
tools : dmsetup.c
Log message:
Move udev_only logic inside stacked node op code.
(We still need to treat add+readhead+del as a no-op.)
Rename udev_fallback to verify_udev_operations.
Rename --udevfallback to --verifyudev
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2026&r2=1.2027
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.474&r2=1.475
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.in.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.118&r2=1.119
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.h.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.161&r2=1.162
--- LVM2/WHATS_NEW 2011/06/23 14:00:58 1.2026
+++ LVM2/WHATS_NEW 2011/06/27 21:43:58 1.2027
@@ -3,7 +3,7 @@
Fix to preserve exclusive activation of mirror while up-converting.
Reject allocation if number of extents is not divisible by area count.
Fix issue preventing cluster mirror creation.
- Disable udev fallback by default and add activation/udev_fallback to lvm.conf.
+ Add activation/verify_udev_operations to lvm.conf, disabled by default.
Call vg_mark_partial_lvs() before VG structure is returned from the cache.
Remove unused internal flag ACTIVATE_EXCL from the code.
Remove useless test of ACTIVATE_EXCL in lv_add_mirrors() clustered code path.
--- LVM2/WHATS_NEW_DM 2011/06/24 19:33:41 1.474
+++ LVM2/WHATS_NEW_DM 2011/06/27 21:43:58 1.475
@@ -1,7 +1,7 @@
Version 1.02.65 -
==================================
- Return immediately dm_lib_exit() if called more than once.
- Disable udev fallback by default and add --udevfallback option to dmsetup.
+ Return immediately from dm_lib_exit() if called more than once.
+ Disable udev fallback by default and add --verifyudev option to dmsetup.
Warn if a table is loaded while a device is known to be in suspended state.
Add dm_get_suspended_counter() for number of devs in suspended state by lib.
Fix "all" report field prefix matching to include label fields with pv_all.
--- LVM2/doc/example.conf.in 2011/06/17 14:50:53 1.26
+++ LVM2/doc/example.conf.in 2011/06/27 21:43:59 1.27
@@ -428,12 +428,11 @@
# while any logical volumes are active.
udev_rules = 1
- # Set to 1 to enable udev fallback. This will enable additional checks and
- # possible repairs done on entries in the device directory after udev has
- # completed processing the events. This is normally not needed if udev
- # works correctly but it may be used in some problematic situations or
- # for debugging purposes.
- udev_fallback = 0
+ # Set to 1 for LVM2 to verify operations performed by udev. This turns on
+ # additional checks (and if necessary, repairs) on entries in the device
+ # directory after udev has completed processing its events.
+ # Useful for diagnosing problems with LVM2/udev interactions.
+ verify_udev_operations = 0
# How to fill in missing stripes if activating an incomplete volume.
# Using "error" will make inaccessible parts of the device return
--- LVM2/lib/commands/toolcontext.c 2011/06/17 14:50:54 1.120
+++ LVM2/lib/commands/toolcontext.c 2011/06/27 21:43:59 1.121
@@ -293,8 +293,8 @@
* without any fallback.
*/
cmd->default_settings.udev_fallback = cmd->default_settings.udev_rules ?
- find_config_tree_int(cmd, "activation/udev_fallback",
- DEFAULT_UDEV_FALLBACK) : 1;
+ find_config_tree_int(cmd, "activation/verify_udev_operations",
+ DEFAULT_VERIFY_UDEV_OPERATIONS) : 1;
#else
/* We must use old node/symlink creation code if not compiled with udev support at all! */
cmd->default_settings.udev_fallback = 1;
--- LVM2/lib/config/defaults.h 2011/06/17 14:50:54 1.76
+++ LVM2/lib/config/defaults.h 2011/06/27 21:43:59 1.77
@@ -78,7 +78,7 @@
#define DEFAULT_READ_AHEAD "auto"
#define DEFAULT_UDEV_RULES 1
#define DEFAULT_UDEV_SYNC 0
-#define DEFAULT_UDEV_FALLBACK 0
+#define DEFAULT_VERIFY_UDEV_OPERATIONS 0
#define DEFAULT_EXTENT_SIZE 4096 /* In KB */
#define DEFAULT_MAX_PV 0
#define DEFAULT_MAX_LV 0
--- LVM2/libdm/libdm-common.c 2011/06/13 03:32:46 1.118
+++ LVM2/libdm/libdm-common.c 2011/06/27 21:43:59 1.119
@@ -501,8 +501,13 @@
#endif
}
+static int _warn_if_op_needed(int warn_if_udev_failed)
+{
+ return warn_if_udev_failed && dm_udev_get_sync_support() && dm_udev_get_checking();
+}
+
static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
- uid_t uid, gid_t gid, mode_t mode, int check_udev)
+ uid_t uid, gid_t gid, mode_t mode, int warn_if_udev_failed)
{
char path[PATH_MAX];
struct stat info;
@@ -527,8 +532,7 @@
dev_name);
return 0;
}
- } else if (dm_udev_get_sync_support() && dm_udev_get_checking() &&
- check_udev)
+ } else if (_warn_if_op_needed(warn_if_udev_failed))
log_warn("%s not set up by udev: Falling back to direct "
"node creation.", path);
@@ -553,7 +557,7 @@
return 1;
}
-static int _rm_dev_node(const char *dev_name, int check_udev)
+static int _rm_dev_node(const char *dev_name, int warn_if_udev_failed)
{
char path[PATH_MAX];
struct stat info;
@@ -562,8 +566,7 @@
if (stat(path, &info) < 0)
return 1;
- else if (dm_udev_get_sync_support() && dm_udev_get_checking() &&
- check_udev)
+ else if (_warn_if_op_needed(warn_if_udev_failed))
log_warn("Node %s was not removed by udev. "
"Falling back to direct node removal.", path);
@@ -578,7 +581,7 @@
}
static int _rename_dev_node(const char *old_name, const char *new_name,
- int check_udev)
+ int warn_if_udev_failed)
{
char oldpath[PATH_MAX];
char newpath[PATH_MAX];
@@ -593,8 +596,7 @@
"is already present", newpath);
return 0;
}
- else if (dm_udev_get_sync_support() && dm_udev_get_checking() &&
- check_udev) {
+ else if (_warn_if_op_needed(warn_if_udev_failed)) {
if (stat(oldpath, &info) < 0 &&
errno == ENOENT)
/* assume udev already deleted this */
@@ -618,8 +620,7 @@
return 0;
}
}
- else if (dm_udev_get_sync_support() && dm_udev_get_checking() &&
- check_udev)
+ else if (_warn_if_op_needed(warn_if_udev_failed))
log_warn("The node %s should have been renamed to %s "
"by udev but new node is not present. "
"Falling back to direct node rename.",
@@ -759,16 +760,16 @@
static int _do_node_op(node_op_t type, const char *dev_name, uint32_t major,
uint32_t minor, uid_t uid, gid_t gid, mode_t mode,
const char *old_name, uint32_t read_ahead,
- uint32_t read_ahead_flags, int check_udev)
+ uint32_t read_ahead_flags, int warn_if_udev_failed)
{
switch (type) {
case NODE_ADD:
return _add_dev_node(dev_name, major, minor, uid, gid,
- mode, check_udev);
+ mode, warn_if_udev_failed);
case NODE_DEL:
- return _rm_dev_node(dev_name, check_udev);
+ return _rm_dev_node(dev_name, warn_if_udev_failed);
case NODE_RENAME:
- return _rename_dev_node(old_name, dev_name, check_udev);
+ return _rename_dev_node(old_name, dev_name, warn_if_udev_failed);
case NODE_READ_AHEAD:
return _set_dev_node_read_ahead(dev_name, read_ahead,
read_ahead_flags);
@@ -794,7 +795,8 @@
uint32_t read_ahead;
uint32_t read_ahead_flags;
char *old_name;
- int check_udev;
+ int warn_if_udev_failed;
+ unsigned rely_on_udev;
char names[0];
};
@@ -824,16 +826,33 @@
return 0;
}
-/* Check if udev is supposed to create nodes */
-static int _check_udev(int check_udev)
+static void _log_node_op(const char *action_str, struct node_op_parms *nop)
{
- return check_udev && dm_udev_get_sync_support() && dm_udev_get_checking();
+ switch (nop->type) {
+ case NODE_ADD:
+ log_debug("%s: %s NODE_ADD (%" PRIu32 ",%" PRIu32 ") %u:%u 0%o",
+ nop->dev_name, action_str, nop->major, nop->minor, nop->uid, nop->gid, nop->mode);
+ break;
+ case NODE_DEL:
+ log_debug("%s: %s NODE_DEL", nop->dev_name, action_str);
+ break;
+ case NODE_RENAME:
+ log_debug("%s: %s NODE_RENAME to %s", nop->old_name, action_str, nop->dev_name);
+ break;
+ case NODE_READ_AHEAD:
+ log_debug("%s: %s NODE_READ_AHEAD %" PRIu32 " (flags=%" PRIu32
+ ")", nop->dev_name, action_str, nop->read_ahead, nop->read_ahead_flags);
+ break;
+ default:
+ ; /* NOTREACHED */
+ }
}
static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major,
uint32_t minor, uid_t uid, gid_t gid, mode_t mode,
const char *old_name, uint32_t read_ahead,
- uint32_t read_ahead_flags, int check_udev)
+ uint32_t read_ahead_flags, int warn_if_udev_failed,
+ unsigned rely_on_udev)
{
struct node_op_parms *nop;
struct dm_list *noph, *nopht;
@@ -841,7 +860,7 @@
char *pos;
/*
- * Note: check_udev must have valid content
+ * Note: warn_if_udev_failed must have valid content
*/
if ((type == NODE_DEL) && _other_node_ops(type))
/*
@@ -850,27 +869,29 @@
dm_list_iterate_safe(noph, nopht, &_node_ops) {
nop = dm_list_item(noph, struct node_op_parms);
if (!strcmp(dev_name, nop->dev_name)) {
+ _log_node_op("Unstacking", nop);
_del_node_op(nop);
if (!_other_node_ops(type))
break; /* no other non DEL ops */
}
}
- else if ((type == NODE_ADD) && _count_node_ops[NODE_DEL] && _check_udev(check_udev))
+ else if ((type == NODE_ADD) && _count_node_ops[NODE_DEL])
/*
- * If udev is running ignore previous DEL operation on added node.
+ * Ignore previous DEL operation on added node.
* (No other operations for this device then DEL could be stacked here).
*/
dm_list_iterate_safe(noph, nopht, &_node_ops) {
nop = dm_list_item(noph, struct node_op_parms);
if ((nop->type == NODE_DEL) &&
!strcmp(dev_name, nop->dev_name)) {
+ _log_node_op("Unstacking", nop);
_del_node_op(nop);
break; /* no other DEL ops */
}
}
- else if ((type == NODE_RENAME) && _check_udev(check_udev))
+ else if ((type == NODE_RENAME))
/*
- * If udev is running ignore any outstanding operations if renaming it.
+ * Ignore any outstanding operations if renaming it.
*
* Currently RENAME operation happens through 'suspend -> resume'.
* On 'resume' device is added with read_ahead settings, so it is
@@ -880,6 +901,7 @@
dm_list_iterate_safe(noph, nopht, &_node_ops) {
nop = dm_list_item(noph, struct node_op_parms);
if (!strcmp(old_name, nop->dev_name))
+ _log_node_op("Unstacking", nop);
_del_node_op(nop);
}
@@ -897,7 +919,8 @@
nop->mode = mode;
nop->read_ahead = read_ahead;
nop->read_ahead_flags = read_ahead_flags;
- nop->check_udev = check_udev;
+ nop->warn_if_udev_failed = warn_if_udev_failed;
+ nop->rely_on_udev = rely_on_udev;
_store_str(&pos, &nop->dev_name, dev_name);
_store_str(&pos, &nop->old_name, old_name);
@@ -905,6 +928,8 @@
_count_node_ops[type]++;
dm_list_add(&_node_ops, &nop->list);
+ _log_node_op("Stacking", nop);
+
return 1;
}
@@ -915,38 +940,35 @@
dm_list_iterate_safe(noph, nopht, &_node_ops) {
nop = dm_list_item(noph, struct node_op_parms);
- _do_node_op(nop->type, nop->dev_name, nop->major, nop->minor,
- nop->uid, nop->gid, nop->mode, nop->old_name,
- nop->read_ahead, nop->read_ahead_flags,
- nop->check_udev);
+ if (!nop->rely_on_udev) {
+ _log_node_op("Processing", nop);
+ _do_node_op(nop->type, nop->dev_name, nop->major, nop->minor,
+ nop->uid, nop->gid, nop->mode, nop->old_name,
+ nop->read_ahead, nop->read_ahead_flags,
+ nop->warn_if_udev_failed);
+ } else
+ _log_node_op("Skipping (udev)", nop);
_del_node_op(nop);
}
}
int add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
- uid_t uid, gid_t gid, mode_t mode, int check_udev)
+ uid_t uid, gid_t gid, mode_t mode, int check_udev, unsigned rely_on_udev)
{
- log_debug("%s: Stacking NODE_ADD (%" PRIu32 ",%" PRIu32 ") %u:%u 0%o",
- dev_name, major, minor, uid, gid, mode);
-
return _stack_node_op(NODE_ADD, dev_name, major, minor, uid,
- gid, mode, "", 0, 0, check_udev);
+ gid, mode, "", 0, 0, check_udev, rely_on_udev);
}
-int rename_dev_node(const char *old_name, const char *new_name, int check_udev)
+int rename_dev_node(const char *old_name, const char *new_name, int check_udev, unsigned rely_on_udev)
{
- log_debug("%s: Stacking NODE_RENAME to %s", old_name, new_name);
-
return _stack_node_op(NODE_RENAME, new_name, 0, 0, 0,
- 0, 0, old_name, 0, 0, check_udev);
+ 0, 0, old_name, 0, 0, check_udev, rely_on_udev);
}
-int rm_dev_node(const char *dev_name, int check_udev)
+int rm_dev_node(const char *dev_name, int check_udev, unsigned rely_on_udev)
{
- log_debug("%s: Stacking NODE_DEL (replaces other stacked ops)", dev_name);
-
return _stack_node_op(NODE_DEL, dev_name, 0, 0, 0,
- 0, 0, "", 0, 0, check_udev);
+ 0, 0, "", 0, 0, check_udev, rely_on_udev);
}
int set_dev_node_read_ahead(const char *dev_name, uint32_t read_ahead,
@@ -955,11 +977,8 @@
if (read_ahead == DM_READ_AHEAD_AUTO)
return 1;
- log_debug("%s: Stacking NODE_READ_AHEAD %" PRIu32 " (flags=%" PRIu32
- ")", dev_name, read_ahead, read_ahead_flags);
-
return _stack_node_op(NODE_READ_AHEAD, dev_name, 0, 0, 0, 0,
- 0, "", read_ahead, read_ahead_flags, 0);
+ 0, "", read_ahead, read_ahead_flags, 0, 0);
}
void update_devs(void)
@@ -1428,7 +1447,7 @@
return 0;
}
- log_debug("Udev cookie 0x%" PRIx32 " (semid %d): Waiting for zero",
+ log_debug("Udev cookie 0x%" PRIx32 " (semid %d) waiting for zero",
cookie, semid);
repeat_wait:
--- LVM2/libdm/libdm-common.h 2011/06/13 03:32:46 1.8
+++ LVM2/libdm/libdm-common.h 2011/06/27 21:43:59 1.9
@@ -23,10 +23,10 @@
const char *type, const char *params);
int add_dev_node(const char *dev_name, uint32_t minor, uint32_t major,
- uid_t uid, gid_t gid, mode_t mode, int check_udev);
-int rm_dev_node(const char *dev_name, int check_udev);
+ uid_t uid, gid_t gid, mode_t mode, int check_udev, unsigned rely_on_udev);
+int rm_dev_node(const char *dev_name, int check_udev, unsigned rely_on_udev);
int rename_dev_node(const char *old_name, const char *new_name,
- int check_udev);
+ int check_udev, unsigned rely_on_udev);
int get_dev_node_read_ahead(const char *dev_name, uint32_t *read_ahead);
int set_dev_node_read_ahead(const char *dev_name, uint32_t read_ahead,
uint32_t read_ahead_flags);
--- LVM2/libdm/libdm-deptree.c 2011/06/24 19:33:41 1.98
+++ LVM2/libdm/libdm-deptree.c 2011/06/27 21:43:59 1.99
@@ -983,10 +983,9 @@
r = dm_task_run(dmt);
- /* FIXME Until kernel returns actual name so dm-ioctl.c can handle it */
- if (!(udev_flags & DM_UDEV_DISABLE_LIBRARY_FALLBACK))
- rm_dev_node(name, dmt->cookie_set &&
- !(udev_flags & DM_UDEV_DISABLE_DM_RULES_FLAG));
+ /* FIXME Until kernel returns actual name so dm-iface.c can handle it */
+ rm_dev_node(name, dmt->cookie_set && !(udev_flags & DM_UDEV_DISABLE_DM_RULES_FLAG),
+ dmt->cookie_set && !(udev_flags & DM_UDEV_DISABLE_LIBRARY_FALLBACK));
/* FIXME Remove node from tree or mark invalid? */
--- LVM2/libdm/ioctl/libdm-iface.c 2011/06/24 19:33:41 1.107
+++ LVM2/libdm/ioctl/libdm-iface.c 2011/06/27 21:43:59 1.108
@@ -2025,7 +2025,7 @@
struct dm_ioctl *dmi;
unsigned command;
int check_udev;
- int udev_only;
+ int rely_on_udev;
int suspended_counter;
#ifdef DM_COMPAT
@@ -2097,40 +2097,43 @@
}
}
+ /*
+ * Are we expecting a udev operation to occur that we need to check for?
+ */
check_udev = dmt->cookie_set &&
!(dmt->event_nr >> DM_UDEV_FLAGS_SHIFT &
DM_UDEV_DISABLE_DM_RULES_FLAG);
- udev_only = dmt->cookie_set ? (dmt->event_nr >> DM_UDEV_FLAGS_SHIFT &
- DM_UDEV_DISABLE_LIBRARY_FALLBACK) : 0;
+ rely_on_udev = dmt->cookie_set ? (dmt->event_nr >> DM_UDEV_FLAGS_SHIFT &
+ DM_UDEV_DISABLE_LIBRARY_FALLBACK) : 0;
switch (dmt->type) {
case DM_DEVICE_CREATE:
if ((dmt->add_node == DM_ADD_NODE_ON_CREATE) &&
- dmt->dev_name && *dmt->dev_name && !udev_only)
+ dmt->dev_name && *dmt->dev_name && !rely_on_udev)
add_dev_node(dmt->dev_name, MAJOR(dmi->dev),
MINOR(dmi->dev), dmt->uid, dmt->gid,
- dmt->mode, check_udev);
+ dmt->mode, check_udev, rely_on_udev);
break;
case DM_DEVICE_REMOVE:
/* FIXME Kernel needs to fill in dmi->name */
- if (dmt->dev_name && !udev_only)
- rm_dev_node(dmt->dev_name, check_udev);
+ if (dmt->dev_name && !rely_on_udev)
+ rm_dev_node(dmt->dev_name, check_udev, rely_on_udev);
break;
case DM_DEVICE_RENAME:
/* FIXME Kernel needs to fill in dmi->name */
- if (!dmt->new_uuid && dmt->dev_name && !udev_only)
+ if (!dmt->new_uuid && dmt->dev_name)
rename_dev_node(dmt->dev_name, dmt->newname,
- check_udev);
+ check_udev, rely_on_udev);
break;
case DM_DEVICE_RESUME:
if ((dmt->add_node == DM_ADD_NODE_ON_RESUME) &&
- dmt->dev_name && *dmt->dev_name && !udev_only)
+ dmt->dev_name && *dmt->dev_name)
add_dev_node(dmt->dev_name, MAJOR(dmi->dev),
MINOR(dmi->dev), dmt->uid, dmt->gid,
- dmt->mode, check_udev);
+ dmt->mode, check_udev, rely_on_udev);
/* FIXME Kernel needs to fill in dmi->name */
set_dev_node_read_ahead(dmt->dev_name, dmt->read_ahead,
dmt->read_ahead_flags);
@@ -2140,9 +2143,9 @@
if (dmi->flags & DM_EXISTS_FLAG)
add_dev_node(dmi->name, MAJOR(dmi->dev),
MINOR(dmi->dev), dmt->uid,
- dmt->gid, dmt->mode, 0);
+ dmt->gid, dmt->mode, 0, rely_on_udev);
else if (dmt->dev_name)
- rm_dev_node(dmt->dev_name, 0);
+ rm_dev_node(dmt->dev_name, 0, rely_on_udev);
break;
case DM_DEVICE_STATUS:
--- LVM2/man/dmsetup.8.in 2011/04/29 00:21:16 1.39
+++ LVM2/man/dmsetup.8.in 2011/06/27 21:43:59 1.40
@@ -181,6 +181,10 @@
.IP \fB-v|--verbose\ [-v|--verbose]
.br
Produce additional output.
+.IP \fB--verifyudev
+If udev synchronisation is enabled, verify that udev operations get performed
+correctly and try to fix up the device nodes afterwards if not.
+.br
.IP \fB--version
.br
Display the library and kernel driver version.
--- LVM2/tools/dmsetup.c 2011/06/17 14:55:51 1.161
+++ LVM2/tools/dmsetup.c 2011/06/27 21:43:59 1.162
@@ -135,7 +135,6 @@
UDEVCOOKIE_ARG,
NOUDEVRULES_ARG,
NOUDEVSYNC_ARG,
- UDEVFALLBACK_ARG,
OPTIONS_ARG,
READAHEAD_ARG,
ROWS_ARG,
@@ -151,6 +150,7 @@
UNQUOTED_ARG,
UUID_ARG,
VERBOSE_ARG,
+ VERIFYUDEV_ARG,
VERSION_ARG,
YES_ARG,
ADD_NODE_ON_RESUME_ARG,
@@ -1007,7 +1007,7 @@
else
dirs_diff = strcmp(dev_dir, udev_dev_dir);
- _udev_only = !dirs_diff && (_udev_cookie || !_switches[UDEVFALLBACK_ARG]);
+ _udev_only = !dirs_diff && (_udev_cookie || !_switches[VERIFYUDEV_ARG]);
if (dirs_diff) {
log_debug("The path %s used for creating device nodes that is "
@@ -2745,7 +2745,7 @@
fprintf(out, "dmsetup [--version] [-h|--help [-c|-C|--columns]]\n"
" [-v|--verbose [-v|--verbose ...]]\n"
" [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
- " [--udevcookie] [--noudevrules] [--noudevsync] [--udevfallback]\n"
+ " [--udevcookie] [--noudevrules] [--noudevsync] [--verifyudev]\n"
" [-y|--yes] [--readahead [+]<sectors>|auto|none]\n"
" [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n"
" [--nameprefixes] [--noheadings] [--separator <separator>]\n\n");
@@ -3116,7 +3116,6 @@
{"udevcookie", 1, &ind, UDEVCOOKIE_ARG},
{"noudevrules", 0, &ind, NOUDEVRULES_ARG},
{"noudevsync", 0, &ind, NOUDEVSYNC_ARG},
- {"udevfallback", 0, &ind, UDEVFALLBACK_ARG},
{"options", 1, &ind, OPTIONS_ARG},
{"readahead", 1, &ind, READAHEAD_ARG},
{"rows", 0, &ind, ROWS_ARG},
@@ -3132,6 +3131,7 @@
{"unbuffered", 0, &ind, UNBUFFERED_ARG},
{"unquoted", 0, &ind, UNQUOTED_ARG},
{"verbose", 1, &ind, VERBOSE_ARG},
+ {"verifyudev", 0, &ind, VERIFYUDEV_ARG},
{"version", 0, &ind, VERSION_ARG},
{"yes", 0, &ind, YES_ARG},
{"addnodeonresume", 0, &ind, ADD_NODE_ON_RESUME_ARG},
@@ -3245,8 +3245,8 @@
_switches[NOUDEVRULES_ARG]++;
if (ind == NOUDEVSYNC_ARG)
_switches[NOUDEVSYNC_ARG]++;
- if (ind == UDEVFALLBACK_ARG)
- _switches[UDEVFALLBACK_ARG]++;
+ if (ind == VERIFYUDEV_ARG)
+ _switches[VERIFYUDEV_ARG]++;
if (c == 'G' || ind == GID_ARG) {
_switches[GID_ARG]++;
_int_args[GID_ARG] = atoi(optarg);
^ permalink raw reply [flat|nested] 3+ messages in thread
* LVM2 ./WHATS_NEW ./WHATS_NEW_DM doc/example.co ...
@ 2010-01-07 19:54 prajnoha
0 siblings, 0 replies; 3+ messages in thread
From: prajnoha @ 2010-01-07 19:54 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha@sourceware.org 2010-01-07 19:54:23
Modified files:
. : WHATS_NEW WHATS_NEW_DM
doc : example.conf
lib/activate : dev_manager.c fs.c fs.h
lib/commands : toolcontext.c toolcontext.h
lib/config : defaults.h
libdm : .exported_symbols libdevmapper.h
libdm-deptree.c
Log message:
Add activation/udev_rules config option in lvm.conf.
Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1370&r2=1.1371
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.325&r2=1.326
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.53&r2=1.54
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.167&r2=1.168
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/fs.h.diff?cvsroot=lvm2&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/defaults.h.diff?cvsroot=lvm2&r1=1.57&r2=1.58
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/.exported_symbols.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.103&r2=1.104
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-deptree.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68
--- LVM2/WHATS_NEW 2010/01/07 14:45:28 1.1370
+++ LVM2/WHATS_NEW 2010/01/07 19:54:21 1.1371
@@ -1,5 +1,6 @@
Version 2.02.57 -
====================================
+ Add activation/udev_rules config option in lvm.conf.
Add macro outfc() and export out_text_with_comment().
Add macros outsize() and outhint().
Use offsetof() macro for FIELD() macro in lib/report/report.c.
--- LVM2/WHATS_NEW_DM 2010/01/07 19:45:12 1.325
+++ LVM2/WHATS_NEW_DM 2010/01/07 19:54:21 1.326
@@ -1,5 +1,6 @@
Version 1.02.41 -
====================================
+ Add dm_tree_add_dev_with_udev_flags to provide wider support for udev flags.
Add --noudevrules option for dmsetup to disable /dev node management by udev.
Update code to show all fields for 'dmsetup info -c -o all'.
Return error from dm_tree_deactivate_children().
--- LVM2/doc/example.conf 2010/01/06 13:27:07 1.53
+++ LVM2/doc/example.conf 2010/01/07 19:54:21 1.54
@@ -323,7 +323,7 @@
}
activation {
- # Set to 0 to disable udev syncronisation (if compiled into the binaries).
+ # Set to 0 to disable udev synchronisation (if compiled into the binaries).
# Processes will not wait for notification from udev.
# They will continue irrespective of any possible udev processing
# in the background. You should only use this if udev is not running
@@ -333,6 +333,13 @@
# waiting for udev, run 'dmsetup udevcomplete_all' manually to wake them up.
udev_sync = 1
+ # Set to 0 to disable the udev rules installed by LVM2 (if built with
+ # --enable-udev_rules). LVM2 will then manage the /dev nodes and symlinks
+ # for active logical volumes directly itself.
+ # N.B. Manual intervention may be required if this setting is changed
+ # while any logical volumes are active.
+ udev_rules = 1
+
# How to fill in missing stripes if activating an incomplete volume.
# Using "error" will make inaccessible parts of the device return
# I/O errors on access. You can instead use a device path, in which
--- LVM2/lib/activate/dev_manager.c 2009/12/16 19:22:11 1.167
+++ LVM2/lib/activate/dev_manager.c 2010/01/07 19:54:21 1.168
@@ -658,6 +658,7 @@
{
char *dlid, *name;
struct dm_info info, info2;
+ uint16_t udev_flags = 0;
if (!(name = build_dm_name(dm->mem, lv->vg->name, lv->name, layer)))
return_0;
@@ -695,7 +696,20 @@
}
}
- if (info.exists && !dm_tree_add_dev(dtree, info.major, info.minor)) {
+ if (layer || !lv_is_visible(lv))
+ udev_flags |= DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG |
+ DM_UDEV_DISABLE_DISK_RULES_FLAG |
+ DM_UDEV_DISABLE_OTHER_RULES_FLAG;
+
+ if (lv_is_cow(lv))
+ udev_flags |= DM_UDEV_LOW_PRIORITY_FLAG;
+
+ if (!dm->cmd->current_settings.udev_rules)
+ udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+ DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+
+ if (info.exists && !dm_tree_add_dev_with_udev_flags(dtree, info.major,
+ info.minor, udev_flags)) {
log_error("Failed to add device (%" PRIu32 ":%" PRIu32") to dtree",
info.major, info.minor);
return 0;
@@ -1034,6 +1048,10 @@
if (lv_is_cow(lv))
udev_flags |= DM_UDEV_LOW_PRIORITY_FLAG;
+ if (!dm->cmd->current_settings.udev_rules)
+ udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+ DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+
/*
* Add LV to dtree.
* If we're working with precommitted metadata, clear any
@@ -1151,7 +1169,8 @@
if (*layer)
continue;
- fs_del_lv_byname(dm->cmd->dev_dir, vgname, lvname);
+ fs_del_lv_byname(dm->cmd->dev_dir, vgname, lvname,
+ dm->cmd->current_settings.udev_rules);
}
return r;
--- LVM2/lib/activate/fs.c 2009/10/12 04:06:42 1.49
+++ LVM2/lib/activate/fs.c 2010/01/07 19:54:21 1.50
@@ -108,7 +108,7 @@
}
static int _mk_link(const char *dev_dir, const char *vg_name,
- const char *lv_name, const char *dev)
+ const char *lv_name, const char *dev, int check_udev)
{
char lv_path[PATH_MAX], link_path[PATH_MAX], lvm1_group_path[PATH_MAX];
char vg_path[PATH_MAX];
@@ -166,7 +166,7 @@
return 0;
}
- if (dm_udev_get_sync_support()) {
+ if (dm_udev_get_sync_support() && check_udev) {
/* Check udev created the correct link. */
if (!stat(link_path, &buf_lp) &&
!stat(lv_path, &buf)) {
@@ -190,7 +190,7 @@
log_sys_error("unlink", lv_path);
return 0;
}
- } else if (dm_udev_get_sync_support())
+ } else if (dm_udev_get_sync_support() && check_udev)
log_warn("The link %s should had been created by udev "
"but it was not found. Falling back to "
"direct link creation.", lv_path);
@@ -208,7 +208,7 @@
}
static int _rm_link(const char *dev_dir, const char *vg_name,
- const char *lv_name)
+ const char *lv_name, int check_udev)
{
struct stat buf;
char lv_path[PATH_MAX];
@@ -221,7 +221,7 @@
if (lstat(lv_path, &buf) && errno == ENOENT)
return 1;
- else if (dm_udev_get_sync_support())
+ else if (dm_udev_get_sync_support() && check_udev)
log_warn("The link %s should have been removed by udev "
"but it is still present. Falling back to "
"direct link removal.", lv_path);
@@ -248,25 +248,26 @@
static int _do_fs_op(fs_op_t type, const char *dev_dir, const char *vg_name,
const char *lv_name, const char *dev,
- const char *old_lv_name)
+ const char *old_lv_name, int check_udev)
{
switch (type) {
case FS_ADD:
if (!_mk_dir(dev_dir, vg_name) ||
- !_mk_link(dev_dir, vg_name, lv_name, dev))
+ !_mk_link(dev_dir, vg_name, lv_name, dev, check_udev))
return_0;
break;
case FS_DEL:
- if (!_rm_link(dev_dir, vg_name, lv_name) ||
+ if (!_rm_link(dev_dir, vg_name, lv_name, check_udev) ||
!_rm_dir(dev_dir, vg_name))
return_0;
break;
/* FIXME Use rename() */
case FS_RENAME:
- if (old_lv_name && !_rm_link(dev_dir, vg_name, old_lv_name))
+ if (old_lv_name && !_rm_link(dev_dir, vg_name, old_lv_name,
+ check_udev))
stack;
- if (!_mk_link(dev_dir, vg_name, lv_name, dev))
+ if (!_mk_link(dev_dir, vg_name, lv_name, dev, check_udev))
stack;
}
@@ -278,6 +279,7 @@
struct fs_op_parms {
struct dm_list list;
fs_op_t type;
+ int check_udev;
char *dev_dir;
char *vg_name;
char *lv_name;
@@ -295,7 +297,7 @@
static int _stack_fs_op(fs_op_t type, const char *dev_dir, const char *vg_name,
const char *lv_name, const char *dev,
- const char *old_lv_name)
+ const char *old_lv_name, int check_udev)
{
struct fs_op_parms *fsp;
size_t len = strlen(dev_dir) + strlen(vg_name) + strlen(lv_name) +
@@ -309,6 +311,7 @@
pos = fsp->names;
fsp->type = type;
+ fsp->check_udev = check_udev;
_store_str(&pos, &fsp->dev_dir, dev_dir);
_store_str(&pos, &fsp->vg_name, vg_name);
@@ -329,40 +332,43 @@
dm_list_iterate_safe(fsph, fspht, &_fs_ops) {
fsp = dm_list_item(fsph, struct fs_op_parms);
_do_fs_op(fsp->type, fsp->dev_dir, fsp->vg_name, fsp->lv_name,
- fsp->dev, fsp->old_lv_name);
+ fsp->dev, fsp->old_lv_name, fsp->check_udev);
dm_list_del(&fsp->list);
dm_free(fsp);
}
}
static int _fs_op(fs_op_t type, const char *dev_dir, const char *vg_name,
- const char *lv_name, const char *dev, const char *old_lv_name)
+ const char *lv_name, const char *dev, const char *old_lv_name,
+ int check_udev)
{
if (memlock()) {
if (!_stack_fs_op(type, dev_dir, vg_name, lv_name, dev,
- old_lv_name))
+ old_lv_name, check_udev))
return_0;
return 1;
}
- return _do_fs_op(type, dev_dir, vg_name, lv_name, dev, old_lv_name);
+ return _do_fs_op(type, dev_dir, vg_name, lv_name, dev,
+ old_lv_name, check_udev);
}
int fs_add_lv(const struct logical_volume *lv, const char *dev)
{
return _fs_op(FS_ADD, lv->vg->cmd->dev_dir, lv->vg->name, lv->name,
- dev, "");
+ dev, "", lv->vg->cmd->current_settings.udev_rules);
}
int fs_del_lv(const struct logical_volume *lv)
{
return _fs_op(FS_DEL, lv->vg->cmd->dev_dir, lv->vg->name, lv->name,
- "", "");
+ "", "", lv->vg->cmd->current_settings.udev_rules);
}
-int fs_del_lv_byname(const char *dev_dir, const char *vg_name, const char *lv_name)
+int fs_del_lv_byname(const char *dev_dir, const char *vg_name,
+ const char *lv_name, int check_udev)
{
- return _fs_op(FS_DEL, dev_dir, vg_name, lv_name, "", "");
+ return _fs_op(FS_DEL, dev_dir, vg_name, lv_name, "", "", check_udev);
}
int fs_rename_lv(struct logical_volume *lv, const char *dev,
@@ -370,12 +376,14 @@
{
if (strcmp(old_vgname, lv->vg->name)) {
return
- (_fs_op(FS_DEL, lv->vg->cmd->dev_dir, old_vgname, old_lvname, "", "") &&
- _fs_op(FS_ADD, lv->vg->cmd->dev_dir, lv->vg->name, lv->name, dev, ""));
+ (_fs_op(FS_DEL, lv->vg->cmd->dev_dir, old_vgname,
+ old_lvname, "", "", lv->vg->cmd->current_settings.udev_rules) &&
+ _fs_op(FS_ADD, lv->vg->cmd->dev_dir, lv->vg->name,
+ lv->name, dev, "", lv->vg->cmd->current_settings.udev_rules));
}
else
return _fs_op(FS_RENAME, lv->vg->cmd->dev_dir, lv->vg->name, lv->name,
- dev, old_lvname);
+ dev, old_lvname, lv->vg->cmd->current_settings.udev_rules);
}
void fs_unlock(void)
--- LVM2/lib/activate/fs.h 2008/12/19 14:22:48 1.13
+++ LVM2/lib/activate/fs.h 2010/01/07 19:54:21 1.14
@@ -25,9 +25,10 @@
*/
int fs_add_lv(const struct logical_volume *lv, const char *dev);
int fs_del_lv(const struct logical_volume *lv);
-int fs_del_lv_byname(const char *dev_dir, const char *vg_name, const char *lv_name);
+int fs_del_lv_byname(const char *dev_dir, const char *vg_name,
+ const char *lv_name, int check_udev);
int fs_rename_lv(struct logical_volume *lv, const char *dev,
- const char *old_vgname, const char *old_lvname);
+ const char *old_vgname, const char *old_lvname);
void fs_unlock(void);
#endif
--- LVM2/lib/commands/toolcontext.c 2009/11/30 17:17:11 1.89
+++ LVM2/lib/commands/toolcontext.c 2010/01/07 19:54:21 1.90
@@ -267,6 +267,10 @@
return 0;
}
+ cmd->default_settings.udev_rules = find_config_tree_int(cmd,
+ "activation/udev_rules",
+ DEFAULT_UDEV_RULES);
+
cmd->default_settings.udev_sync = find_config_tree_int(cmd,
"activation/udev_sync",
DEFAULT_UDEV_SYNC);
--- LVM2/lib/commands/toolcontext.h 2009/11/24 16:10:26 1.36
+++ LVM2/lib/commands/toolcontext.h 2010/01/07 19:54:22 1.37
@@ -34,6 +34,7 @@
int archive; /* should we archive ? */
int backup; /* should we backup ? */
int read_ahead; /* DM_READ_AHEAD_NONE or _AUTO */
+ int udev_rules;
int udev_sync;
int cache_vgmetadata;
const char *msg_prefix;
--- LVM2/lib/config/defaults.h 2010/01/06 13:27:07 1.57
+++ LVM2/lib/config/defaults.h 2010/01/07 19:54:22 1.58
@@ -67,6 +67,7 @@
#define DEFAULT_PVMETADATACOPIES 1
#define DEFAULT_LABELSECTOR UINT64_C(1)
#define DEFAULT_READ_AHEAD "auto"
+#define DEFAULT_UDEV_RULES 1
#define DEFAULT_UDEV_SYNC 0
#define DEFAULT_EXTENT_SIZE 4096 /* In KB */
#define DEFAULT_MAX_PV 0
--- LVM2/libdm/.exported_symbols 2009/11/06 00:43:08 1.45
+++ LVM2/libdm/.exported_symbols 2010/01/07 19:54:22 1.46
@@ -50,6 +50,7 @@
dm_tree_create
dm_tree_free
dm_tree_add_dev
+dm_tree_add_dev_with_udev_flags
dm_tree_add_new_dev
dm_tree_add_new_dev_with_udev_flags
dm_tree_node_get_name
--- LVM2/libdm/libdevmapper.h 2009/11/13 12:43:21 1.103
+++ LVM2/libdm/libdevmapper.h 2010/01/07 19:54:22 1.104
@@ -267,6 +267,8 @@
* Add nodes to the tree for a given device and all the devices it uses.
*/
int dm_tree_add_dev(struct dm_tree *tree, uint32_t major, uint32_t minor);
+int dm_tree_add_dev_with_udev_flags(struct dm_tree *tree, uint32_t major,
+ uint32_t minor, uint16_t udev_flags);
/*
* Add a new node to the tree if it doesn't already exist.
--- LVM2/libdm/libdm-deptree.c 2010/01/05 21:06:26 1.67
+++ LVM2/libdm/libdm-deptree.c 2010/01/07 19:54:22 1.68
@@ -454,7 +454,8 @@
static struct dm_tree_node *_add_dev(struct dm_tree *dtree,
struct dm_tree_node *parent,
- uint32_t major, uint32_t minor)
+ uint32_t major, uint32_t minor,
+ uint16_t udev_flags)
{
struct dm_task *dmt = NULL;
struct dm_info info;
@@ -471,7 +472,7 @@
return_NULL;
if (!(node = _create_dm_tree_node(dtree, name, uuid, &info,
- NULL, 0)))
+ NULL, udev_flags)))
goto_out;
new = 1;
}
@@ -497,7 +498,7 @@
/* Add dependencies to tree */
for (i = 0; i < deps->count; i++)
if (!_add_dev(dtree, node, MAJOR(deps->device[i]),
- MINOR(deps->device[i]))) {
+ MINOR(deps->device[i]), udev_flags)) {
node = NULL;
goto_out;
}
@@ -652,7 +653,13 @@
int dm_tree_add_dev(struct dm_tree *dtree, uint32_t major, uint32_t minor)
{
- return _add_dev(dtree, &dtree->root, major, minor) ? 1 : 0;
+ return _add_dev(dtree, &dtree->root, major, minor, 0) ? 1 : 0;
+}
+
+int dm_tree_add_dev_with_udev_flags(struct dm_tree *dtree, uint32_t major,
+ uint32_t minor, uint16_t udev_flags)
+{
+ return _add_dev(dtree, &dtree->root, major, minor, udev_flags) ? 1 : 0;
}
const char *dm_tree_node_get_name(struct dm_tree_node *node)
@@ -873,7 +880,8 @@
r = dm_task_run(dmt);
/* FIXME Until kernel returns actual name so dm-ioctl.c can handle it */
- rm_dev_node(name, dmt->cookie_set);
+ rm_dev_node(name, dmt->cookie_set &&
+ !(udev_flags & DM_UDEV_DISABLE_DM_RULES_FLAG));
/* FIXME Remove node from tree or mark invalid? */
@@ -1963,7 +1971,8 @@
}
/* FIXME Check correct macro use */
- if (!(dev_node = _add_dev(node->dtree, node, MAJOR(info.st_rdev), MINOR(info.st_rdev))))
+ if (!(dev_node = _add_dev(node->dtree, node, MAJOR(info.st_rdev),
+ MINOR(info.st_rdev), 0)))
return_0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-01 14:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-01 14:09 LVM2 ./WHATS_NEW ./WHATS_NEW_DM doc/example.co agk
-- strict thread matches above, loose matches on Subject: below --
2011-06-27 21:44 agk
2010-01-07 19:54 prajnoha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).