main - lib: locking: Add new type "idm"
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ef1c57e68fa67dc0bc144b3a745bc456c3232d3e Commit: ef1c57e68fa67dc0bc144b3a745bc456c3232d3e Parent: d02f5392a0ed8a5f6b7aa14642db1f46ac0682d8 Author: Leo Yan <[email protected]> AuthorDate: Fri May 7 10:25:14 2021 +0800 Committer: David Teigland <[email protected]> CommitterDate: Thu May 20 16:01:05 2021 -0500
lib: locking: Add new type "idm"
We can consider the drive firmware a server to handle the locking request from nodes, this essentially is a client-server model. DLM uses the kernel as a central place to manage locks, so it also complies with client-server model for locking operations. This is why IDM and DLM are similar with each other for their wrappers.
This patch largely works by generalizing the DLM code paths and then providing degeneralized functions as wrappers for both IDM and DLM.
Signed-off-by Leo Yan <[email protected]>
--- lib/display/display.c | 4 +++ lib/locking/lvmlockd.c | 72 ++++++++++++++++++++++++++++++++++------ lib/metadata/metadata-exported.h | 1 + lib/metadata/metadata.c | 12 ++++++- 4 files changed, 78 insertions(+), 11 deletions(-)
lib/display/display.c +4 -0
@@ -95,6 +95,8 @@ const char *get_lock_type_string(lock_type_t lock_type)return "dlm" ;case LOCK_TYPE_SANLOCK :return "sanlock" ; +case LOCK_TYPE_IDM : +return "idm" ; }return "invalid" ; }
@@ -111,6 +113,8 @@ lock_type_t get_lock_type_from_string(const char *str)return LOCK_TYPE_DLM ;if (!strcmp (str,"sanlock" ))return LOCK_TYPE_SANLOCK ; +if (!strcmp (str,"idm" )) +return LOCK_TYPE_IDM ;return LOCK_TYPE_INVALID ; }
lib/locking/lvmlockd.c +62 -10
184 lines not on this page · raw message
lib/metadata/metadata-exported.h +1 -0
@@ -356,6 +356,7 @@ typedef enum {LOCK_TYPE_CLVM =1 ,LOCK_TYPE_DLM =2 ,LOCK_TYPE_SANLOCK =3 , +LOCK_TYPE_IDM =4 , } lock_type_t;struct cmd_context ;
lib/metadata/metadata.c +11 -1
@@ -2235,6 +2235,13 @@ static int _validate_lv_lock_args(struct logical_volume *lv) lv->vg->name, display_lvname(lv), lv->lock_args); r =0 ; } + + }else if (!strcmp (lv->vg->lock_type,"idm" )) { +if (strcmp (lv->lock_args,"idm" )) { +log_error (INTERNAL_ERROR "LV %s/%s has invalid lock_args \"%s\"" , + lv->vg->name,display_lvname (lv), lv->lock_args); + r =0 ; + } }return r;
@@ -2569,7 +2576,8 @@ int vg_validate(struct volume_group *vg) r =0 ; } -if (strcmp (vg->lock_type,"sanlock" ) &&strcmp (vg->lock_type,"dlm" )) { +if (strcmp (vg->lock_type,"sanlock" ) &&strcmp (vg->lock_type,"dlm" ) && +strcmp (vg->lock_type,"idm" )) {log_error (INTERNAL_ERROR "VG %s has unknown lock_type %s" , vg->name, vg->lock_type); r =0 ;
@@ -4355,6 +4363,8 @@ int is_lockd_type(const char *lock_type)return 1 ;if (!strcmp (lock_type,"sanlock" ))return 1 ; +if (!strcmp (lock_type,"idm" )) +return 1 ;return 0 ; }