- **status**: review --> fixed
- **Comment**:

5.17.08
commit b750bdddb00444276b88a19fa1be9131753bd80d
Author: A V Mahesh <mahesh.va...@oracle.com>
Date:   Wed May 10 15:24:46 2017 +0530
 
    log: correct mutex lock and unlock sequence in logd [#2452]
    
5.17.06 
commit 91341ee47e84b298ae82a1d28db119a9b56f1d0b
Author: A V Mahesh <mahesh.va...@oracle.com>
Date:   Wed May 10 15:24:46 2017 +0530
 
    log: correct mutex lock and unlock sequence in logd [#2452]



---

** [tickets:#2452] log: mutex lock missing in error cases of 
write_log_record_hdl() **

**Status:** fixed
**Milestone:** 5.1.0
**Created:** Thu May 04, 2017 05:54 AM UTC by A V Mahesh (AVM)
**Last Updated:** Mon May 15, 2017 04:56 AM UTC
**Owner:** A V Mahesh (AVM)


Unlock is being called twice before waiting hence LOGD crashes.

This because of write_log_record_hdl() is being returned with out
osaf_mutex_lock_ordie(&lgs_ftcom_mutex);


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

int write_log_record_hdl(void *indata, void *outdata, size_t max_outsize, bool 
*timeout_f) {
  int rc = 0;
  uint32_t bytes_written = 0;
  off_t file_length = 0;
  wlrh_t *params_in = static_cast<wlrh_t *>(indata);
  /* Get log record pointed by lgs_rec pointer */
  char *logrecord = const_cast<char *>(static_cast<const 
char*>(params_in->lgs_rec));
  int *errno_out_p = static_cast<int *>(outdata);
  *errno_out_p = 0;
 
  TRACE_ENTER();
 
  osaf_mutex_unlock_ordie(&lgs_ftcom_mutex); /* UNLOCK  Critical section */
 
retry:
  rc = write(params_in->fd, &logrecord[bytes_written],
             params_in->record_size - bytes_written);
  if (rc == -1) {
    if (errno == EINTR)
      goto retry; 
 
    LOG_ER("%s - write FAILED: %s",__FUNCTION__, strerror(errno));
    *errno_out_p = errno;
    goto done;  
<-------------------------------------------------------------------
  } else {
    /* Handle partial writes */
    bytes_written += rc;
    if (bytes_written < params_in->record_size)
      goto retry;
  }
  osaf_mutex_lock_ordie(&lgs_ftcom_mutex);
  
=================================================================================


---

Sent from sourceforge.net because opensaf-tickets@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/opensaf/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-tickets mailing list
Opensaf-tickets@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to