master - locking: Add node parameter to query_resource.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c812c2dbc7ced09a715e5689f941ba255821f0bc Commit: c812c2dbc7ced09a715e5689f941ba255821f0bc Parent: 7f6a1e6bbac41bb5d0e18876c23a7442c8c0d263 Author: Alasdair G Kergon <[email protected]> AuthorDate: Tue Jan 19 21:42:22 2016 +0000 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Tue Jan 19 21:42:22 2016 +0000
locking: Add node parameter to query_resource.
--- daemons/clvmd/clvm.h | 8 +++++--- lib/activate/activate.c | 2 +- lib/locking/cluster_locking.c | 7 +++---- lib/locking/locking.c | 4 ++-- lib/locking/locking.h | 7 ++++++- lib/locking/locking_types.h | 2 +- lib/locking/no_locking.c | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-)
daemons/clvmd/clvm.h +5 -3
@@ -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
lib/activate/activate.c +1 -1
@@ -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;/*
lib/locking/cluster_locking.c +3 -4
@@ -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 ;
lib/locking/locking.c +2 -2
@@ -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 ; }
lib/locking/locking.h +6 -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:
lib/locking/locking_types.h +1 -1
@@ -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 );
lib/locking/no_locking.c +1 -1
@@ -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);