Hi Hoang,

We are some how able to simulated your test case.
Following are the detailed steps how we reproduced  ,
this test is generating same core dumb as below.

But the provided patch resolved the issue,  can you please test your self
provide your observations , if the test is different please update .

Attached :    035_cpsv_2202_V2_debug.patch  & 036_cpsv_2207_debug.patch

Test application  : cpsv_shm_2202.c

==================================================================

1)  /etc/init.d/opensafd stop

2)  Change the defaults /dev/shm  size to 3MB

      # vi /etc/fstab  tmpfs

     And add following line

` tmpfs /dev/shm tmpfs defaults,size=3m 0 0`

3)  Remount /dev/shm

    #mount -o remount /dev/shm

4)  Check /dev/shm reflected with new value

    # df -k /dev/shm/

    Filesystem     1K-blocks  Used Available Use% Mounted on
    tmpfs               3072     0      3072   0% /dev/shm


5) set  ulimit to   unlimited

    #ulimit -c  unlimited

6) #/etc/init.d/opensafd start


7)  Compile & run attached test application ( cpsv_shm_2202.c )

    #gcc cpsv_shm_2202.c -o ckpt_shm -lSaCkpt

    # ./ckpt_shm

8)  Once /dev/shm/ reach 100% Use you will see core dump  same as yours

    # df -k /dev/shm/


7) Then we applied the patch test again with `cpsv_2202_V2_debug.patch` & `cpsv_2207_debug.patch`) no core dump

   saCkptSectionCreate 1  returned 18. ( no core dump )
==============================================================

-AVM



On 11/30/2016 11:37 AM, Vo Minh Hoang wrote:
Dear Mahesh,

Unfortunately, I have just receive information that the same core dump still
occur after applying patch.

Here is dump information in short, please tell me if I can do anything in
support:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007fe314aa0109 in __memcpy_sse2_unaligned () from /lib64/libc.so.6
Missing separate debuginfos, use: zypper install
opensaf-ckpt-nodedirector-debuginfo-5.1.0-9999.0.4997518.sle12.x86_64
(gdb) where
#0  0x00007fe314aa0109 in __memcpy_sse2_unaligned () from /lib64/libc.so.6
#1  0x00007fe315c26082 in memcpy (__len=<optimized out>, __src=<optimized
out>, __dest=<optimized out>)
     at /usr/include/x86_64-linux-gnu/bits/string3.h:51
#2  ncs_os_posix_shm (req=req@entry=0x7ffecb80adb0) at os_defs.c:874
#3  0x0000000000415a80 in cpnd_sec_hdr_update (cb=cb@entry=0x9e57f0,
sec_info=sec_info@entry=0xb8ff60,
     cp_node=cp_node@entry=0xb8e8c0) at cpnd_proc.c:1880
#4  0x0000000000406047 in cpnd_ckpt_sec_add (cb=cb@entry=0x9e57f0,
cp_node=0xb8e8c0, id=0x7fe30c002390,
     exp_time=1480480471343486000, gen_flag=gen_flag@entry=0) at
cpnd_db.c:457
#5  0x000000000040d17c in cpnd_evt_proc_ckpt_sect_create
(cb=cb@entry=0x9e57f0,
     evt=evt@entry=0x7fe30c01e1d0, sinfo=sinfo@entry=0x7fe30c01e828) at
cpnd_evt.c:2267
#6  0x000000000040eaf4 in cpnd_process_evt (evt=0x7fe30c01e1c0) at
cpnd_evt.c:227
#7  0x00000000004106cd in cpnd_main_process (cb=cb@entry=0x9e57f0) at
cpnd_init.c:579
#8  0x0000000000405383 in main (argc=<optimized out>, argv=<optimized out>)
at cpnd_main.c:79

Sincerely,
Hoang

