1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Add internal expected_errno dm_tast var

Certain errno codes could be expected in some situations thus
add experimental support for them.

When expected errno is set after ioctl error - function skips error
printing and exits succefully.

Currently only useful for thin pool messages.
This commit is contained in:
Zdenek Kabelac 2011-10-19 16:36:01 +00:00
parent b04e977851
commit 660a42bc78
3 changed files with 9 additions and 1 deletions

View File

@ -1635,7 +1635,8 @@ static struct dm_ioctl *_do_dm_ioctl(struct dm_task *dmt, unsigned command,
dmt->sector, _sanitise_message(dmt->message),
dmi->data_size, retry_repeat_count);
#ifdef DM_IOCTLS
if (ioctl(_control_fd, command, dmi) < 0) {
if (ioctl(_control_fd, command, dmi) < 0 &&
dmt->expected_errno != errno) {
if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||
(dmt->type == DM_DEVICE_MKNODES) ||
(dmt->type == DM_DEVICE_STATUS)))

View File

@ -65,6 +65,7 @@ struct dm_task {
int secure_data;
int retry_remove;
int enable_checks;
int expected_errno;
char *uuid;
};

View File

@ -111,6 +111,7 @@ struct seg_area {
struct thin_message {
struct dm_list list;
struct dm_thin_message message;
int expected_errno;
};
/* Replicator-log has a list of sites */
@ -1314,6 +1315,9 @@ static int _thin_pool_node_message(struct dm_tree_node *dnode, struct thin_messa
if (!dm_task_set_message(dmt, buf))
goto_out;
/* Internal functionality of dm_task */
dmt->expected_errno = tm->expected_errno;
if (!dm_task_run(dmt))
goto_out;
@ -2912,11 +2916,13 @@ int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
if (!_thin_validate_device_id(message->u.m_create_thin.device_id))
return_0;
tm->message.u.m_create_thin.device_id = message->u.m_create_thin.device_id;
tm->expected_errno = EEXIST;
break;
case DM_THIN_MESSAGE_DELETE:
if (!_thin_validate_device_id(message->u.m_delete.device_id))
return_0;
tm->message.u.m_delete.device_id = message->u.m_delete.device_id;
tm->expected_errno = ENODATA;
break;
case DM_THIN_MESSAGE_TRIM:
if (!_thin_validate_device_id(message->u.m_trim.device_id))