1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

locking: reset global_ex flag at end of cmd

These two flags may be not reset at the end of
the command when the unlock is implicit, which
is a problem if the cmd struct is reused.
Clear the flags in the general fin_locking.
This commit is contained in:
David Teigland 2019-06-10 10:07:30 -05:00
parent 4c020b4d4a
commit 36cbc6db24
3 changed files with 11 additions and 3 deletions

View File

@ -156,12 +156,20 @@ int init_locking(struct cmd_context *cmd,
return 1; return 1;
} }
void fin_locking(void) void fin_locking(struct cmd_context *cmd)
{ {
/* file locking disabled */ /* file locking disabled */
if (!_locking.flags) if (!_locking.flags)
return; return;
/*
* These may be automatically released when the
* command ends, without an explicit unlock call,
* in which case these flags would not be cleared.
*/
cmd->lockf_global_ex = 0;
cmd->lockd_global_ex = 0;
_locking.fin_locking(); _locking.fin_locking();
} }

View File

@ -22,7 +22,7 @@
struct logical_volume; struct logical_volume;
int init_locking(struct cmd_context *cmd, int file_locking_sysinit, int file_locking_readonly, int file_locking_ignorefail); int init_locking(struct cmd_context *cmd, int file_locking_sysinit, int file_locking_readonly, int file_locking_ignorefail);
void fin_locking(void); void fin_locking(struct cmd_context *cmd);
void reset_locking(void); void reset_locking(void);
int vg_write_lock_held(void); int vg_write_lock_held(void);

View File

@ -3043,7 +3043,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
ret = cmd->command->fn(cmd, argc, argv); ret = cmd->command->fn(cmd, argc, argv);
lvmlockd_disconnect(); lvmlockd_disconnect();
fin_locking(); fin_locking(cmd);
if (!_cmd_no_meta_proc(cmd) && find_config_tree_bool(cmd, global_notify_dbus_CFG, NULL)) if (!_cmd_no_meta_proc(cmd) && find_config_tree_bool(cmd, global_notify_dbus_CFG, NULL))
lvmnotify_send(cmd); lvmnotify_send(cmd);