master - locking: reset global_ex flag at end of cmd
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=36cbc6db24f8aa01fb1c1be095b22a672434f754 Commit: 36cbc6db24f8aa01fb1c1be095b22a672434f754 Parent: 4c020b4d4afff51272252f58e5251f79c26f6603 Author: David Teigland <[email protected]> AuthorDate: Mon Jun 10 10:07:30 2019 -0500 Committer: David Teigland <[email protected]> CommitterDate: Mon Jun 10 10:34:58 2019 -0500
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.
--- lib/locking/locking.c | 10 +++++++++- lib/locking/locking.h | 2 +- tools/lvmcmdline.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-)
lib/locking/locking.c +9 -1
@@ -156,12 +156,20 @@ int init_locking(struct cmd_context *cmd,return 1 ; } -void fin_locking (void ) +void fin_locking (struct cmd_context *cmd) {/* file locking disabled */ if (!_locking.flags)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 (); }
lib/locking/locking.h +1 -1
@@ -22,7 +22,7 @@struct logical_volume ;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 );int vg_write_lock_held (void );
tools/lvmcmdline.c +1 -1
@@ -3043,7 +3043,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv) ret = cmd->command->fn (cmd, argc, argv);lvmlockd_disconnect (); -fin_locking (); +fin_locking (cmd);if (!_cmd_no_meta_proc (cmd) &&find_config_tree_bool (cmd, global_notify_dbus_CFG,NULL ))lvmnotify_send (cmd);