Version 2.02.83 -
===================================
+ Add --addnodeonresume, --addnodeoncreate options for dmsetup create.
Use cluster-wide message to request device name sync.
Fix operation node stacking for consecutive dm ops.
Increase hash table size to 1024 lv names and 64 pv uuids.
return 1;
}
+int dm_task_set_add_node(struct dm_task *dmt, dm_add_node_t add_node)
+{
+ switch (add_node) {
+ case DM_ADD_NODE_ON_RESUME:
+ case DM_ADD_NODE_ON_CREATE:
+ dmt->add_node = add_node;
+ return 1;
+ default:
+ log_error("Unknown add node parameter");
+ return 0;
+ }
+}
+
int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid)
{
if (strlen(newuuid) >= DM_UUID_LEN) {
switch (dmt->type) {
case DM_DEVICE_CREATE:
- if (dmt->dev_name && *dmt->dev_name && !udev_only)
+ if ((dmt->add_node == DM_ADD_NODE_ON_CREATE) &&
+ dmt->dev_name && *dmt->dev_name && !udev_only)
add_dev_node(dmt->dev_name, MAJOR(dmi->dev),
MINOR(dmi->dev), dmt->uid, dmt->gid,
dmt->mode, check_udev);
break;
case DM_DEVICE_RESUME:
+ if ((dmt->add_node == DM_ADD_NODE_ON_RESUME) &&
+ dmt->dev_name && *dmt->dev_name && !udev_only)
+ add_dev_node(dmt->dev_name, MAJOR(dmi->dev),
+ MINOR(dmi->dev), dmt->uid, dmt->gid,
+ dmt->mode, check_udev);
/* FIXME Kernel needs to fill in dmi->name */
set_dev_node_read_ahead(dmt->dev_name, dmt->read_ahead,
dmt->read_ahead_flags);
int skip_lockfs;
int query_inactive_table;
int suppress_identical_reload;
+ dm_add_node_t add_node;
uint64_t existing_table_size;
int cookie_set;
int new_uuid;
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);
+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 */
+} dm_add_node_t;
+int dm_task_set_add_node(struct dm_task *dmt, dm_add_node_t add_node);
/*
* Control read_ahead.
.br
.B dmsetup create
.I device_name [-u uuid] [--notable | --table <table> | table_file]
+.I [{ --addnodeonresume | --addnodeoncreate }]
.br
.B dmsetup remove
.I [-f|--force] device_name
.IP \fB--notable
.br
When creating a device, don't load any table.
+.IP \fB--addnodeonresume
+.br
+Ensure /dev/mapper node exists after dmsetup resume (default with udev).
+.IP \fB--addnodeoncreate
+.br
+Ensure /dev/mapper node exists after dmsetup create.
.IP \fB--udevcookie\ \fIcookie
.br
Use cookie for udev synchronisation.
VERBOSE_ARG,
VERSION_ARG,
YES_ARG,
+ ADD_NODE_ON_RESUME_ARG,
+ ADD_NODE_ON_CREATE_ARG,
NUM_SWITCHES
};
udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+ if (_switches[ADD_NODE_ON_RESUME_ARG] &&
+ !dm_task_set_add_node(dmt, DM_ADD_NODE_ON_RESUME))
+ goto out;
+
+ if (_switches[ADD_NODE_ON_CREATE_ARG] &&
+ !dm_task_set_add_node(dmt, DM_ADD_NODE_ON_CREATE))
+ goto out;
+
if (_udev_cookie) {
cookie = _udev_cookie;
if (_udev_only)
{"help", "[-c|-C|--columns]", 0, 0, _help},
{"create", "<dev_name> [-j|--major <major> -m|--minor <minor>]\n"
"\t [-U|--uid <uid>] [-G|--gid <gid>] [-M|--mode <octal_mode>]\n"
- "\t [-u|uuid <uuid>]\n"
+ "\t [-u|uuid <uuid>] [{--addnodeonresume|--addnodeoncreate}]\n"
"\t [--notable | --table <table> | <table_file>]",
1, 2, _create},
{"remove", "[-f|--force] <device>", 0, 1, _remove},
{"verbose", 1, &ind, VERBOSE_ARG},
{"version", 0, &ind, VERSION_ARG},
{"yes", 0, &ind, YES_ARG},
+ {"addnodeonresume", 0, &ind, ADD_NODE_ON_RESUME_ARG},
+ {"addnodeoncreate", 0, &ind, ADD_NODE_ON_CREATE_ARG},
{0, 0, 0, 0}
};
#else
}
if (c == 'y' || ind == YES_ARG)
_switches[YES_ARG]++;
+ if (ind == ADD_NODE_ON_RESUME_ARG)
+ _switches[ADD_NODE_ON_RESUME_ARG]++;
+ if (ind == ADD_NODE_ON_CREATE_ARG)
+ _switches[ADD_NODE_ON_CREATE_ARG]++;
if (ind == UDEVCOOKIE_ARG) {
_switches[UDEVCOOKIE_ARG]++;
_udev_cookie = _get_cookie_value(optarg);
return 0;
}
+ if (_switches[ADD_NODE_ON_RESUME_ARG] && _switches[ADD_NODE_ON_CREATE_ARG]) {
+ fprintf(stderr, "--addnodeonresume and --addnodeoncreate are incompatible.\n");
+ return 0;
+ }
+
*argv += optind;
*argc -= optind;
return 1;