mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmlockd: client mutex ordering
Avoid deadlock between threads on mutexes (in theory.)
This commit is contained in:
parent
65d23a1d75
commit
c37416b6aa
@ -4690,9 +4690,12 @@ static int dump_info(int *dump_len)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* clients
|
* clients
|
||||||
|
* Proper lock order is client_mutex then cl->mutex,
|
||||||
|
* but cl->mutex is already held so skip client info
|
||||||
|
* if it would block.
|
||||||
*/
|
*/
|
||||||
|
if (pthread_mutex_trylock(&client_mutex))
|
||||||
pthread_mutex_lock(&client_mutex);
|
goto print_ls;
|
||||||
list_for_each_entry(cl, &client_list, list) {
|
list_for_each_entry(cl, &client_list, list) {
|
||||||
ret = print_client(cl, "client", pos, len);
|
ret = print_client(cl, "client", pos, len);
|
||||||
if (ret >= len - pos) {
|
if (ret >= len - pos) {
|
||||||
@ -4706,6 +4709,7 @@ static int dump_info(int *dump_len)
|
|||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
print_ls:
|
||||||
/*
|
/*
|
||||||
* lockspaces with their action/resource/lock info
|
* lockspaces with their action/resource/lock info
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user