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

libdm: add check transaction_id after message

Add extra safety detection for thin pool transaction id
and query pool status after confirmed message.

In case there is a missmatch, immeditelly abort further
processing.
This commit is contained in:
Zdenek Kabelac 2014-08-21 15:39:27 +02:00
parent 0794a10f91
commit 8f518cf197
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.89 -
=================================
Add extra check for matching transation_id after message submitting.
Add dm_report_field_string_list_unsorted for str. list report without sorting.
Support --deferred with dmsetup remove to defer removal of open devices.
Update dm-ioctl.h to include DM_DEFERRED_REMOVE flag.

View File

@ -1561,7 +1561,7 @@ static int _node_send_messages(struct dm_tree_node *dnode,
/* Error if there are no stacked messages or id mismatches */
if (trans_id != (seg->transaction_id - have_messages)) {
log_error("Thin pool transaction_id=%" PRIu64 ", while expected: %" PRIu64 ".",
log_error("Thin pool transaction_id is %" PRIu64 ", while expected %" PRIu64 ".",
trans_id, seg->transaction_id - have_messages);
return 0;
}
@ -1569,9 +1569,21 @@ static int _node_send_messages(struct dm_tree_node *dnode,
if (!send)
return 1; /* transaction_id is matching */
dm_list_iterate_items(tmsg, &seg->thin_messages)
dm_list_iterate_items(tmsg, &seg->thin_messages) {
if (!(_thin_pool_node_message(dnode, tmsg)))
return_0;
if (tmsg->message.type == DM_THIN_MESSAGE_SET_TRANSACTION_ID) {
if (!_thin_pool_status_transaction_id(dnode, &trans_id))
return_0;
if (trans_id != tmsg->message.u.m_set_transaction_id.new_id) {
log_error("Thin pool transaction_id is %" PRIu64
" and does not match expected %" PRIu64 ".",
trans_id,
tmsg->message.u.m_set_transaction_id.new_id);
return 0;
}
}
}
dnode->props.send_messages = 0; /* messages posted */