Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d2de4f5

Browse files
Lars Silvénlarssilven
Lars Silvén
authored andcommittedNov 30, 2024·
Ignore objectstore.readrefresh when using DB.
No performance enhancement was detected when not doing mutex lock.
1 parent 2200d15 commit d2de4f5

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed
 

‎src/lib/common/softhsm2.conf.5.in

+6-7
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,9 @@ library.reset_on_fork = true
103103
.RE
104104
.LP
105105
.SH OBJECTSTORE.READREFRESH
106-
If set to false, then this will affect the refreshing of the object store in
107-
the following way before an object is used but not changed:
108-
.IP * 2
109-
No files will be read if 'objectstore.backend = file'.
110-
.IP * 2
111-
No wait for mutex to unlock if 'objectstore.backend = db'.
106+
If set to false and if 'objectstore.backend = file', then this will affect
107+
the refreshing of the object store.
108+
Before using an object that is not changed, no files will be read.
112109
.LP
113110
Depending of what kind of HW that is used setting 'false' may improve the
114111
performance of the HSM.
@@ -119,7 +116,9 @@ unmodified or deleted object even if it is changed or deleted. Another
119116
process may have called C_DestroyObject or C_SetAttributeValue. But every
120117
time a process gets a new handle for an object the objectstore of this
121118
process is updated for all objects even if this property is false.
122-
.LP
119+
.LP
120+
If 'objectstore.backend = db' then the value of this property is ignored.
121+
.LP
123122
Default is true.
124123
.LP
125124
.RS

‎src/lib/object_store/DBObject.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -1364,15 +1364,10 @@ bool DBObject::deleteAttribute(CK_ATTRIBUTE_TYPE type)
13641364
}
13651365

13661366
// The validity state of the object
1367-
// If not 'doRefresh' we know that the object allready exists in the DB
1368-
// and hence _objectId should have been initialized.
1369-
bool DBObject::isValid(const bool doRefresh)
1367+
bool DBObject::isValid(const bool doRefresh __attribute__((unused)))
13701368
{
1371-
if (doRefresh)
1372-
{
1373-
// Wait for update of object.
1374-
MutexLocker lock(_mutex);
1375-
}
1369+
MutexLocker lock(_mutex);
1370+
13761371
return _objectId != 0 && _connection != NULL;
13771372
}
13781373

0 commit comments

Comments
 (0)
Please sign in to comment.