mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
locking: Add node parameter to query_resource.
This commit is contained in:
parent
7f6a1e6bba
commit
c812c2dbc7
@ -76,8 +76,10 @@ static const char CLVMD_SOCKNAME[]= DEFAULT_RUN_DIR "/clvmd.sock";
|
||||
#define CLVMD_CMD_SYNC_NAMES 45
|
||||
|
||||
/* Used internally by some callers, but not part of the protocol.*/
|
||||
#define NODE_ALL "*"
|
||||
#define NODE_LOCAL "."
|
||||
#define NODE_REMOTE "^"
|
||||
#ifndef NODE_ALL
|
||||
# define NODE_ALL "*"
|
||||
# define NODE_LOCAL "."
|
||||
# define NODE_REMOTE "^"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1371,7 +1371,7 @@ static int _lv_is_active(const struct logical_volume *lv,
|
||||
if (l && !exclusive)
|
||||
goto out;
|
||||
|
||||
if ((r = remote_lock_held(lv->lvid.s, &e)) >= 0)
|
||||
if ((r = cluster_lock_held(lv->lvid.s, "", &e)) >= 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef CLUSTER_LOCKING_INTERNAL
|
||||
int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags, const struct logical_volume *lv __attribute__((unused)));
|
||||
int query_resource(const char *resource, int *mode);
|
||||
int query_resource(const char *resource, const char *node, int *mode);
|
||||
void locking_end(void);
|
||||
int locking_init(int type, struct dm_config_tree *cf, uint32_t *flags);
|
||||
#endif
|
||||
@ -530,13 +530,12 @@ static int decode_lock_type(const char *response)
|
||||
}
|
||||
|
||||
#ifdef CLUSTER_LOCKING_INTERNAL
|
||||
static int _query_resource(const char *resource, int *mode)
|
||||
static int _query_resource(const char *resource, const char *node, int *mode)
|
||||
#else
|
||||
int query_resource(const char *resource, int *mode)
|
||||
int query_resource(const char *resource, const char *node, int *mode)
|
||||
#endif
|
||||
{
|
||||
int i, status, len, num_responses, saved_errno;
|
||||
const char *node = "";
|
||||
char *args;
|
||||
lvm_response_t *response = NULL;
|
||||
|
||||
|
@ -498,7 +498,7 @@ int locking_supports_remote_queries(void)
|
||||
return (_locking.flags & LCK_SUPPORTS_REMOTE_QUERIES) ? 1 : 0;
|
||||
}
|
||||
|
||||
int remote_lock_held(const char *vol, int *exclusive)
|
||||
int cluster_lock_held(const char *vol, const char *node, int *exclusive)
|
||||
{
|
||||
int mode = LCK_NULL;
|
||||
|
||||
@ -511,7 +511,7 @@ int remote_lock_held(const char *vol, int *exclusive)
|
||||
/*
|
||||
* If an error occured, expect that volume is active
|
||||
*/
|
||||
if (!_locking.query_resource(vol, &mode)) {
|
||||
if (!_locking.query_resource(vol, node, &mode)) {
|
||||
stack;
|
||||
return 1;
|
||||
}
|
||||
|
@ -28,7 +28,12 @@ int vg_write_lock_held(void);
|
||||
int locking_is_clustered(void);
|
||||
int locking_supports_remote_queries(void);
|
||||
|
||||
int remote_lock_held(const char *vol, int *exclusive);
|
||||
#ifndef NODE_ALL
|
||||
# define NODE_ALL "*"
|
||||
# define NODE_LOCAL "."
|
||||
# define NODE_REMOTE "^"
|
||||
#endif
|
||||
int cluster_lock_held(const char *vol, const char *node, int *exclusive);
|
||||
|
||||
/*
|
||||
* LCK_VG:
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource,
|
||||
uint32_t flags, const struct logical_volume *lv);
|
||||
typedef int (*query_resource_fn) (const char *resource, int *mode);
|
||||
typedef int (*query_resource_fn) (const char *resource, const char *node, int *mode);
|
||||
|
||||
typedef void (*fin_lock_fn) (void);
|
||||
typedef void (*reset_lock_fn) (void);
|
||||
|
@ -70,7 +70,7 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _no_query_resource(const char *resource, int *mode)
|
||||
static int _no_query_resource(const char *resource, const char *node, int *mode)
|
||||
{
|
||||
log_very_verbose("Locking is disabled: Treating lock %s as not held.",
|
||||
resource);
|
||||
|
Loading…
x
Reference in New Issue
Block a user