diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-08-21 15:39:27 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-08-26 14:12:20 +0200 |
commit | 8f518cf1979e4cbfce40f6ae1bed02bd5b9a5b35 (patch) | |
tree | 961b1207af5bdc60f51ab8b2e56e925718c6f383 | |
parent | 0794a10f91557d58e865faff4c60aef6336ecf22 (diff) | |
download | lvm2-8f518cf1979e4cbfce40f6ae1bed02bd5b9a5b35.tar.gz |
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.
-rw-r--r-- | WHATS_NEW_DM | 1 | ||||
-rw-r--r-- | libdm/libdm-deptree.c | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 9f1679712..484cb7eef 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -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. diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 55f061ae8..0048b1c1a 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -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 */ |