#include "lib/activate/activate.h"
#include "lib/filters/filter.h"
#include "lib/label/label.h"
+#include "lib/label/hints.h"
#include "lib/misc/lvm-file.h"
#include "lib/format_text/format-text.h"
#include "lib/display/display.h"
*/
activation_release();
+ hints_exit();
lvmcache_destroy(cmd, 0, 0);
label_scan_destroy(cmd);
label_exit();
archive_exit(cmd);
backup_exit(cmd);
+ hints_exit();
lvmcache_destroy(cmd, 0, 0);
label_scan_destroy(cmd);
label_exit();
_hints_fd = -1;
}
+void hints_exit(void)
+{
+ if (_hints_fd == -1)
+ return;
+ return _unlock_hints();
+}
+
static struct hint *_find_hint_name(struct dm_list *hints, const char *name)
{
struct hint *hint;
if (!cmd->enable_hints)
return;
+ log_debug("clear_hint_file");
+
/*
* This function runs even when cmd->use_hints is 0,
* which means this command does not use hints, but
if (!_touch_nohints())
stack;
- /*
- * We are relying on the command exit to release this flock,
- * we should probably add an explicit unlock_hints call.
- */
-
if (!_lock_hints(LOCK_EX, 0))
stack;
int validate_hints(struct cmd_context *cmd, struct dm_list *hints);
+void hints_exit(void);
+
#endif
/* Only certain commands need to be optimized by using hints. */
if (cmd->cname->flags & ALLOW_HINTS)
cmd->use_hints = 1;
+ else
+ cmd->use_hints = 0;
if ((hint_mode = find_config_tree_str(cmd, devices_hints_CFG, NULL))) {
if (!strcmp(hint_mode, "none"))
out:
+ hints_exit();
lvmcache_destroy(cmd, 1, 1);
label_scan_destroy(cmd);