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

lvmlockd: ignore cmd close if no locks were taken

When a command closes its connection, don't waste
time looking for locks to purge if it did not make
any lock requests.
This commit is contained in:
David Teigland 2015-08-19 12:16:04 -05:00
parent ce2e60ab45
commit 62a87c84ed
2 changed files with 11 additions and 0 deletions

View File

@ -3529,6 +3529,13 @@ static void client_purge(struct client *cl)
struct lockspace *ls;
struct action *act;
/*
* If the client made no lock requests, there can be
* no locks to release for it.
*/
if (!cl->lock_ops)
return;
pthread_mutex_lock(&lockspaces_mutex);
list_for_each_entry(ls, &lockspaces, list) {
if (!(act = alloc_action()))
@ -4345,6 +4352,9 @@ static void client_recv_action(struct client *cl)
goto out;
}
if (act->op == LD_OP_LOCK && act->mode != LD_LK_UN)
cl->lock_ops = 1;
switch (act->op) {
case LD_OP_START:
rv = add_lockspace(act);

View File

@ -85,6 +85,7 @@ struct client {
unsigned int recv : 1;
unsigned int dead : 1;
unsigned int poll_ignore : 1;
unsigned int lock_ops : 1;
char name[MAX_NAME+1];
};