diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2020-09-28 23:12:48 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2020-09-29 10:43:56 +0200 |
commit | 18c74666ee668c5d4569c868f38c3d8ae950dda1 (patch) | |
tree | 1a54ec497aaf3eacbd5494173fe2f2a3759fb98b | |
parent | 4de6f58085c533c79ce2e0db6cdeb6ed06fe05f8 (diff) | |
download | lvm2-18c74666ee668c5d4569c868f38c3d8ae950dda1.tar.gz |
thin: validate thin-pool state before sending messages
Alhtough lvm2 does validation on its side, ensure DM code
is not sending messages to failed thin pool.
-rw-r--r-- | device_mapper/libdm-deptree.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/device_mapper/libdm-deptree.c b/device_mapper/libdm-deptree.c index a98b1fcdd..d9e1683ca 100644 --- a/device_mapper/libdm-deptree.c +++ b/device_mapper/libdm-deptree.c @@ -1666,6 +1666,15 @@ static int _thin_pool_node_send_messages(struct dm_tree_node *dnode, if (!have_messages || !send) return 1; /* transaction_id is matching */ + if (stp.fail || stp.read_only || stp.needs_check) { + log_error("Cannot send messages to thin pool %s%s%s%s.", + _node_name(dnode), + stp.fail ? " in failed state" : "", + stp.read_only ? " with read only metadata" : "", + stp.needs_check ? " which needs check first" : ""); + return 0; + } + dm_list_iterate_items(tmsg, &seg->thin_messages) { if (!(_thin_pool_node_message(dnode, tmsg))) return_0; |