Ack with minor comment: the indentation seems to be wrong: files with 
the .c suffix should be indented using tabs. Please run "make 
checkpatch" to find style problems in .c files. Here is the output from 
checkpatch:

src/lck/lcknd/glnd_client.c:329: WARNING: suspect code indent for 
conditional statements (24, 8)
              if (resource_list->rsc_info->status ==
[...]
+        if (lock_req_list->lck_req->lock_info.lockStatus ==

src/lck/lcknd/glnd_client.c:331: ERROR: code indent should use tabs 
where possible
+        if (lock_req_list->lck_req->lock_info.lockStatus ==$

src/lck/lcknd/glnd_client.c:331: WARNING: please, no spaces at the start 
of a line
+        if (lock_req_list->lck_req->lock_info.lockStatus ==$

src/lck/lcknd/glnd_client.c:331: WARNING: suspect code indent for 
conditional statements (8, 10)
+        if (lock_req_list->lck_req->lock_info.lockStatus ==
[...]
+          TRACE("lock granted: sending orphan request");

src/lck/lcknd/glnd_client.c:332: ERROR: code indent should use tabs 
where possible
+              SA_LCK_LOCK_GRANTED) {$

src/lck/lcknd/glnd_client.c:332: WARNING: please, no spaces at the start 
of a line
+              SA_LCK_LOCK_GRANTED) {$

src/lck/lcknd/glnd_client.c:333: ERROR: code indent should use tabs 
where possible
+          TRACE("lock granted: sending orphan request");$

src/lck/lcknd/glnd_client.c:333: WARNING: please, no spaces at the start 
of a line
+          TRACE("lock granted: sending orphan request");$

src/lck/lcknd/glnd_client.c:339: WARNING: line over 80 characters
+ lock_req_list->lck_req->lock_info.handleId,

src/lck/lcknd/glnd_client.c:341: WARNING: line over 80 characters
+ lock_req_list->lck_req->lock_info.lock_type,

src/lck/lcknd/glnd_client.c:342: WARNING: line over 80 characters
+ lock_req_list->lck_req->lock_info.lockFlags,

src/lck/lcknd/glnd_client.c:344: WARNING: line over 80 characters
+ lock_req_list->lck_req->lock_info.lcl_lockid,

src/lck/lcknd/glnd_client.c:351: ERROR: code indent should use tabs 
where possible
+        } else {$

src/lck/lcknd/glnd_client.c:351: WARNING: please, no spaces at the start 
of a line
+        } else {$

src/lck/lcknd/glnd_client.c:352: ERROR: code indent should use tabs 
where possible
+          TRACE("lock still outstanding: sending cancel request");$

src/lck/lcknd/glnd_client.c:352: WARNING: please, no spaces at the start 
of a line
+          TRACE("lock still outstanding: sending cancel request");$

src/lck/lcknd/glnd_client.c:353: ERROR: code indent should use tabs 
where possible
+          m_GLND_RESOURCE_NODE_LCK_INFO_FILL($

src/lck/lcknd/glnd_client.c:353: WARNING: please, no spaces at the start 
of a line
+          m_GLND_RESOURCE_NODE_LCK_INFO_FILL($

src/lck/lcknd/glnd_client.c:354: ERROR: code indent should use tabs 
where possible
+            glnd_evt,$

src/lck/lcknd/glnd_client.c:354: WARNING: please, no spaces at the start 
of a line
+            glnd_evt,$

src/lck/lcknd/glnd_client.c:355: ERROR: code indent should use tabs 
where possible
+            GLSV_GLND_EVT_LCK_REQ_CANCEL,$

src/lck/lcknd/glnd_client.c:355: WARNING: please, no spaces at the start 
of a line
+            GLSV_GLND_EVT_LCK_REQ_CANCEL,$

src/lck/lcknd/glnd_client.c:356: ERROR: code indent should use tabs 
where possible
+            resource_list->rsc_info->resource_id,$

src/lck/lcknd/glnd_client.c:356: WARNING: please, no spaces at the start 
of a line
+            resource_list->rsc_info->resource_id,$

src/lck/lcknd/glnd_client.c:357: ERROR: code indent should use tabs 
where possible
+            lock_req_list->lck_req->lcl_resource_id,$

src/lck/lcknd/glnd_client.c:357: WARNING: please, no spaces at the start 
of a line
+            lock_req_list->lck_req->lcl_resource_id,$

src/lck/lcknd/glnd_client.c:358: ERROR: code indent should use tabs 
where possible
+            lock_req_list->lck_req->lock_info.handleId,$

src/lck/lcknd/glnd_client.c:358: WARNING: please, no spaces at the start 
of a line
+            lock_req_list->lck_req->lock_info.handleId,$

src/lck/lcknd/glnd_client.c:359: ERROR: code indent should use tabs 
where possible
+            lock_req_list->lck_req->lock_info.lockid,$

src/lck/lcknd/glnd_client.c:359: WARNING: please, no spaces at the start 
of a line
+            lock_req_list->lck_req->lock_info.lockid,$

src/lck/lcknd/glnd_client.c:360: ERROR: code indent should use tabs 
where possible
+            lock_req_list->lck_req->lock_info.lock_type,$

src/lck/lcknd/glnd_client.c:360: WARNING: please, no spaces at the start 
of a line
+            lock_req_list->lck_req->lock_info.lock_type,$

src/lck/lcknd/glnd_client.c:361: ERROR: code indent should use tabs 
where possible
+            lock_req_list->lck_req->lock_info.lockFlags,$

src/lck/lcknd/glnd_client.c:361: WARNING: please, no spaces at the start 
of a line
+            lock_req_list->lck_req->lock_info.lockFlags,$

src/lck/lcknd/glnd_client.c:362: ERROR: code indent should use tabs 
where possible
+            0, 0, 0, 0, lock_req_list->lck_req->lock_info.lcl_lockid, 0);$

src/lck/lcknd/glnd_client.c:362: WARNING: please, no spaces at the start 
of a line
+            0, 0, 0, 0, lock_req_list->lck_req->lock_info.lcl_lockid, 0);$

src/lck/lcknd/glnd_client.c:364: ERROR: code indent should use tabs 
where possible
+          glnd_evt.info.node_lck_info.glnd_mds_dest = 
glnd_cb->glnd_mdest_id;$

src/lck/lcknd/glnd_client.c:364: WARNING: please, no spaces at the start 
of a line
+          glnd_evt.info.node_lck_info.glnd_mds_dest = 
glnd_cb->glnd_mdest_id;$

src/lck/lcknd/glnd_client.c:366: WARNING: 'PROGESS' may be misspelled - 
perhaps 'PROGRESS'?
+          if (res_info->status != GLND_RESOURCE_ELECTION_IN_PROGESS) {

src/lck/lcknd/glnd_client.c:366: ERROR: code indent should use tabs 
where possible
+          if (res_info->status != GLND_RESOURCE_ELECTION_IN_PROGESS) {$

src/lck/lcknd/glnd_client.c:366: WARNING: please, no spaces at the start 
of a line
+          if (res_info->status != GLND_RESOURCE_ELECTION_IN_PROGESS) {$

src/lck/lcknd/glnd_client.c:366: WARNING: suspect code indent for 
conditional statements (10, 12)
+          if (res_info->status != GLND_RESOURCE_ELECTION_IN_PROGESS) {
+            glnd_mds_msg_send_glnd(glnd_cb,

src/lck/lcknd/glnd_client.c:367: ERROR: code indent should use tabs 
where possible
+            glnd_mds_msg_send_glnd(glnd_cb,$

src/lck/lcknd/glnd_client.c:367: WARNING: please, no spaces at the start 
of a line
+            glnd_mds_msg_send_glnd(glnd_cb,$

src/lck/lcknd/glnd_client.c:368: ERROR: code indent should use tabs 
where possible
+                                   &glnd_evt,$

src/lck/lcknd/glnd_client.c:368: WARNING: please, no spaces at the start 
of a line
+                                   &glnd_evt,$

src/lck/lcknd/glnd_client.c:369: ERROR: code indent should use tabs 
where possible
+ res_info->master_mds_dest);$

src/lck/lcknd/glnd_client.c:369: WARNING: please, no spaces at the start 
of a line
+ res_info->master_mds_dest);$

src/lck/lcknd/glnd_client.c:370: ERROR: code indent should use tabs 
where possible
+          } else {$

src/lck/lcknd/glnd_client.c:370: WARNING: please, no spaces at the start 
of a line
+          } else {$

src/lck/lcknd/glnd_client.c:371: ERROR: code indent should use tabs 
where possible
+            glnd_evt_backup_queue_add(glnd_cb, &glnd_evt);$

src/lck/lcknd/glnd_client.c:371: WARNING: please, no spaces at the start 
of a line
+            glnd_evt_backup_queue_add(glnd_cb, &glnd_evt);$

src/lck/lcknd/glnd_client.c:372: ERROR: code indent should use tabs 
where possible
+          }$

src/lck/lcknd/glnd_client.c:372: WARNING: please, no spaces at the start 
of a line
+          }$

src/lck/lcknd/glnd_client.c:373: ERROR: code indent should use tabs 
where possible
+        }$

src/lck/lcknd/glnd_client.c:373: WARNING: please, no spaces at the start 
of a line
+        }$

src/lck/lcknd/glnd_client.c:378: WARNING: Statements should start on a 
tabstop
+             if ((lock_req_list->lck_req->lock_info.lockFlags &

src/lck/lcknd/glnd_client.c:378: WARNING: suspect code indent for 
conditional statements (25, 26)
+             if ((lock_req_list->lck_req->lock_info.lockFlags &
[...]
+              local_orphan_lock = true;

src/lck/lcknd/glnd_evt.c:1211: WARNING: suspect code indent for 
conditional statements (16, 6)
          if (lck_list_info->lock_info.lockStatus !=
[...]
+      lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;

src/lck/lcknd/glnd_evt.c:1213: WARNING: line over 80 characters
+            lck_list_info->lock_info.lockStatus != SA_LCK_LOCK_ORPHANED) {

src/lck/lcknd/glnd_evt.c:1214: WARNING: please, no spaces at the start 
of a line
+      lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;$

src/lck/lcknd/glnd_evt.c:1218: WARNING: please, no spaces at the start 
of a line
+    }$

src/lck/lcknd/glnd_evt.c:1739: WARNING: please, no spaces at the start 
of a line
+    goto end;$

src/lck/lcknd/glnd_evt.c:1771: WARNING: suspect code indent for 
conditional statements (24, 8)
              if (lck_list_info->lock_info.lockStatus !=
[...]
+        lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;

src/lck/lcknd/glnd_evt.c:1775: ERROR: code indent should use tabs where 
possible
+        lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;$

src/lck/lcknd/glnd_evt.c:1775: WARNING: please, no spaces at the start 
of a line
+        lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;$

src/lck/lcknd/glnd_evt.c:1779: WARNING: please, no spaces at the start 
of a line
+      }$

src/lck/lcknd/glnd_evt.c:3771: WARNING: please, no spaces at the start 
of a line
+    if (lock_list_info->lock_rsp_not_sent) {$

src/lck/lcknd/glnd_evt.c:3771: WARNING: suspect code indent for 
conditional statements (4, 6)
+    if (lock_list_info->lock_rsp_not_sent) {
[...]
+      glnd_resource_master_grant_lock_send_notification(glnd_cb,

src/lck/lcknd/glnd_evt.c:3773: WARNING: please, no spaces at the start 
of a line
+      glnd_resource_master_grant_lock_send_notification(glnd_cb,$

src/lck/lcknd/glnd_evt.c:3774: ERROR: code indent should use tabs where 
possible
+ res_node,$

src/lck/lcknd/glnd_evt.c:3774: WARNING: please, no spaces at the start 
of a line
+ res_node,$

src/lck/lcknd/glnd_evt.c:3775: ERROR: code indent should use tabs where 
possible
+ lock_list_info);$

src/lck/lcknd/glnd_evt.c:3775: WARNING: please, no spaces at the start 
of a line
+ lock_list_info);$

src/lck/lcknd/glnd_evt.c:3776: WARNING: please, no spaces at the start 
of a line
+    }$

src/lck/lcknd/glnd_evt.c:3777: WARNING: please, no spaces at the start 
of a line
+    else {$

src/lck/lcknd/glnd_evt.c:3777: ERROR: else should follow close brace '}'
+    }
+    else {

src/lck/lcknd/glnd_evt.c:3781: WARNING: please, no spaces at the start 
of a line
+    }$

src/lck/lcknd/glnd_res.c:1080: WARNING: please, no spaces at the start 
of a line
+    SaLckResourceIdT lcl_resource_id, SaLckLockIdT lcl_lock_id,$

src/lck/lcknd/glnd_res.c:1081: WARNING: please, no spaces at the start 
of a line
+    GLSV_GLND_EVT *inEvt)$

src/lck/lcknd/glnd_res.c:1107: WARNING: please, no spaces at the start 
of a line
+  lck_list_info->glnd_res_lock_mds_ctxt = inEvt->mds_context;$

src/lck/lcknd/glnd_res.c:1220: WARNING: please, no spaces at the start 
of a line
+      glnd_restart_res_lock_list_ckpt_overwrite(cb, lock_list_info,$

src/lck/lcknd/glnd_res.c:1221: WARNING: line over 80 characters
+                                  res_info->resource_id, 0, 2);

src/lck/lcknd/glnd_res.c:1581: WARNING: suspect code indent for 
conditional statements (16, 6)
+        if (glnd_mds_msg_send_glnd(glnd_cb,
[...]
+      TRACE("failed to send lock response to glnd: holding");

src/lck/lcknd/glnd_res.c:1582: ERROR: code indent should use tabs where 
possible
+                               &glnd_evt,$

src/lck/lcknd/glnd_res.c:1582: WARNING: please, no spaces at the start 
of a line
+                               &glnd_evt,$

src/lck/lcknd/glnd_res.c:1583: WARNING: line over 80 characters
+ lock_list_node->req_mdest_id)) {

src/lck/lcknd/glnd_res.c:1583: ERROR: code indent should use tabs where 
possible
+^I^I^I^I                       lock_list_node->req_mdest_id)) {$

src/lck/lcknd/glnd_res.c:1586: WARNING: please, no spaces at the start 
of a line
+      TRACE("failed to send lock response to glnd: holding");$

src/lck/lcknd/glnd_res.c:1587: WARNING: please, no spaces at the start 
of a line
+      lock_list_node->lock_rsp_not_sent = true;$

src/lck/lcknd/glnd_res.c:1588: WARNING: please, no spaces at the start 
of a line
+    } else {$

src/lck/lcknd/glnd_res.c:1589: WARNING: please, no spaces at the start 
of a line
+      lock_list_node->lock_rsp_not_sent = false;$

src/lck/lcknd/glnd_res.c:1590: WARNING: please, no spaces at the start 
of a line
+    }$

src/lck/lcknd/glnd_res.c:1592: WARNING: please, no spaces at the start 
of a line
+    glnd_restart_res_lock_list_ckpt_overwrite(glnd_cb,$

src/lck/lcknd/glnd_res.c:1593: ERROR: code indent should use tabs where 
possible
+                                              lock_list_node,$

src/lck/lcknd/glnd_res.c:1593: WARNING: please, no spaces at the start 
of a line
+                                              lock_list_node,$

src/lck/lcknd/glnd_res.c:1594: ERROR: code indent should use tabs where 
possible
+ res_info->resource_id,$

src/lck/lcknd/glnd_res.c:1594: WARNING: please, no spaces at the start 
of a line
+ res_info->resource_id,$

src/lck/lcknd/glnd_res.c:1595: ERROR: code indent should use tabs where 
possible
+                                              0,$

src/lck/lcknd/glnd_res.c:1595: WARNING: please, no spaces at the start 
of a line
+                                              0,$

src/lck/lcknd/glnd_res.c:1596: ERROR: code indent should use tabs where 
possible
+                                              2);$

src/lck/lcknd/glnd_res.c:1596: WARNING: please, no spaces at the start 
of a line
+                                              2);$

src/lck/lcknd/glnd_restart.c:250: WARNING: please, no spaces at the 
start of a line
+    lck_list_info->glnd_res_lock_mds_ctxt =$

src/lck/lcknd/glnd_restart.c:251: ERROR: code indent should use tabs 
where possible
+        restart_res_lock_list_info->glnd_res_lock_mds_ctxt;$

src/lck/lcknd/glnd_restart.c:251: WARNING: please, no spaces at the 
start of a line
+        restart_res_lock_list_info->glnd_res_lock_mds_ctxt;$

src/lck/lcknd/glnd_restart.c:361: ERROR: code indent should use tabs 
where possible
+        node_id == m_NCS_NODE_ID_FROM_MDS_DEST(glnd_cb->glnd_mdest_id)) {$

src/lck/lcknd/glnd_restart.c:361: WARNING: please, no spaces at the 
start of a line
+        node_id == m_NCS_NODE_ID_FROM_MDS_DEST(glnd_cb->glnd_mdest_id)) {$

total: 36 errors, 71 warnings, 243 lines checked

regards,

Anders Widell


On 04/18/2017 05:01 PM, Alex Jones wrote:
> Calls to saLckResourceLock can deadlock if glnd (master or not) is restarted.
>
> The glnd restart code does not correctly store information in the checkpoint.
> So, when glnd restarts it populates its internal data structures with 
> inaccurate
> information.
>
> Fix the above problems.
> ---
>   src/lck/lcknd/glnd_cb.h      |  3 +-
>   src/lck/lcknd/glnd_ckpt.c    |  4 +++
>   src/lck/lcknd/glnd_client.c  | 74 
> +++++++++++++++++++++++++++++---------------
>   src/lck/lcknd/glnd_evt.c     | 24 ++++++++++----
>   src/lck/lcknd/glnd_res.c     | 27 +++++++++++++---
>   src/lck/lcknd/glnd_res.h     |  7 ++++-
>   src/lck/lcknd/glnd_restart.c |  7 ++++-
>   7 files changed, 108 insertions(+), 38 deletions(-)
>
> diff --git a/src/lck/lcknd/glnd_cb.h b/src/lck/lcknd/glnd_cb.h
> index 2c96e72..68f7d4c 100644
> --- a/src/lck/lcknd/glnd_cb.h
> +++ b/src/lck/lcknd/glnd_cb.h
> @@ -53,8 +53,8 @@ typedef struct glnd_res_lock_list_info_tag {
>     MDS_DEST req_mdest_id; /* requesting node info */
>     SaLckResourceIdT lcl_resource_id;
>     MDS_SYNC_SND_CTXT glnd_res_lock_mds_ctxt; /* to store the mds context */
> +  bool lock_rsp_not_sent;
>     bool unlock_req_sent;                     /* To take care of unlock 
> requests that are
> -                                                       GLSV_CALL_TYPE        
>   unlock_call_type;
>                                                          lost during 
> mastership transistion */
>     GLSV_CALL_TYPE unlock_call_type;
>     uint32_t non_master_status;
> @@ -122,6 +122,7 @@ typedef struct glnd_restart_res_lock_list_info_tag {
>     time_t time_stamp;
>     MDS_DEST req_mdest_id;                    /* requesting node info */
>     MDS_SYNC_SND_CTXT glnd_res_lock_mds_ctxt; /* to store the mds context */
> +  bool lock_rsp_not_sent;
>     bool unlock_req_sent; /* To take care of unlock requests */
>     GLSV_CALL_TYPE unlock_call_type;
>     uint32_t non_master_status;
> diff --git a/src/lck/lcknd/glnd_ckpt.c b/src/lck/lcknd/glnd_ckpt.c
> index 5e34a0f..e14be83 100644
> --- a/src/lck/lcknd/glnd_ckpt.c
> +++ b/src/lck/lcknd/glnd_ckpt.c
> @@ -268,6 +268,8 @@ uint32_t glnd_restart_res_lock_list_ckpt_write(
>       restart_res_lock_list_info.req_mdest_id = res_lock_list->req_mdest_id;
>       restart_res_lock_list_info.glnd_res_lock_mds_ctxt =
>           res_lock_list->glnd_res_lock_mds_ctxt;
> +     restart_res_lock_list_info.lock_rsp_not_sent =
> +         res_lock_list->lock_rsp_not_sent;
>       restart_res_lock_list_info.unlock_req_sent =
>           res_lock_list->unlock_req_sent;
>       restart_res_lock_list_info.unlock_call_type =
> @@ -342,6 +344,8 @@ uint32_t glnd_restart_res_lock_list_ckpt_overwrite(
>       restart_res_lock_list_info.req_mdest_id = res_lock_list->req_mdest_id;
>       restart_res_lock_list_info.glnd_res_lock_mds_ctxt =
>           res_lock_list->glnd_res_lock_mds_ctxt;
> +     restart_res_lock_list_info.lock_rsp_not_sent =
> +         res_lock_list->lock_rsp_not_sent;
>       restart_res_lock_list_info.unlock_req_sent =
>           res_lock_list->unlock_req_sent;
>       restart_res_lock_list_info.to_which_list = to_which_list;
> diff --git a/src/lck/lcknd/glnd_client.c b/src/lck/lcknd/glnd_client.c
> index 86659c0..a2314f4 100644
> --- a/src/lck/lcknd/glnd_client.c
> +++ b/src/lck/lcknd/glnd_client.c
> @@ -328,32 +328,56 @@ uint32_t glnd_client_node_resource_del(GLND_CB *glnd_cb,
>                    lock_req_list != NULL;) {
>                       if (resource_list->rsc_info->status ==
>                           GLND_RESOURCE_ACTIVE_NON_MASTER) {
> -                             /* send request to orphan the lock */
> -                             m_GLND_RESOURCE_NODE_LCK_INFO_FILL(
> -                                 glnd_evt, GLSV_GLND_EVT_LCK_REQ_ORPHAN,
> -                                 resource_list->rsc_info->resource_id,
> -                                 lock_req_list->lck_req->lcl_resource_id,
> -                                 lock_req_list->lck_req->lock_info.handleId,
> -                                 lock_req_list->lck_req->lock_info.lockid,
> -                                 lock_req_list->lck_req->lock_info.lock_type,
> -                                 lock_req_list->lck_req->lock_info.lockFlags,
> -                                 0, 0, 0, 0,
> -                                 lock_req_list->lck_req->lock_info
> -                                     .lcl_lockid,
> -                                 0);
> -                             glnd_evt.info.node_lck_info.glnd_mds_dest =
> -                                 glnd_cb->glnd_mdest_id;
> -                             glnd_mds_msg_send_glnd(
> -                                 glnd_cb, &glnd_evt,
> -                                 res_info->master_mds_dest);
> +        if (lock_req_list->lck_req->lock_info.lockStatus ==
> +              SA_LCK_LOCK_GRANTED) {
> +          TRACE("lock granted: sending orphan request");
> +                               /* send request to orphan the lock */
> +                               m_GLND_RESOURCE_NODE_LCK_INFO_FILL(
> +                                   glnd_evt, GLSV_GLND_EVT_LCK_REQ_ORPHAN,
> +                                   resource_list->rsc_info->resource_id,
> +                                   lock_req_list->lck_req->lcl_resource_id,
> +                                   
> lock_req_list->lck_req->lock_info.handleId,
> +                                   lock_req_list->lck_req->lock_info.lockid,
> +                                   
> lock_req_list->lck_req->lock_info.lock_type,
> +                                   
> lock_req_list->lck_req->lock_info.lockFlags,
> +                                   0, 0, 0, 0,
> +                                   
> lock_req_list->lck_req->lock_info.lcl_lockid,
> +                                   0);
> +                               glnd_evt.info.node_lck_info.glnd_mds_dest =
> +                                   glnd_cb->glnd_mdest_id;
> +                               glnd_mds_msg_send_glnd(
> +                                   glnd_cb, &glnd_evt,
> +                                   res_info->master_mds_dest);
> +        } else {
> +          TRACE("lock still outstanding: sending cancel request");
> +          m_GLND_RESOURCE_NODE_LCK_INFO_FILL(
> +            glnd_evt,
> +            GLSV_GLND_EVT_LCK_REQ_CANCEL,
> +            resource_list->rsc_info->resource_id,
> +            lock_req_list->lck_req->lcl_resource_id,
> +            lock_req_list->lck_req->lock_info.handleId,
> +            lock_req_list->lck_req->lock_info.lockid,
> +            lock_req_list->lck_req->lock_info.lock_type,
> +            lock_req_list->lck_req->lock_info.lockFlags,
> +            0, 0, 0, 0, lock_req_list->lck_req->lock_info.lcl_lockid, 0);
> +
> +          glnd_evt.info.node_lck_info.glnd_mds_dest = glnd_cb->glnd_mdest_id;
> +
> +          if (res_info->status != GLND_RESOURCE_ELECTION_IN_PROGESS) {
> +            glnd_mds_msg_send_glnd(glnd_cb,
> +                                   &glnd_evt,
> +                                   res_info->master_mds_dest);
> +          } else {
> +            glnd_evt_backup_queue_add(glnd_cb, &glnd_evt);
> +          }
> +        }
>                       } else {
> -                             /* unset any orphan count */
> -                             lock_type =
> -                                 lock_req_list->lck_req->lock_info.lock_type;
> -                             if ((lock_req_list->lck_req->lock_info
> -                                      .lockFlags &
> -                                  SA_LCK_LOCK_ORPHAN) == SA_LCK_LOCK_ORPHAN)
> -                                     local_orphan_lock = true;
> +                      /* unset any orphan count */
> +                      lock_type =
> +                          lock_req_list->lck_req->lock_info.lock_type;
> +                      if ((lock_req_list->lck_req->lock_info.lockFlags &
> +                           SA_LCK_LOCK_ORPHAN) == SA_LCK_LOCK_ORPHAN)
> +                       local_orphan_lock = true;
>                       }
>                       del_req_list = lock_req_list;
>                       lock_req_list = lock_req_list->next;
> diff --git a/src/lck/lcknd/glnd_evt.c b/src/lck/lcknd/glnd_evt.c
> index 75351c9..a9e7bef 100644
> --- a/src/lck/lcknd/glnd_evt.c
> +++ b/src/lck/lcknd/glnd_evt.c
> @@ -1210,10 +1210,12 @@ static uint32_t 
> glnd_process_gla_resource_lock(GLND_CB *glnd_cb,
>               /* add this resource lock to the client  */
>               if (lck_list_info->lock_info.lockStatus !=
>                       SA_LCK_LOCK_NOT_QUEUED &&
> -                 lck_list_info->lock_info.lockStatus != SA_LCK_LOCK_ORPHANED)
> +                 lck_list_info->lock_info.lockStatus != 
> SA_LCK_LOCK_ORPHANED) {
> +      lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;
>                       glnd_restart_res_lock_list_ckpt_write(
>                           glnd_cb, lck_list_info,
>                           lck_list_info->res_info->resource_id, 0, 2);
> +    }
>   
>               switch (lck_list_info->lock_info.lockStatus) {
>               case SA_LCK_LOCK_GRANTED:
> @@ -1279,13 +1281,11 @@ static uint32_t 
> glnd_process_gla_resource_lock(GLND_CB *glnd_cb,
>   
>               lck_list_info = glnd_resource_non_master_lock_req(
>                   glnd_cb, res_node, lck_info, rsc_lock_info->lcl_resource_id,
> -                 rsc_lock_info->lcl_lockid);
> +                 rsc_lock_info->lcl_lockid, evt);
>               if (!lck_list_info) {
>                       error = SA_AIS_ERR_NO_RESOURCES;
>                       goto err;
>               }
> -             /* set the mds context info */
> -             lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;
>   
>               /* add this resource lock to the client  */
>               glnd_client_node_resource_lock_req_add(client_info, res_node,
> @@ -1735,6 +1735,8 @@ static uint32_t glnd_process_glnd_lck_req(GLND_CB 
> *glnd_cb, GLSV_GLND_EVT *evt)
>               /* send the response evt to GLND */
>               glnd_mds_msg_send_glnd(glnd_cb, &glnd_evt,
>                                      lck_req->glnd_mds_dest);
> +
> +    goto end;
>       }
>   
>       if (res_node->status == GLND_RESOURCE_NOT_INITIALISED) {
> @@ -1769,10 +1771,12 @@ static uint32_t glnd_process_glnd_lck_req(GLND_CB 
> *glnd_cb, GLSV_GLND_EVT *evt)
>                       if (lck_list_info->lock_info.lockStatus !=
>                               SA_LCK_LOCK_NOT_QUEUED &&
>                           lck_list_info->lock_info.lockStatus !=
> -                             SA_LCK_LOCK_ORPHANED)
> +                             SA_LCK_LOCK_ORPHANED) {
> +        lck_list_info->glnd_res_lock_mds_ctxt = evt->mds_context;
>                               glnd_restart_res_lock_list_ckpt_write(
>                                   glnd_cb, lck_list_info,
>                                   lck_list_info->res_info->resource_id, 0, 2);
> +      }
>   
>                       switch (lck_list_info->lock_info.lockStatus) {
>                       case SA_LCK_LOCK_GRANTED:
> @@ -3764,9 +3768,17 @@ static uint32_t glnd_process_non_master_lck_req_status(
>               else
>                       lock_list_info->non_master_status = node_status->status;
>   
> -             glnd_restart_res_lock_list_ckpt_overwrite(
> +    if (lock_list_info->lock_rsp_not_sent) {
> +      /* send the lck response that failed earlier */
> +      glnd_resource_master_grant_lock_send_notification(glnd_cb,
> +                                                        res_node,
> +                                                        lock_list_info);
> +    }
> +    else {
> +               glnd_restart_res_lock_list_ckpt_overwrite(
>                   glnd_cb, lock_list_info,
>                   lock_list_info->res_info->resource_id, 0, 2);
> +    }
>       }
>       return NCSCC_RC_SUCCESS;
>   }
> diff --git a/src/lck/lcknd/glnd_res.c b/src/lck/lcknd/glnd_res.c
> index 4e4f47a..9c80e0f 100644
> --- a/src/lck/lcknd/glnd_res.c
> +++ b/src/lck/lcknd/glnd_res.c
> @@ -1077,7 +1077,8 @@ further processing.
>   
> *****************************************************************************/
>   GLND_RES_LOCK_LIST_INFO *glnd_resource_non_master_lock_req(
>       GLND_CB *cb, GLND_RESOURCE_INFO *res_info, GLSV_LOCK_REQ_INFO lock_info,
> -    SaLckResourceIdT lcl_resource_id, SaLckLockIdT lcl_lock_id)
> +    SaLckResourceIdT lcl_resource_id, SaLckLockIdT lcl_lock_id,
> +    GLSV_GLND_EVT *inEvt)
>   {
>       GLSV_GLND_EVT evt;
>       GLND_RES_LOCK_LIST_INFO *lck_list_info;
> @@ -1103,6 +1104,7 @@ GLND_RES_LOCK_LIST_INFO 
> *glnd_resource_non_master_lock_req(
>                            (NCSCONTEXT)lck_list_info);
>       lck_list_info->lock_info.lockid =
>           m_ASSIGN_LCK_HANDLE_ID(NCS_PTR_TO_UNS64_CAST(lck_list_info));
> +  lck_list_info->glnd_res_lock_mds_ctxt = inEvt->mds_context;
>   
>       /* add it to the list */
>       lck_list_info->next = res_info->lcl_lck_req_info;
> @@ -1214,6 +1216,9 @@ GLND_RES_LOCK_LIST_INFO 
> *glnd_resource_master_unlock_req(
>                       /* set the value of the lock status */
>                       lock_list_info->lock_info.lockStatus =
>                           GLSV_LOCK_STATUS_RELEASED;
> +
> +      glnd_restart_res_lock_list_ckpt_overwrite(cb, lock_list_info,
> +                                                           
> res_info->resource_id, 0, 2);
>               }
>       }
>   done:
> @@ -1507,7 +1512,7 @@ void glnd_resource_master_lock_purge_req(GLND_CB 
> *glnd_cb,
>   
>     NOTES         : None
>   
> *****************************************************************************/
> -static void glnd_resource_master_grant_lock_send_notification(
> +void glnd_resource_master_grant_lock_send_notification(
>       GLND_CB *glnd_cb, GLND_RESOURCE_INFO *res_info,
>       GLND_RES_LOCK_LIST_INFO *lock_list_node)
>   {
> @@ -1573,8 +1578,22 @@ static void 
> glnd_resource_master_grant_lock_send_notification(
>                   glnd_cb->glnd_mdest_id;
>   
>               /* send the response evt to GLND */
> -             glnd_mds_msg_send_glnd(glnd_cb, &glnd_evt,
> -                                    lock_list_node->req_mdest_id);
> +             if (glnd_mds_msg_send_glnd(glnd_cb,
> +                               &glnd_evt,
> +                                                    
> lock_list_node->req_mdest_id)) {
> +
> +      /* maybe lcknd is temporarily down? release the lock */
> +      TRACE("failed to send lock response to glnd: holding");
> +      lock_list_node->lock_rsp_not_sent = true;
> +    } else {
> +      lock_list_node->lock_rsp_not_sent = false;
> +    }
> +
> +    glnd_restart_res_lock_list_ckpt_overwrite(glnd_cb,
> +                                              lock_list_node,
> +                                              res_info->resource_id,
> +                                              0,
> +                                              2);
>       }
>   }
>   
> diff --git a/src/lck/lcknd/glnd_res.h b/src/lck/lcknd/glnd_res.h
> index 1fbd024..2f5d79d 100644
> --- a/src/lck/lcknd/glnd_res.h
> +++ b/src/lck/lcknd/glnd_res.h
> @@ -86,7 +86,7 @@ GLND_RES_LOCK_LIST_INFO 
> *glnd_resource_master_process_lock_req(
>   
>   GLND_RES_LOCK_LIST_INFO *glnd_resource_non_master_lock_req(
>       GLND_CB *cb, GLND_RESOURCE_INFO *res_info, GLSV_LOCK_REQ_INFO lock_info,
> -    SaLckResourceIdT lcl_resource_id, SaLckLockIdT lockid);
> +    SaLckResourceIdT lcl_resource_id, SaLckLockIdT lockid, GLSV_GLND_EVT 
> *evt);
>   
>   GLND_RES_LOCK_LIST_INFO *glnd_resource_master_unlock_req(
>       GLND_CB *cb, GLND_RESOURCE_INFO *res_info, GLSV_LOCK_REQ_INFO lock_info,
> @@ -125,4 +125,9 @@ bool glnd_deadlock_detect(GLND_CB *glnd_cb, 
> GLND_CLIENT_INFO *client_info,
>   void glnd_resource_check_lost_unlock_requests(GLND_CB *glnd_cb,
>                                                 GLND_RESOURCE_INFO *res_node);
>   
> +void glnd_resource_master_grant_lock_send_notification(
> +    GLND_CB *,
> +    GLND_RESOURCE_INFO *,
> +    GLND_RES_LOCK_LIST_INFO *);
> +
>   #endif  // LCK_LCKND_GLND_RES_H_
> diff --git a/src/lck/lcknd/glnd_restart.c b/src/lck/lcknd/glnd_restart.c
> index b567997..41b0747 100644
> --- a/src/lck/lcknd/glnd_restart.c
> +++ b/src/lck/lcknd/glnd_restart.c
> @@ -247,10 +247,14 @@ static uint32_t 
> glnd_restart_add_res_lock_to_resource_tree(
>                       lck_list_info->req_mdest_id =
>                           restart_res_lock_list_info->req_mdest_id;
>               lck_list_info->res_info = res_info;
> +    lck_list_info->glnd_res_lock_mds_ctxt =
> +        restart_res_lock_list_info->glnd_res_lock_mds_ctxt;
>               lck_list_info->lcl_resource_id =
>                   restart_res_lock_list_info->lcl_resource_id;
>               lck_list_info->unlock_call_type =
>                   restart_res_lock_list_info->unlock_call_type;
> +             lck_list_info->lock_rsp_not_sent =
> +                 restart_res_lock_list_info->lock_rsp_not_sent;
>               lck_list_info->unlock_req_sent =
>                   restart_res_lock_list_info->unlock_req_sent;
>               lck_list_info->non_master_status =
> @@ -353,7 +357,8 @@ static uint32_t 
> glnd_restart_add_res_lock_to_resource_tree(
>                       }
>               }
>               /* Add lock_list_info to client_tree */
> -             if (client_info != NULL) {
> +             if (client_info != NULL &&
> +        node_id == m_NCS_NODE_ID_FROM_MDS_DEST(glnd_cb->glnd_mdest_id)) {
>                       glnd_client_node_resource_lock_req_add(
>                           client_info, res_info, lck_list_info);
>               }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to