-----Original Message-----
From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com]
Sent: Tuesday, November 29, 2016 5:37 PM
To: hoang.m...@dektech.com.au; ramesh.bet...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 0 of 3] Review Request for leap : now leap library ensure
shm availability before writing [#2202]

Summary:leap : now leap library ensure shm availability before writing
[#2202] Review request for Trac Ticket(s): #2202 Peer Reviewer(s): Hoang /
Ramesh Pull request to: <<LIST THE PERSON WITH PUSH ACCESS HERE>> Affected
branch(es): <<LIST ALL AFFECTED BRANCH(ES)>> Development branch: <<IF ANY
GIVE THE REPO URL>>

--------------------------------
Impacted area       Impact y/n
--------------------------------
  Docs                    n
  Build system            n
  RPM/packaging           n
  Configuration files     n
  Startup scripts         n
  SAF services            n
  OpenSAF services        y
  Core libraries          y
  Samples                 n
  Tests                   n
  Other                   n


Comments (indicate scope for each "y" above):
---------------------------------------------

changeset 7b53e1b3754622fe90c22c801adeb7df6d808c30
Author: A V Mahesh <mahesh.va...@oracle.com>
Date:   Tue, 29 Nov 2016 15:59:21 +0530

        leap : now leap library ensure shm availability before writing
[#2202]
  Issue :

        If OSAF_CKPT_SHM_ALLOC_GUARANTEE is NOT set and SHM is 100% used in
system
        , pnd Segmentation fault (core dumped) at LEAP memcpy().

Fix :

        Now LEAP library ensures shm free space before writing This may
degrade
        some performance of cpsv , if OSAF_CKPT_SHM_ALLOC_GUARANTEE is set,
cpsv
        give natural performance.

changeset 083114e13c00c9c4267ffe65a86c1a97a951b876
Author: A V Mahesh <mahesh.va...@oracle.com>
Date:   Tue, 29 Nov 2016 16:02:06 +0530

        cpsv : update cpsv error handing based on leap changes [#2202]

changeset fb509abb1d1583315f585663fd75bf73e35211a6
Author: A V Mahesh <mahesh.va...@oracle.com>
Date:   Tue, 29 Nov 2016 16:02:58 +0530

        mqsv : update mqsv error handing based on leap changes [#2202]


Complete diffstat:
------------------
  osaf/libs/common/cpsv/include/cpnd_cb.h   |   4 ++--
  osaf/libs/common/cpsv/include/cpnd_init.h |   8 ++++----
  osaf/libs/common/cpsv/include/cpnd_sec.h  |   2 +-
  osaf/libs/core/include/ncs_osprm.h        |   2 +-
  osaf/libs/core/leap/os_defs.c             |  20 ++++++++++++++++++--
  osaf/services/saf/cpsv/cpnd/cpnd_db.c     |  12 ++++++------
  osaf/services/saf/cpsv/cpnd/cpnd_evt.c    |  82
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
------
  osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  31
++++++++++++++++++-------------
  osaf/services/saf/cpsv/cpnd/cpnd_res.c    |  24 ++++++++----------------
  osaf/services/saf/cpsv/cpnd/cpnd_sec.cc   |  12 ++++++------
  osaf/services/saf/glsv/glnd/glnd_shm.c    |   2 +-
  osaf/services/saf/mqsv/mqnd/mqnd_shm.c    |   2 +-
  12 files changed, 123 insertions(+), 78 deletions(-)


Testing Commands:
-----------------
Create situation that node SHM  reaches 100% usage and then perform any CPSV
operation which writes to SHM

Testing, Expected Results:
--------------------------
  <<PASTE COMMAND OUTPUTS / TEST RESULTS>>


Conditions of Submission:
-------------------------
  <<HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC>>


Arch      Built     Started    Linux distro
-------------------------------------------
mips        n          n
mips64      n          n
x86         n          n
x86_64      y          y
powerpc     n          n
powerpc64   n          n


Reviewer Checklist:
-------------------
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
     that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
     (i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
     Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
     like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
     cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
     too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
     Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
     commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
     of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
     comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
     the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
     for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
     do not contain the patch that updates the Doxygen manual.



#include <saCkpt.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>

SaCkptHandleT ckptHandle;
#define DEMO_CKPT_NAME "safCkpt=DemoCkpt,safApp=safCkptService"
int is_active = 0;

void AppCkptOpenCallback(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle, SaAisErrorT error);
void AppCkptSyncCallback(SaInvocationT invocation, SaAisErrorT error);

void AppCkptOpenCallback(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle, SaAisErrorT error)
{
        if (error != SA_AIS_OK) {
                printf("Checkpoint Open Async callback unsuccessful\n");
                return;
        }
        else{
                printf("Checkpoint Open Async callback success and ckpt_hdl 
%llu \n",checkpointHandle);
                return;
        }
}
void AppCkptSyncCallback(SaInvocationT invocation, SaAisErrorT error)
{
        if (error != SA_AIS_OK) {
                printf("Checkpoint Sync Callback unsuccessful\n");
                return;
        }
        else    {
                printf("Checkpoint Sync Callback success\n");
                return;
        }
}


SaVersionT    version = {'B', 2, 2};

void checkpoint_loop(unsigned int thread_number) {
        SaAisErrorT result;
        unsigned char read_buff[10001][100];

        SaCkptCheckpointDescriptorT checkpointStatus;
        memset(&checkpointStatus, '\0', sizeof(SaCkptCheckpointDescriptorT));

        SaUint32T erroneousVectorIndex;
        SaCkptIOVectorElementT writeVector[10001], readVector[10001];
#if 0
        char init_data1[] = 
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
        char init_data2[] = 
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
        char init_data3[] = 
"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC";
        char init_data4[] = 
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD";
        char init_data5[] = 
"EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE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EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
#endif
        char wdata[]      = "POLARIS WIRELESS INC POLARIS WIRELESS INC POLARIS 
WIRELESS INC POLARIS WIRELESS INCPOLARIS WIRELESS";
        SaNameT checkpointName = {0, ""};
        SaCkptCheckpointOpenFlagsT checkpointOpenFlags;

        const SaTimeT timeout = 1000000000;
        SaCkptCheckpointHandleT checkpointHandle;
        int asynchronous = 0 ;

        SaCkptSectionCreationAttributesT sectionCreationAttributes;

        SaUint32T dummy;
        checkpointName.length = snprintf((char*)checkpointName.value,
                        sizeof(checkpointName.value),
                        DEMO_CKPT_NAME);

        if(checkpointName.length >= sizeof(checkpointName.value)) {
                checkpointName.length = sizeof(checkpointName.value) - 1;
        }

        /*UN-comment below if asynchronous is configured */
        asynchronous = 0;       

        const SaCkptCheckpointCreationAttributesT checkpointCreationAttributes 
= {
                //.creationFlags     = SA_CKPT_WR_ALL_REPLICAS,  // 
Non-collocated synchronous
                .creationFlags     = SA_CKPT_CHECKPOINT_COLLOCATED | 
SA_CKPT_WR_ALL_REPLICAS,  //collocated synchronous
                //.creationFlags     = SA_CKPT_CHECKPOINT_COLLOCATED | 
SA_CKPT_WR_ACTIVE_REPLICA_WEAK, //collocated Asynchronous
                .checkpointSize    = 1024 * 10000,
                .retentionDuration = 0, // 60 * SA_TIME_ONE_MINUTE,
                .maxSections       = 10000,
                .maxSectionSize    = 1024,                      
                .maxSectionIdSize  = 64
        };

        checkpointOpenFlags = SA_CKPT_CHECKPOINT_CREATE | 
SA_CKPT_CHECKPOINT_WRITE  | SA_CKPT_CHECKPOINT_READ;
        result = saCkptCheckpointOpen(ckptHandle,
                        &checkpointName,
                        &checkpointCreationAttributes,
                        checkpointOpenFlags,
                        timeout,
                        &checkpointHandle);

        if(result != SA_AIS_OK) {
                if (result == SA_AIS_ERR_EXIST )
                {
                        checkpointOpenFlags =  SA_CKPT_CHECKPOINT_WRITE  | 
SA_CKPT_CHECKPOINT_READ;
                        result = saCkptCheckpointOpen(ckptHandle,
                                        &checkpointName,
                                        &checkpointCreationAttributes,
                                        checkpointOpenFlags,
                                        timeout,
                                        &checkpointHandle);
                        if(result != SA_AIS_OK) {
                                fprintf(stderr,"saCkptCheckpointOpen  returned 
%d.\n", result);
                                exit(0);
                        }
                } else {
                        fprintf(stderr," Create saCkptCheckpointOpen  returned 
%d.\n", result);
                        exit(0);
                }
        }
#if 1
        /* Do this only when u get a active csi assignment and the checkpoint 
is async collocated */
        if (asynchronous == 1 && is_active == 1 ) {
                result = saCkptActiveReplicaSet(checkpointHandle);
                if(result != SA_AIS_OK) {
                        fprintf(stderr,"saCkptActiveReplicaSet  returned 
%d.\n", result);
                        exit(0);
                }
        }
#endif

        printf("saCkptSectionCreate  Waiting to Create Sections  
%s....\n",DEMO_CKPT_NAME);
        printf("saCkptSectionCreate Press <Enter> key to continue...\n");
        getchar();
        char section_id_str[25];
        sectionCreationAttributes.sectionId = (SaCkptSectionIdT*) 
malloc(sizeof(SaCkptSectionIdT));

        int i = 0;
        for ( i = 0 ; i <10000 ; i++) 
        {
                sprintf((unsigned 
char*)section_id_str,"test_section_keyname1_%d",i);
                sectionCreationAttributes.sectionId->id = (unsigned char 
*)section_id_str;
                sectionCreationAttributes.sectionId->idLen = 
strlen(sectionCreationAttributes.sectionId->id);

#if 0
                printf("saCkptSectionCreated : %s idLen: %d 
\n",sectionCreationAttributes.sectionId->id,sectionCreationAttributes.sectionId->idLen);

#endif
                sectionCreationAttributes.expirationTime = (SA_TIME_ONE_MINUTE 
+( time((time_t*)0) * 1000000000));// SA_TIME_ONE_DAY;

                result  = saCkptSectionCreate( checkpointHandle,
                                
&sectionCreationAttributes,init_data1,strlen(init_data1));
                if(result != SA_AIS_OK && result != SA_AIS_ERR_EXIST ) {
                        fprintf(stderr, " saCkptSectionCreate 1  returned 
%d.\n", result);
                        exit(0);
                }
        }

        fprintf(stderr, "\nsaCkptSectionCreate  completed Sucessfull.\n"); 

        memset(&checkpointStatus, '\0', sizeof(SaCkptCheckpointDescriptorT));
        result  = saCkptCheckpointStatusGet( checkpointHandle,
                        &checkpointStatus);


        if(result != SA_AIS_OK) {
                fprintf(stderr,
                                " saCkptCheckpointStatusGet  returned %d.\n", 
result);
                exit(0);

        }
        else {

                fprintf(stderr," checkpointStatus.numberOfSections : %lu\n 
checkpointStatus.memoryUsed :%lu\n ", 
checkpointStatus.numberOfSections,checkpointStatus.memoryUsed);

                fprintf(stderr," 
checkpointCreationAttributes.creationFlags;%lu\n 
checkpointCreationAttributes.checkpointSize;%llu\n 
checkpointCreationAttributes.retentionDuration;%llu\n 
checkpointCreationAttributes.maxSections;%lu \n 
checkpointCreationAttributes.maxSectionSize;%llu \n 
checkpointCreationAttributes.maxSectionIdSize;%llu \n 
================================\n", 
checkpointCreationAttributes.creationFlags, 
checkpointCreationAttributes.checkpointSize, 
checkpointCreationAttributes.retentionDuration,checkpointCreationAttributes.maxSections,
 
checkpointCreationAttributes.maxSectionSize,checkpointCreationAttributes.maxSectionIdSize);
        }

        printf("saCkptCheckpointUnlink / saCkptCheckpointClose / saCkptFinalize 
Press <Enter> key to continue...\n");
        printf("saCkptCheckpoint Press <Enter> key to continue...\n");
        getchar();

        result = saCkptCheckpointClose(checkpointHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptCheckpointClose returned %d.\n", (long 
long int)result);
        }

        result = saCkptFinalize(ckptHandle);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptFinalize  returned %d.\n",(long long 
int)result);
                exit(0);
        }
        printf("PASSED \n");
        exit(0);

}




int main(int argc, char** argv) {
        int           result;
        pthread_t     thread;

        SaCkptCallbacksT callbk;

        callbk.saCkptCheckpointOpenCallback = AppCkptOpenCallback;
        callbk.saCkptCheckpointSynchronizeCallback = AppCkptSyncCallback;
        result = saCkptInitialize(&ckptHandle, &callbk, &version);
        if(result != SA_AIS_OK) {
                fprintf(stderr, "saCkptInitialize failed with code %d.\n", 
result);
        } else {
                checkpoint_loop(1);
        }
        return result;
}




diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h b/osaf/libs/common/cpsv/include/cpnd_cb.h
--- a/osaf/libs/common/cpsv/include/cpnd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
@@ -341,8 +341,8 @@ uint32_t cpnd_amf_register(CPND_CB *cpnd
 uint32_t cpnd_amf_deregister(CPND_CB *cpnd_cb);
 uint32_t cpnd_client_extract_bits(uint32_t bitmap_value, uint32_t *bit_position);
 uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf, CPND_CKPT_NODE **cp_node,
-					    uint32_t ref_cnt, CKPT_INFO *cp_info, bool shm_alloc_guaranteed);
+uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb, NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf, CPND_CKPT_NODE **cp_node,
+					    uint32_t ref_cnt, CKPT_INFO *cp_info);
 int32_t cpnd_find_free_loc(CPND_CB *cb, CPND_TYPE_INFO type);
 uint32_t cpnd_ckpt_write_header(CPND_CB *cb, uint32_t nckpts);
 uint32_t cpnd_cli_info_write_header(CPND_CB *cb, int32_t n_clients);
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -90,7 +90,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C
 uint32_t cpnd_ckpt_remote_cpnd_add(CPND_CKPT_NODE *cp_node, MDS_DEST mds_info);
 uint32_t cpnd_ckpt_remote_cpnd_del(CPND_CKPT_NODE *cp_node, MDS_DEST mds_info);
 int32_t cpnd_ckpt_get_lck_sec_id(CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
+uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
 			  *sec_info, const void *data, uint64_t size, uint64_t offset, uint32_t type);
 uint32_t cpnd_ckpt_sec_read(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
 			 *sec_info, void *data, uint64_t size, uint64_t offset);
@@ -164,7 +164,7 @@ void cpnd_evt_node_getnext(CPND_CB *cb, 
 uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
 uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
 CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT ckpt_name);
-CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
+CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id, SaTimeT exp_time,
 					  uint32_t gen_flag);
 void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
 uint32_t cpnd_ckpt_node_tree_init(CPND_CB *cb);
@@ -176,8 +176,8 @@ void cpnd_client_node_tree_cleanup(CPND_
 void cpnd_client_node_tree_destroy(CPND_CB *cb);
 void cpnd_allrepl_write_evt_node_tree_cleanup(CPND_CB *cb);
 void cpnd_allrepl_write_evt_node_tree_destroy(CPND_CB *cb);
-uint32_t cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE *cp_node);
-uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO *pSecPtr, CPND_CKPT_NODE *cp_node);
+uint32_t cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
 void cpnd_ckpt_node_destroy(CPND_CB *cb, CPND_CKPT_NODE *cp_node);
 uint32_t cpnd_get_slot_sub_slot_id_from_mds_dest(MDS_DEST dest);
 uint32_t cpnd_get_slot_sub_slot_id_from_node_id(NCS_NODE_ID i_node_id);
diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *
 cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *);
+cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *, SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
 cpnd_get_sect_with_id(const CPND_CKPT_NODE *, uint32_t lcl_sec_id);
diff --git a/osaf/libs/core/include/ncs_osprm.h b/osaf/libs/core/include/ncs_osprm.h
--- a/osaf/libs/core/include/ncs_osprm.h
+++ b/osaf/libs/core/include/ncs_osprm.h
@@ -564,7 +564,6 @@ typedef struct ncs_os_posix_shm_req_open
   uint32_t i_flags;
   uint32_t i_map_flags;
   uint64_t i_size;
-  bool ensures_space;
   uint64_t i_offset;
   void *o_addr;
   int32_t o_fd;
@@ -600,6 +599,7 @@ typedef struct ncs_os_posix_shm_req_writ
 
 typedef struct ncs_shm_req_info {
   NCS_OS_POSIX_SHM_REQ_TYPE type;
+  bool ensures_space;
 
   union {
     NCS_OS_POSIX_SHM_REQ_OPEN_INFO open;
diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c
--- a/osaf/libs/core/leap/os_defs.c
+++ b/osaf/libs/core/leap/os_defs.c
@@ -38,6 +38,7 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
+#include <sys/statvfs.h>
 #include <time.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -771,6 +772,7 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S
 	int32_t ret_flag;
 	uint64_t shm_size;
 	char shm_name[PATH_MAX];
+	struct statvfs statsvfs;
 
 	switch (req->type) {
 	case NCS_OS_POSIX_SHM_REQ_OPEN:	/* opens and mmaps */
@@ -792,7 +794,7 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S
 		if (req->info.open.o_fd < 0) {
 			return NCSCC_RC_FAILURE;
 		} else {
-			if (req->info.open.ensures_space == true) {
+			if (req->ensures_space == true) {
 				if (posix_fallocate(req->info.open.o_fd, 0, shm_size) != 0) {
 					LOG_ER("posix_shm:posix_fallocate failed() with errno: %d \n", errno);
 					return NCSCC_RC_FAILURE;
@@ -855,8 +857,25 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S
 		break;
 
 	case NCS_OS_POSIX_SHM_REQ_WRITE:
+		if (req->ensures_space == false) {
+			/* Check for the available shared memory space */
+			if (statvfs("/dev/shm", &statsvfs) != 0) {
+				syslog(LOG_ERR, "statvfs failed to get file system statistics with errno value %d\n", errno);
+				return NCSCC_RC_FAILURE;
+			}
+
+			/* Checking whether sufficient shared memory is available to write the data, to be safer side ffree reduced to 1 block size */
+			if (req->info.write.i_write_size > ((statsvfs.f_bfree - 1) * statsvfs.f_frsize)) {
+				syslog(LOG_ERR, "Insufficient shared memory space (%ld) available to write the data of size: %ld \n",
+						(statsvfs.f_bfree * statsvfs.f_frsize), req->info.write.i_write_size);
+				return NCSCC_RC_FAILURE;
+			} else {
+				syslog(LOG_ERR, "Insufficient shared memory space (%ld) available to write the data of size: %ld \n",
+                                                (statsvfs.f_bfree * statsvfs.f_frsize), req->info.write.i_write_size);
+			}
+		}
 		memcpy((void *)((char *)req->info.write.i_addr + req->info.write.i_offset), req->info.write.i_from_buff,
-		       req->info.write.i_write_size);
+				req->info.write.i_write_size);
 		break;
 
 	default:
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_db.c b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_db.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
@@ -384,7 +384,7 @@ uint32_t cpnd_evt_node_del(CPND_CB *cb, 
  *
  * Notes         : None.
  *****************************************************************************/
-CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id,
+CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CB *cb, CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id,
 					  SaTimeT exp_time, uint32_t gen_flag)
 {
 	CPND_CKPT_SECTION_INFO *pSecPtr = NULL;
@@ -453,15 +453,15 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
 	cp_node->replica_info.n_secs++;
 
 	/* UPDATE THE SECTION HEADER */
-	rc = cpnd_sec_hdr_update(pSecPtr, cp_node);
+	rc = cpnd_sec_hdr_update(cb, pSecPtr, cp_node);
 	if (rc == NCSCC_RC_FAILURE) {
-		LOG_NO("cpnd sect hdr update failed");
+		LOG_ER("cpnd sect hdr update failed");
 		goto section_hdr_update_fails;
 	}
 	/* UPDATE THE CHECKPOINT HEADER */
-	rc = cpnd_ckpt_hdr_update(cp_node);
+	rc = cpnd_ckpt_hdr_update(cb, cp_node);
 	if (rc == NCSCC_RC_FAILURE) {
-		LOG_NO("cpnd ckpt hdr update failed");
+		LOG_ER("cpnd ckpt hdr update failed");
 		goto ckpt_hdr_update_fails;
 	}
 
@@ -470,7 +470,7 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
 
  section_hdr_update_fails:
  ckpt_hdr_update_fails:
-	cpnd_ckpt_sec_del(cp_node, id);
+	cpnd_ckpt_sec_del(cb, cp_node, id);
 
  section_add_fails:
 	if (pSecPtr->sec_id.id != NULL) 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -834,10 +834,12 @@ static uint32_t cpnd_evt_proc_ckpt_open(
 			}
 
 			/* UPDATE THE CHECKPOINT HEADER */
-			rc = cpnd_ckpt_hdr_update(cp_node);
+			rc = cpnd_ckpt_hdr_update(cb, cp_node);
 			if (rc == NCSCC_RC_FAILURE) {
-				TRACE_4("cpnd ckpt hdr update failed ckpt_name:%s,client_hdl:%llx",
+				LOG_ER("cpnd ckpt hdr update failed ckpt_name:%s,client_hdl:%llx",
 						ckpt_name, client_hdl);
+				send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_NO_RESOURCES;
+				goto ckpt_node_free_error;
 			}
 		}
 
@@ -861,7 +863,7 @@ static uint32_t cpnd_evt_proc_ckpt_open(
 		    cp_node->create_attrib.maxSections == 1) {
 
 			SaCkptSectionIdT sec_id = SA_CKPT_DEFAULT_SECTION_ID;
-			if(cpnd_ckpt_sec_add(cp_node, &sec_id, 0, 0) == NULL) {
+			if(cpnd_ckpt_sec_add(cb, cp_node, &sec_id, 0, 0) == NULL) {
 				TRACE_4("cpnd ckpt rep create failed with rc:%d",rc);
 				goto ckpt_shm_node_free_error;
 			}
@@ -1275,7 +1277,12 @@ static uint32_t cpnd_evt_proc_ckpt_unlin
 		cp_node->ckpt_name = strdup("");
 
 		if (cp_node->cpnd_rep_create) {
-			rc = cpnd_ckpt_hdr_update(cp_node);
+			rc = cpnd_ckpt_hdr_update(cb, cp_node);
+			if (rc == NCSCC_RC_FAILURE) {
+				error = SA_AIS_ERR_NO_RESOURCES;
+				LOG_ER("cpnd ckpt hdr update failed for ckpt_id:%llx,rc:%d",cp_node->ckpt_id, rc);
+				goto agent_rsp;
+                        }
 
 		}
 		TRACE_4("cpnd proc ckpt unlink set for ckpt_id:%llx",cp_node->ckpt_id);
@@ -1484,7 +1491,11 @@ static uint32_t cpnd_evt_proc_ckpt_rdset
 	cp_node->is_rdset = true;
 	/*Non-collocated which does not have replica */
 	if (cp_node->cpnd_rep_create)
-		cpnd_ckpt_hdr_update(cp_node);
+		 if (cpnd_ckpt_hdr_update(cb, cp_node) == NCSCC_RC_FAILURE) {
+			 LOG_ER("cpnd sect hdr update failed");
+			 send_evt.info.cpa.info.rdsetRsp.error = SA_AIS_ERR_NO_RESOURCES;
+			 goto out_evt_free;
+		 }
 
 	send_evt.info.cpa.info.rdsetRsp.error = SA_AIS_OK;
 
@@ -1631,9 +1642,13 @@ static uint32_t cpnd_evt_proc_ckpt_arep_
 		}
 	}
 
-	rc = cpnd_ckpt_hdr_update(cp_node);
-
-	send_evt.info.cpa.info.arsetRsp.error = SA_AIS_OK;
+	rc = cpnd_ckpt_hdr_update(cb, cp_node);
+	if (rc == NCSCC_RC_FAILURE) {
+		LOG_ER("cpnd  ckpt hdr update failed");
+		send_evt.info.cpa.info.arsetRsp.error = SA_AIS_ERR_NO_RESOURCES;
+	} else {
+		send_evt.info.cpa.info.arsetRsp.error = SA_AIS_OK;
+	}
 	goto agent_rsp;
 
  agent_rsp:
@@ -2082,7 +2097,11 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 			sec_info->ckpt_sec_exptmr.uarg = cb->cpnd_cb_hdl_id;
 			sec_info->ckpt_sec_exptmr.lcl_sec_id = sec_info->lcl_sec_id;
 
-			cpnd_sec_hdr_update(sec_info, cp_node);
+			if (cpnd_sec_hdr_update(cb, sec_info, cp_node) == NCSCC_RC_FAILURE) {
+				LOG_ER("cpnd sect hdr update failed");
+				send_evt.info.cpa.info.sec_exptmr_rsp.error = SA_AIS_ERR_NO_RESOURCES;
+				goto agent_rsp;
+			}
 
 			cpnd_tmr_start(&sec_info->ckpt_sec_exptmr,
 				       m_CPSV_CONVERT_SATIME_TEN_MILLI_SEC(sec_info->exp_tmr));
@@ -2108,7 +2127,11 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 		}
 		if (cp_node->cpnd_rep_create) {
 			sec_info->exp_tmr = evt->info.sec_expset.exp_time;
-			cpnd_sec_hdr_update(sec_info, cp_node);
+			if (cpnd_sec_hdr_update(cb, sec_info, cp_node) == NCSCC_RC_FAILURE) {
+				LOG_ER("cpnd sect hdr update failed");
+				send_evt.info.cpa.info.sec_exptmr_rsp.error = SA_AIS_ERR_NO_RESOURCES;
+				goto agent_rsp;
+			}
 		}
 	}
 
@@ -2237,11 +2260,11 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 
 	if (cp_node->cpnd_rep_create) {
 		if (gen_sec_id)
-			sec_info = cpnd_ckpt_sec_add(cp_node, evt->info.sec_creatReq.sec_attri.sectionId,
+			sec_info = cpnd_ckpt_sec_add(cb, cp_node, evt->info.sec_creatReq.sec_attri.sectionId,
 						     evt->info.sec_creatReq.sec_attri.expirationTime, 1);
 
 		else
-			sec_info = cpnd_ckpt_sec_add(cp_node, evt->info.sec_creatReq.sec_attri.sectionId,
+			sec_info = cpnd_ckpt_sec_add(cb, cp_node, evt->info.sec_creatReq.sec_attri.sectionId,
 						     evt->info.sec_creatReq.sec_attri.expirationTime, 0);
 
 		if (sec_info == NULL) {
@@ -2255,7 +2278,7 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 
 		if ((evt->info.sec_creatReq.init_data != NULL) && (evt->info.sec_creatReq.init_size != 0)) {
 
-			rc = cpnd_ckpt_sec_write(cp_node, sec_info, evt->info.sec_creatReq.init_data,
+			rc = cpnd_ckpt_sec_write(cb, cp_node, sec_info, evt->info.sec_creatReq.init_data,
 						 evt->info.sec_creatReq.init_size, 0, 1);
 			if (rc == NCSCC_RC_FAILURE) {
 				TRACE_4("cpnd ckpt sect write failed for section_is:%s,ckpt_id:%llx",sec_info->sec_id.id, cp_node->ckpt_id);
@@ -2357,10 +2380,10 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 								/* delete the section */
 								if (gen_sec_id)
 									tmp_sec_info =
-								    	cpnd_ckpt_sec_del(cp_node, &sec_info->sec_id);
+								    	cpnd_ckpt_sec_del(cb, cp_node, &sec_info->sec_id);
 								else
 									tmp_sec_info =
-								    	cpnd_ckpt_sec_del(cp_node,
+								    	cpnd_ckpt_sec_del(cb, cp_node,
 										      	evt->info.sec_creatReq.
 										      	sec_attri.sectionId);
 
@@ -2494,7 +2517,7 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 	rc = cpnd_ckpt_sec_find(cp_node, &evt->info.sec_delReq.sec_id);
 	if (rc == NCSCC_RC_SUCCESS) {
 
-		sec_info = cpnd_ckpt_sec_del(cp_node, &evt->info.sec_delReq.sec_id);
+		sec_info = cpnd_ckpt_sec_del(cb, cp_node, &evt->info.sec_delReq.sec_id);
 		/* resetting lcl_sec_id mapping */
 		if (sec_info == NULL) {
 			rc = NCSCC_RC_FAILURE;
@@ -2639,7 +2662,7 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt
 	}
 
 	if (cp_node->cpnd_rep_create) {
-		sec_info = cpnd_ckpt_sec_add(cp_node, evt->info.active_sec_creat.sec_attri.sectionId,
+		sec_info = cpnd_ckpt_sec_add(cb, cp_node, evt->info.active_sec_creat.sec_attri.sectionId,
 					     evt->info.active_sec_creat.sec_attri.expirationTime, 0);
 		if (sec_info == NULL) {
 			TRACE_4("cpnd ckpt sect add failed for sect_id:%s,ckpt_id:%llx",
@@ -2649,7 +2672,7 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt
 		}
 
 		if (evt->info.active_sec_creat.init_data != NULL) {
-			rc = cpnd_ckpt_sec_write(cp_node, sec_info, evt->info.active_sec_creat.init_data,
+			rc = cpnd_ckpt_sec_write(cb, cp_node, sec_info, evt->info.active_sec_creat.init_data,
 						 evt->info.active_sec_creat.init_size, 0, 1);
 			if (rc == NCSCC_RC_FAILURE) {
 				TRACE_4("cpnd ckpt sect write failed ");
@@ -2774,7 +2797,7 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt
 		send_evt.info.cpnd.info.sec_delete_rsp.error = SA_AIS_ERR_TRY_AGAIN;
 		goto nd_rsp;
 	}
-	sec_info = cpnd_ckpt_sec_del(cp_node, &evt->info.sec_delete_req.sec_id);
+	sec_info = cpnd_ckpt_sec_del(cb, cp_node, &evt->info.sec_delete_req.sec_id);
 	if (sec_info == NULL) {
 		if (m_CPND_IS_COLLOCATED_ATTR_SET(cp_node->create_attrib.creationFlags)) {
 			TRACE_4("cpnd ckpt sect del failed for sec_id:%s,ckpt_id:%llx",
@@ -2883,7 +2906,13 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt
 			sec_info->ckpt_sec_exptmr.ckpt_id = cp_node->ckpt_id;
 
 			if (cp_node->cpnd_rep_create) {
-				cpnd_sec_hdr_update(sec_info, cp_node);
+				if ((cpnd_sec_hdr_update(cb, sec_info, cp_node)) == NCSCC_RC_FAILURE) {
+					LOG_ER("cpnd sect hdr update failed");
+					send_evt.type = CPSV_EVT_TYPE_CPND;
+					send_evt.info.cpnd.type = CPSV_EVT_ND2ND_CKPT_SECT_EXPTMR_RSP;
+					send_evt.info.cpnd.info.sec_exp_rsp.error = SA_AIS_ERR_NO_RESOURCES;
+					goto nd_rsp;
+				}
 			}
 			cpnd_tmr_start(&sec_info->ckpt_sec_exptmr, sec_info->exp_tmr);
 		}
@@ -4144,15 +4173,16 @@ static uint32_t cpnd_evt_proc_ckpt_creat
 				TRACE_4("cpnd ckpt rep create failed for ckpt_id:%llx,rc:%d",cp_node->ckpt_id, rc);
 				goto ckpt_replica_create_failed;
 			}
-			rc = cpnd_ckpt_hdr_update(cp_node);
+			rc = cpnd_ckpt_hdr_update(cb, cp_node);
 			if (rc == NCSCC_RC_FAILURE) {
-				TRACE_4("cpnd ckpt hdr update failed for ckpt_id:%llx,rc:%d",cp_node->ckpt_id, rc);
+				LOG_ER("cpnd ckpt hdr update failed for ckpt_id:%llx,rc:%d",cp_node->ckpt_id, rc);
+				goto ckpt_replica_create_failed;
 			}
 
 		}
 		if (evt->info.ckpt_create.ckpt_info.ckpt_rep_create == true && cp_node->create_attrib.maxSections == 1) {
 			SaCkptSectionIdT sec_id = SA_CKPT_DEFAULT_SECTION_ID;
-			if (cpnd_ckpt_sec_add(cp_node, &sec_id, 0, 0) == NULL) {
+			if (cpnd_ckpt_sec_add(cb, cp_node, &sec_id, 0, 0) == NULL) {
 				TRACE_4("cpnd ckpt rep create failed with rc:%d",rc);
 				goto ckpt_replica_create_failed;
 			}
@@ -4167,9 +4197,10 @@ static uint32_t cpnd_evt_proc_ckpt_creat
 			TRACE_4("cpnd ckpt rep create failed with rc:%d",rc);
 			goto ckpt_replica_create_failed;
 		}
-		rc = cpnd_ckpt_hdr_update(cp_node);
+		rc = cpnd_ckpt_hdr_update(cb, cp_node);
 		if (rc == NCSCC_RC_FAILURE) {
 			TRACE_4("CPND - Ckpt Header Update Failed with rc:%d",rc);
+			goto ckpt_replica_create_failed;
 		}
 	}
 
@@ -4185,7 +4216,8 @@ static uint32_t cpnd_evt_proc_ckpt_creat
 	rc = cpnd_mds_msg_send(cb, NCSMDS_SVC_ID_CPND, cp_node->active_mds_dest, &send_evt);
 
 	if (rc != NCSCC_RC_SUCCESS) {
-		TRACE_4("cpnd remote to active mds send failed for cpnd_mdest_id:%"PRIu64",active_mds_dest:%"PRIu64",ckpt_id:%llx,rc%d",cb->cpnd_mdest_id, cp_node->active_mds_dest, cp_node->ckpt_id, rc);
+		TRACE_4("cpnd remote to active mds send failed for cpnd_mdest_id:%"PRIu64",active_mds_dest:%"PRIu64",ckpt_id:%llx,rc%d",
+				cb->cpnd_mdest_id, cp_node->active_mds_dest, cp_node->ckpt_id, rc);
 
 		goto ckpt_replica_create_failed;
 	}
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -478,10 +478,7 @@ uint32_t cpnd_ckpt_replica_create(CPND_C
 	cp_node->replica_info.open.info.open.i_size =
 	    sizeof(CPSV_CKPT_HDR) + cp_node->create_attrib.maxSections * (sizeof(CPSV_SECT_HDR) +
 									  cp_node->create_attrib.maxSectionSize);
-	if (cb->shm_alloc_guaranteed == true)
-		cp_node->replica_info.open.info.open.ensures_space = true;
-	else
-		cp_node->replica_info.open.info.open.ensures_space = false;
+	cp_node->replica_info.open.ensures_space = cb->shm_alloc_guaranteed;
 
 	cp_node->replica_info.open.info.open.i_offset = 0;
 	cp_node->replica_info.open.info.open.i_name = buf;
@@ -642,7 +639,7 @@ int32_t cpnd_ckpt_get_lck_sec_id(CPND_CK
  *
  * Notes         : None.
  *****************************************************************************/
-uint32_t cpnd_ckpt_sec_write(CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
+uint32_t cpnd_ckpt_sec_write(CPND_CB *cb, CPND_CKPT_NODE *cp_node, CPND_CKPT_SECTION_INFO
 			  *sec_info, const void *data, uint64_t size, uint64_t offset, uint32_t type)
 {				/* for sync type=2 */
 	uint32_t rc = NCSCC_RC_SUCCESS;
@@ -674,7 +671,7 @@ uint32_t cpnd_ckpt_sec_write(CPND_CKPT_N
 	write_req.info.write.i_offset = offset;
 
 	write_req.info.write.i_write_size = size;
-
+	write_req.ensures_space = cb->shm_alloc_guaranteed;
 	ncs_os_posix_shm(&write_req);
 
 	m_GET_TIME_STAMP(sec_info->lastUpdate);
@@ -687,13 +684,19 @@ uint32_t cpnd_ckpt_sec_write(CPND_CKPT_N
 		}
 
 		/* SECTION HEADER UPDATE */
-		cpnd_sec_hdr_update(sec_info, cp_node);
+		if (cpnd_sec_hdr_update(cb, sec_info, cp_node) == NCSCC_RC_FAILURE) {
+                    LOG_ER("cpnd sect hdr update failed");
+		    rc = NCSCC_RC_FAILURE;
+                }
 
 	} else if ((type == 1) || (type == 3)) {
 		cp_node->replica_info.mem_used -= sec_info->sec_size;
 		sec_info->sec_size = size;
 		cp_node->replica_info.mem_used += size;
-		cpnd_sec_hdr_update(sec_info, cp_node);
+		if ((cpnd_sec_hdr_update(cb, sec_info, cp_node)) == NCSCC_RC_FAILURE) {
+			LOG_ER("cpnd sect hdr update failed");
+			rc = NCSCC_RC_FAILURE;
+		}
 	}
 	TRACE_LEAVE();
 	return rc;
@@ -958,7 +961,7 @@ uint32_t cpnd_ckpt_update_replica(CPND_C
 		sec_info = cpnd_ckpt_sec_get_create(cp_node, &data->sec_id);
 		if (sec_info == NULL) {
 			if (type == CPSV_CKPT_ACCESS_SYNC) {
-				sec_info = cpnd_ckpt_sec_add(cp_node, &data->sec_id, data->expirationTime, 0);
+				sec_info = cpnd_ckpt_sec_add(cb, cp_node, &data->sec_id, data->expirationTime, 0);
 
 				if (sec_info == NULL) {
 					TRACE_4("cpnd - ckpt sect add failed , sec_id:%s ckpt_id:%llx",data->sec_id.id,cp_node->ckpt_id);
@@ -975,7 +978,7 @@ uint32_t cpnd_ckpt_update_replica(CPND_C
 			}
 		}
 
-		rc = cpnd_ckpt_sec_write(cp_node, sec_info, data->data, data->dataSize,
+		rc = cpnd_ckpt_sec_write(cb, cp_node, sec_info, data->data, data->dataSize,
 					 data->dataOffset, write_data->type);
 		if (rc == NCSCC_RC_FAILURE) {
 			TRACE("cpnd ckpt sect write failed for sec_id:%s",data->sec_id.id);
@@ -1544,7 +1547,7 @@ uint32_t cpnd_proc_sec_expiry(CPND_CB *c
 		return NCSCC_RC_FAILURE;
 	}
 
-	cpnd_ckpt_sec_del(cp_node, &pSec_info->sec_id);
+	cpnd_ckpt_sec_del(cb, cp_node, &pSec_info->sec_id);
 	cp_node->replica_info.shm_sec_mapping[pSec_info->lcl_sec_id] = 1;
 
 	/* send out destory to all cpnd's maintaining this ckpt */
@@ -1804,7 +1807,7 @@ cpnd_proc_getnext_section(CPND_CKPT_NODE
  * Return Values : Success / Error
 ****************************************************************************/
 
-uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_NODE *cp_node)
+uint32_t cpnd_ckpt_hdr_update(CPND_CB *cb, CPND_CKPT_NODE *cp_node)
 {
 	CPSV_CKPT_HDR ckpt_hdr;
 	uint32_t rc = NCSCC_RC_SUCCESS;
@@ -1830,6 +1833,7 @@ uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_
 	write_req.info.write.i_from_buff = (CPSV_CKPT_HDR *)&ckpt_hdr;
 	write_req.info.write.i_offset = 0;
 	write_req.info.write.i_write_size = sizeof(CPSV_CKPT_HDR);
+	write_req.ensures_space = cb->shm_alloc_guaranteed;
 	rc = ncs_os_posix_shm(&write_req);
 
 	return rc;
@@ -1846,7 +1850,7 @@ uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_
  * Return Values : Success / Error
 ***********************************************************************************/
 
-uint32_t cpnd_sec_hdr_update(CPND_CKPT_SECTION_INFO *sec_info, CPND_CKPT_NODE *cp_node)
+uint32_t cpnd_sec_hdr_update(CPND_CB *cb, CPND_CKPT_SECTION_INFO *sec_info, CPND_CKPT_NODE *cp_node)
 {
 	CPSV_SECT_HDR sec_hdr;
 	uint32_t rc = NCSCC_RC_SUCCESS;
@@ -1872,6 +1876,7 @@ uint32_t cpnd_sec_hdr_update(CPND_CKPT_S
 	write_req.info.write.i_offset =
 	    sec_info->lcl_sec_id * (sizeof(CPSV_SECT_HDR) + cp_node->create_attrib.maxSectionSize);
 	write_req.info.write.i_write_size = sizeof(CPSV_SECT_HDR);
+	write_req.ensures_space = cb->shm_alloc_guaranteed;
 	rc = ncs_os_posix_shm(&write_req);
 
 	return rc;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_res.c b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_res.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
@@ -149,8 +149,8 @@ uint32_t cpnd_res_ckpt_sec_del(CPND_CKPT
  |-----------|----------|-----------|--------|----------|------------ |----------|---------|        
 */
 
-uint32_t cpnd_ckpt_replica_create_res(NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf, CPND_CKPT_NODE **cp_node,
-				   uint32_t ref_cnt, CKPT_INFO *cp_info, bool shm_alloc_guaranteed)
+uint32_t cpnd_ckpt_replica_create_res(CPND_CB *cb, NCS_OS_POSIX_SHM_REQ_INFO *open_req, char *buf, CPND_CKPT_NODE **cp_node,
+				   uint32_t ref_cnt, CKPT_INFO *cp_info)
 {
 /*   NCS_OS_POSIX_SHM_REQ_INFO read_req,shm_read; */
 	CPSV_CKPT_HDR ckpt_hdr;
@@ -165,15 +165,12 @@ uint32_t cpnd_ckpt_replica_create_res(NC
 	open_req->type = NCS_OS_POSIX_SHM_REQ_OPEN;
 	open_req->info.open.i_size =
 	    sizeof(CPSV_CKPT_HDR) + (cp_info->maxSections * ((sizeof(CPSV_SECT_HDR) + cp_info->maxSecSize)));
-	if (shm_alloc_guaranteed == true)
-		open_req->info.open.ensures_space = true;
-	else
-		open_req->info.open.ensures_space = false;
 	open_req->info.open.i_offset = 0;
 	open_req->info.open.i_name = buf;
 	open_req->info.open.i_map_flags = MAP_SHARED;
 	open_req->info.open.o_addr = NULL;
 	open_req->info.open.i_flags = O_RDWR;
+	open_req->ensures_space = cb->shm_alloc_guaranteed;
 	rc = ncs_os_posix_shm(open_req);
 	if (rc != NCSCC_RC_SUCCESS) {
 		LOG_ER("cpnd shm open request failed %s",buf);
@@ -362,10 +359,7 @@ void *cpnd_restart_shm_create(NCS_OS_POS
 	cpnd_open_req->info.open.i_size = sizeof(CPND_SHM_VERSION) +
 	    sizeof(CLIENT_HDR) + (MAX_CLIENTS * sizeof(CLIENT_INFO)) + sizeof(CKPT_HDR) +
 	    (MAX_CKPTS * sizeof(CKPT_INFO));
-	if (cb->shm_alloc_guaranteed == true)
-		cpnd_open_req->info.open.ensures_space = true;
-	else
-		cpnd_open_req->info.open.ensures_space = false; 
+	cpnd_open_req->ensures_space = cb->shm_alloc_guaranteed; 
 	cpnd_open_req->info.open.i_offset = 0;
 	cpnd_open_req->info.open.i_name = buffer;
 	cpnd_open_req->info.open.i_map_flags = MAP_SHARED;
@@ -529,7 +523,7 @@ void *cpnd_restart_shm_create(NCS_OS_POS
 					memset(buf, '\0', CPND_MAX_REPLICA_NAME_LENGTH);
 					strncpy(buf, cp_node->ckpt_name, CPND_REP_NAME_MAX_CKPT_NAME_LENGTH);
 					sprintf(buf + strlen(buf) - 1, "_%u_%llu", (uint32_t)nodeid, cp_node->ckpt_id);
-					rc = cpnd_ckpt_replica_create_res(&ckpt_rep_open, buf, &cp_node, 0, &cp_info, cb->shm_alloc_guaranteed);
+					rc = cpnd_ckpt_replica_create_res(cb, &ckpt_rep_open, buf, &cp_node, 0, &cp_info);
 					if (rc != NCSCC_RC_SUCCESS) {
 						/*   assert(0); */
 						TRACE_4("cpnd ckpt replica create failed with return value %d",rc);
@@ -1170,6 +1164,7 @@ uint32_t cpnd_restart_client_node_del(CP
 	}
 	clinfo_write.info.write.i_offset = cl_node->offset * sizeof(CLIENT_INFO);
 	clinfo_write.info.write.i_write_size = sizeof(CLIENT_INFO);
+	clinfo_write.ensures_space = cb->shm_alloc_guaranteed;
 	rc = ncs_os_posix_shm(&clinfo_write);
 	if (rc != NCSCC_RC_SUCCESS) {
 		LOG_ER("cpnd ckpt info write failed"); 
@@ -1582,10 +1577,7 @@ static uint32_t cpnd_shm_extended_open(C
 
 	cpnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN;
 	cpnd_open_req.info.open.i_size = MAX_CKPTS * sizeof(CKPT_EXTENDED_INFO);
-	if (cb->shm_alloc_guaranteed == true)
-		cpnd_open_req.info.open.ensures_space = true;
-	else
-		cpnd_open_req.info.open.ensures_space = false;
+	cpnd_open_req.ensures_space = cb->shm_alloc_guaranteed;
 	cpnd_open_req.info.open.i_offset = 0;
 	cpnd_open_req.info.open.i_name = buffer;
 	cpnd_open_req.info.open.i_map_flags = MAP_SHARED;
@@ -1738,4 +1730,4 @@ static void cpnd_destroy_shm(NCS_OS_POSI
 	}
 
 	TRACE_LEAVE();
-}
\ No newline at end of file
+}
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc b/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
--- a/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
@@ -169,7 +169,7 @@ cpnd_ckpt_sec_find(const CPND_CKPT_NODE 
  * Notes         : None.
  *****************************************************************************/
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
+cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
 {
   CPND_CKPT_SECTION_INFO *sectionInfo(0);
 
@@ -211,17 +211,17 @@ cpnd_ckpt_sec_del(CPND_CKPT_NODE *cp_nod
     cp_node->replica_info.mem_used = cp_node->replica_info.mem_used - (sectionInfo->sec_size);
 
     // UPDATE THE SECTION HEADER
-    uint32_t rc(cpnd_sec_hdr_update(sectionInfo, cp_node));
+    uint32_t rc(cpnd_sec_hdr_update(cb, sectionInfo, cp_node));
     if (rc == NCSCC_RC_FAILURE) {
-      TRACE_4("cpnd sect hdr update failed");
+	    LOG_ER("cpnd sect hdr update failed");
     }
 
     // UPDATE THE CHECKPOINT HEADER
-    rc = cpnd_ckpt_hdr_update(cp_node);
+    rc = cpnd_ckpt_hdr_update(cb, cp_node);
     if (rc == NCSCC_RC_FAILURE) {
-      TRACE_4("cpnd ckpt hdr update failed");
+	    LOG_ER("cpnd ckpt hdr update failed");
     }
-  }
+    }
 
   TRACE_LEAVE();
 
diff --git a/osaf/services/saf/glsv/glnd/glnd_shm.c b/osaf/services/saf/glsv/glnd/glnd_shm.c
--- a/osaf/services/saf/glsv/glnd/glnd_shm.c
+++ b/osaf/services/saf/glsv/glnd/glnd_shm.c
@@ -71,7 +71,7 @@ static uint32_t glnd_shm_open(GLND_CB *c
 
 	glnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN;
 	glnd_open_req.info.open.i_size = shm_size;
-	glnd_open_req.info.open.ensures_space = false;
+	glnd_open_req.ensures_space = false;
 	glnd_open_req.info.open.i_offset = 0;
 	glnd_open_req.info.open.i_name = shm_name;
 	glnd_open_req.info.open.i_map_flags = MAP_SHARED;
diff --git a/osaf/services/saf/mqsv/mqnd/mqnd_shm.c b/osaf/services/saf/mqsv/mqnd/mqnd_shm.c
--- a/osaf/services/saf/mqsv/mqnd/mqnd_shm.c
+++ b/osaf/services/saf/mqsv/mqnd/mqnd_shm.c
@@ -66,7 +66,7 @@ uint32_t mqnd_shm_create(MQND_CB *cb)
 	mqnd_open_req.type = NCS_OS_POSIX_SHM_REQ_OPEN;
 	mqnd_open_req.info.open.i_size =
 	    sizeof(MQND_SHM_VERSION) + (sizeof(MQND_QUEUE_CKPT_INFO) * cb->mqnd_shm.max_open_queues);
-	mqnd_open_req.info.open.ensures_space = false;
+	mqnd_open_req.ensures_space = false;
 	mqnd_open_req.info.open.i_offset = 0;
 	mqnd_open_req.info.open.i_name = shm_name;
 	mqnd_open_req.info.open.i_map_flags = MAP_SHARED;
diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *
 cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *, SaCkptSectionIdT *);
+cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *, SaCkptSectionIdT *, bool hdr_update);
 
 CPND_CKPT_SECTION_INFO *
 cpnd_get_sect_with_id(const CPND_CKPT_NODE *, uint32_t lcl_sec_id);
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_db.c b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_db.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
@@ -391,6 +391,7 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
 	int32_t lcl_sec_id = 0;
 	uint32_t rc = NCSCC_RC_SUCCESS;
 	uint32_t value = 0, i = 0, j = 0;
+	bool hdr_update = true;
 
 	TRACE_ENTER();
 	/* get the lcl_sec_id */
@@ -469,8 +470,9 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
 	return pSecPtr;
 
  section_hdr_update_fails:
+	hdr_update = false;
  ckpt_hdr_update_fails:
-	cpnd_ckpt_sec_del(cb, cp_node, id);
+	cpnd_ckpt_sec_del(cb, cp_node, id, hdr_update);
 
  section_add_fails:
 	if (pSecPtr->sec_id.id != NULL) 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -2380,12 +2380,12 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 								/* delete the section */
 								if (gen_sec_id)
 									tmp_sec_info =
-								    	cpnd_ckpt_sec_del(cb, cp_node, &sec_info->sec_id);
+								    	cpnd_ckpt_sec_del(cb, cp_node, &sec_info->sec_id, true);
 								else
 									tmp_sec_info =
 								    	cpnd_ckpt_sec_del(cb, cp_node,
 										      	evt->info.sec_creatReq.
-										      	sec_attri.sectionId);
+										      	sec_attri.sectionId, true);
 
 								if (tmp_sec_info == sec_info) {
 									cp_node->replica_info.
@@ -2517,7 +2517,7 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
 	rc = cpnd_ckpt_sec_find(cp_node, &evt->info.sec_delReq.sec_id);
 	if (rc == NCSCC_RC_SUCCESS) {
 
-		sec_info = cpnd_ckpt_sec_del(cb, cp_node, &evt->info.sec_delReq.sec_id);
+		sec_info = cpnd_ckpt_sec_del(cb, cp_node, &evt->info.sec_delReq.sec_id, true);
 		/* resetting lcl_sec_id mapping */
 		if (sec_info == NULL) {
 			rc = NCSCC_RC_FAILURE;
@@ -2797,7 +2797,7 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt
 		send_evt.info.cpnd.info.sec_delete_rsp.error = SA_AIS_ERR_TRY_AGAIN;
 		goto nd_rsp;
 	}
-	sec_info = cpnd_ckpt_sec_del(cb, cp_node, &evt->info.sec_delete_req.sec_id);
+	sec_info = cpnd_ckpt_sec_del(cb, cp_node, &evt->info.sec_delete_req.sec_id, true);
 	if (sec_info == NULL) {
 		if (m_CPND_IS_COLLOCATED_ATTR_SET(cp_node->create_attrib.creationFlags)) {
 			TRACE_4("cpnd ckpt sect del failed for sec_id:%s,ckpt_id:%llx",
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -1547,7 +1547,7 @@ uint32_t cpnd_proc_sec_expiry(CPND_CB *c
 		return NCSCC_RC_FAILURE;
 	}
 
-	cpnd_ckpt_sec_del(cb, cp_node, &pSec_info->sec_id);
+	cpnd_ckpt_sec_del(cb, cp_node, &pSec_info->sec_id, true);
 	cp_node->replica_info.shm_sec_mapping[pSec_info->lcl_sec_id] = 1;
 
 	/* send out destory to all cpnd's maintaining this ckpt */
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc b/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
--- a/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
@@ -163,13 +163,14 @@ cpnd_ckpt_sec_find(const CPND_CKPT_NODE 
  *
  * Arguments     : CPND_CKPT_NODE *cp_node - Check point node.
  *               : SaCkptSectionIdT id - Section Identifier
+ *               : hdr_update - UPDATE THE SECTION/CHECKPOINT HEADER or NOT
  *                 
  * Return Values :  ptr to CPND_CKPT_SECTION_INFO/NULL;
  *
  * Notes         : None.
  *****************************************************************************/
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
+cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id, bool hdr_update)
 {
   CPND_CKPT_SECTION_INFO *sectionInfo(0);
 
@@ -210,18 +211,20 @@ cpnd_ckpt_sec_del(CPND_CB *cb, CPND_CKPT
     cp_node->replica_info.n_secs--;
     cp_node->replica_info.mem_used = cp_node->replica_info.mem_used - (sectionInfo->sec_size);
 
-    // UPDATE THE SECTION HEADER
-    uint32_t rc(cpnd_sec_hdr_update(cb, sectionInfo, cp_node));
-    if (rc == NCSCC_RC_FAILURE) {
-	    LOG_ER("cpnd sect hdr update failed");
+    if (hdr_update == true) {
+	    // UPDATE THE SECTION HEADER
+	    uint32_t rc(cpnd_sec_hdr_update(cb, sectionInfo, cp_node));
+	    if (rc == NCSCC_RC_FAILURE) {
+		    LOG_ER("cpnd sect hdr update failed");
+	    }
+
+	    // UPDATE THE CHECKPOINT HEADER
+	    rc = cpnd_ckpt_hdr_update(cb, cp_node);
+	    if (rc == NCSCC_RC_FAILURE) {
+		    LOG_ER("cpnd ckpt hdr update failed");
+	    }
     }
-
-    // UPDATE THE CHECKPOINT HEADER
-    rc = cpnd_ckpt_hdr_update(cb, cp_node);
-    if (rc == NCSCC_RC_FAILURE) {
-	    LOG_ER("cpnd ckpt hdr update failed");
-    }
-    }
+  }
 
   TRACE_LEAVE();
 
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to