mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
devmapper-event: add unlock into init_fifo error path
Unlock server path if there is open failure for client_path and whole init_fifos() function is returning failure.
This commit is contained in:
parent
3a433b14f2
commit
54840d867e
@ -513,7 +513,7 @@ int init_fifos(struct dm_event_fifos *fifos)
|
|||||||
/* Lock out anyone else trying to do communication with the daemon. */
|
/* Lock out anyone else trying to do communication with the daemon. */
|
||||||
if (flock(fifos->server, LOCK_EX) < 0) {
|
if (flock(fifos->server, LOCK_EX) < 0) {
|
||||||
log_sys_error("flock", fifos->server_path);
|
log_sys_error("flock", fifos->server_path);
|
||||||
goto bad;
|
goto bad_no_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if ((fifos->client = open(fifos->client_path, O_WRONLY | O_NONBLOCK)) < 0) {*/
|
/* if ((fifos->client = open(fifos->client_path, O_WRONLY | O_NONBLOCK)) < 0) {*/
|
||||||
@ -524,6 +524,9 @@ int init_fifos(struct dm_event_fifos *fifos)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
bad:
|
bad:
|
||||||
|
if (flock(fifos->server, LOCK_UN))
|
||||||
|
log_sys_debug("flock unlock", fifos->server_path);
|
||||||
|
bad_no_unlock:
|
||||||
if (close(fifos->server))
|
if (close(fifos->server))
|
||||||
log_sys_debug("close", fifos->server_path);
|
log_sys_debug("close", fifos->server_path);
|
||||||
fifos->server = -1;
|
fifos->server = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user