Skip to content

Commit

Permalink
Ignore objectstore.readrefresh when using DB.
Browse files Browse the repository at this point in the history
No performance enhancement was detected when not doing mutex lock.
  • Loading branch information
Lars Silvén committed Jul 27, 2021
1 parent 41818bc commit 3bbf8d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
13 changes: 6 additions & 7 deletions src/lib/common/softhsm2.conf.5.in
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@ library.reset_on_fork = true
.RE
.LP
.SH OBJECTSTORE.READREFRESH
If set to false, then this will affect the refreshing of the object store in
the following way before an object is used but not changed:
.IP * 2
No files will be read if 'objectstore.backend = file'.
.IP * 2
No wait for mutex to unlock if 'objectstore.backend = db'.
If set to false and if 'objectstore.backend = file', then this will affect
the refreshing of the object store.
Before using an object that is not changed, no files will be read.
.LP
Depending of what kind of HW that is used setting 'false' may improve the
performance of the HSM.
Expand All @@ -119,7 +116,9 @@ unmodified or deleted object even if it is changed or deleted. Another
process may have called C_DestroyObject or C_SetAttributeValue. But every
time a process gets a new handle for an object the objectstore of this
process is updated for all objects even if this property is false.
.LP
.LP
If 'objectstore.backend = db' then the value of this property is ignored.
.LP
Default is true.
.LP
.RS
Expand Down
11 changes: 3 additions & 8 deletions src/lib/object_store/DBObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,15 +1362,10 @@ bool DBObject::deleteAttribute(CK_ATTRIBUTE_TYPE type)
}

// The validity state of the object
// If not 'doRefresh' we know that the object allready exists in the DB
// and hence _objectId should have been initialized.
bool DBObject::isValid(const bool doRefresh)
bool DBObject::isValid(const bool doRefresh __attribute__((unused)))
{
if (doRefresh)
{
// Wait for update of object.
MutexLocker lock(_mutex);
}
MutexLocker lock(_mutex);

return _objectId != 0 && _connection != NULL;
}

Expand Down

0 comments on commit 3bbf8d1

Please sign in to comment.