Skip to contentSkip to conversation

LVM2 ./WHATS_NEW ./WHATS_NEW_DM doc/example.co ...

PATCH [email protected] 1 participant 1 message Jun 27, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at 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

WHATS_NEW +1 -1
@@ -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.
WHATS_NEW_DM +2 -2
@@ -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.
doc/example.conf.in +5 -6
@@ -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
lib/commands/toolcontext.c +2 -2
@@ -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;
lib/config/defaults.h +1 -1
@@ -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
libdm/libdm-common.c +67 -48

269 lines not on this page · raw message

libdm/libdm-common.h +3 -3
@@ -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);
libdm/libdm-deptree.c +3 -4
@@ -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? */
 
libdm/ioctl/libdm-iface.c +16 -13
@@ -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:
man/dmsetup.8.in +4 -0
@@ -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.
tools/dmsetup.c +6 -6
@@ -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);