LVM2 ./WHATS_NEW ./WHATS_NEW_DM doc/example.co ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: prajnoha at 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
WHATS_NEW +1 -0
@@ -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.
WHATS_NEW_DM +1 -0
@@ -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().
doc/example.conf +8 -1
@@ -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
lib/activate/dev_manager.c +21 -2
@@ -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;
lib/activate/fs.c +30 -22
161 lines not on this page · raw message
lib/activate/fs.h +3 -2
@@ -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
lib/commands/toolcontext.c +4 -0
@@ -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 );
lib/commands/toolcontext.h +1 -0
@@ -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;
lib/config/defaults.h +1 -0
@@ -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
libdm/.exported_symbols +1 -0
@@ -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
libdm/libdevmapper.h +2 -0
@@ -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.
libdm/libdm-deptree.c +15 -6
@@ -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; }