mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
f32fd1fcb9
Lock adoption is not part of standard command behavior, but can be used for manual recovery or cleanup from unexpected failure cases. Like other lockopt values, they are hidden options for --lockopt. Different lock managers will behave differently. Adopting locks with lvmlockd -A1 is more accurate and automatic. --lockopt adoptls . for vgchange --lockstart . adopt existing ls, or fail if no existing lockspace is found --lockopt adoptgl | adoptvg | adoptlv . for commands using lvmlockd locks . adopt orphan gl/vg/lv lock, or fail the lock request if no orphan lock is found . will fail if orphan lock exists with a different lock mode . command may still continue with a failed shared lock request --lockopt adopt . for lockstart or any command using lvmlockd locks . adopt existing lockspace, or start lockspace if none exists . adopt orphan gl/vg/lv lock, or acquire new lock if no orphan found . will fail if orphan lock exists with a different lock mode . command may still continue with a failed shared lock request . with dlm this option only works for ls
62 lines
1.6 KiB
C
62 lines
1.6 KiB
C
/*
|
|
* Copyright (C) 2014-2015 Red Hat, Inc.
|
|
*
|
|
* This file is part of LVM2.
|
|
*
|
|
* This copyrighted material is made available to anyone wishing to use,
|
|
* modify, copy, or redistribute it subject to the terms and conditions
|
|
* of the GNU Lesser General Public License v.2.1.
|
|
*/
|
|
|
|
#ifndef _LVM_LVMLOCKD_CLIENT_H
|
|
#define _LVM_LVMLOCKD_CLIENT_H
|
|
|
|
#include "libdaemon/client/daemon-client.h"
|
|
|
|
#define LVMLOCKD_SOCKET DEFAULT_RUN_DIR "/lvmlockd.socket"
|
|
#define LVMLOCKD_ADOPT_FILE DEFAULT_RUN_DIR "/lvmlockd.adopt"
|
|
|
|
#define LVMLOCKD_USE_SANLOCK_LVB 0
|
|
|
|
/* Wrappers to open/close connection */
|
|
|
|
static inline __attribute__((always_inline))
|
|
daemon_handle lvmlockd_open(const char *sock)
|
|
{
|
|
daemon_info lvmlockd_info = {
|
|
.path = "lvmlockd",
|
|
.socket = sock ?: LVMLOCKD_SOCKET,
|
|
.autostart = 0,
|
|
.protocol = "lvmlockd",
|
|
.protocol_version = 1,
|
|
};
|
|
|
|
return daemon_open(lvmlockd_info);
|
|
}
|
|
|
|
static inline void lvmlockd_close(daemon_handle h)
|
|
{
|
|
daemon_close(h);
|
|
}
|
|
|
|
/*
|
|
* Errors returned as the lvmlockd result value.
|
|
*/
|
|
#define ENOLS 210 /* lockspace not found */
|
|
#define ESTARTING 211 /* lockspace is starting */
|
|
#define EARGS 212
|
|
#define EHOSTID 213
|
|
#define EMANAGER 214
|
|
#define EPREPARE 215
|
|
#define ELOCKD 216
|
|
#define EVGKILLED 217 /* sanlock lost access to leases and VG is killed. */
|
|
#define ELOCKIO 218 /* sanlock io errors during lock op, may be transient. */
|
|
#define EREMOVED 219
|
|
#define EDEVOPEN 220 /* sanlock failed to open lvmlock LV */
|
|
#define ELMERR 221
|
|
#define EORPHAN 222
|
|
#define EADOPT_NONE 223
|
|
#define EADOPT_RETRY 224
|
|
|
|
#endif /* _LVM_LVMLOCKD_CLIENT_H */
|