Applied Till's fix for lp:1581212

This commit is contained in:
Andrew Johnson
2016-05-13 13:30:55 -05:00
parent 6db0e13809
commit b5a0657adc
2 changed files with 22 additions and 1 deletions
+14
View File
@@ -13,6 +13,20 @@
<!-- Insert new items immediately below here ... -->
<h3>Making IOC ca_get operations atomic</h3>
<p>When a CA client gets data from an IOC record using a compound data type such
as <tt>DBR_TIME_DOUBLE</tt> the value field is fetched from the database in a
separate call than the other metadata, without keeping the record locked. This
allows some other thread such as a periodic scan thread a chance to interrupt
the get operation and process the record in between. CA monitors have always
been atomic as long as the value data isn't a string or an array, but this race
condition in the CA get path has now been fixed so the record will stay locked
between the two fetch operations.</p>
<p>This fixes <a href="https://bugs.launchpad.net/epics-base/+bug/1581212">
Launchpad bug #1581212</a>, thanks to Till Strauman and Dehong Zhang.</p>
<h3>New CONFIG_SITE variable for running self-tests</h3>
<p>The 'make runtests' and 'make tapfiles' build targets normally only run the
+8 -1
View File
@@ -32,6 +32,7 @@
#include "dbCommon.h"
#include "errMdef.h"
#include "recSup.h"
#include "dbLock.h"
#include "alarm.h"
#define db_accessHFORdb_accessC
#include "db_access.h"
@@ -182,6 +183,8 @@ int epicsShareAPI db_get_field_and_count(
* in the dbAccess.c dbGet() and getOptions() routines.
*/
dbScanLock(paddr->precord);
switch(buffer_type) {
case(oldDBR_STRING):
status = dbGetField(paddr, DBR_STRING, pbuffer, &zero, nRequest, pfl);
@@ -820,8 +823,12 @@ int epicsShareAPI db_get_field_and_count(
}
break;
default:
return -1;
status = -1;
break;
}
dbScanUnlock(paddr->precord);
if (status) return -1;
return 0;
}