master - clvmd: Fix client list corruption
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f2eda36cfa9baf3f7e132dbc3a3f34c908cb36d4 Commit: f2eda36cfa9baf3f7e132dbc3a3f34c908cb36d4 Parent: af789fd6d0cba45cc4897772bae3ca73a3f15b38 Author: Alasdair G Kergon <[email protected]> AuthorDate: Sat Jul 1 01:34:38 2017 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Sat Jul 1 01:34:38 2017 +0100
clvmd: Fix client list corruption
Centralise editing of the client list into _add_client() and _del_client(). Introduce _local_client_count to track the size of the list for debugging purposes. Simplify and standardise the various ways the list gets walked.
While processing one element of the list in main_loop(), cleanup_zombie() may be called and remove a different element, so make sure main_loop() refreshes its list state on return. Prior to this patch, the list edits for clients disappearing could race against the list edits for new clients connecting and corrupt the list and cause a variety of segfaults.
An easy way to trigger such failures was by repeatedly running shell commands such as:
lvs &; lvs &; lvs &;...;killall -9 lvs; lvs &; lvs &;...
Situations that occasionally lead to the failures can be spotted by looking for 'EOF' with 'inprogress=1' in the clvmd debug logs.
--- WHATS_NEW | 1 + daemons/clvmd/clvmd.c | 90 ++++++++++++++++++++++++++++++------------------- 2 files changed, 56 insertions(+), 35 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.173 - ================================= + Tidy clvmd client list processing and fix segfaults. Protect clvmd debug log messages with mutex and add client id. Fix shellcheck reported issues for script files.
daemons/clvmd/clvmd.c +55 -35
169 lines not on this page · raw message