Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasets locking/v1 #12182

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/datasets.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,12 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
return NULL;
}

SCMutexLock(&sets_lock);
Dataset *set = DatasetSearchByName(name);
if (set) {
if (type != DATASET_TYPE_NOTSET && set->type != type) {
SCLogError("dataset %s already "
"exists and is of type %u",
set->name, set->type);
SCMutexUnlock(&sets_lock);
return NULL;
}

Expand All @@ -655,18 +653,15 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
if ((save == NULL && strlen(set->save) > 0) ||
(save != NULL && strcmp(set->save, save) != 0)) {
SCLogError("dataset %s save mismatch: %s != %s", set->name, set->save, save);
SCMutexUnlock(&sets_lock);
return NULL;
}
if ((load == NULL && strlen(set->load) > 0) ||
(load != NULL && strcmp(set->load, load) != 0)) {
SCLogError("dataset %s load mismatch: %s != %s", set->name, set->load, load);
SCMutexUnlock(&sets_lock);
return NULL;
}
}

SCMutexUnlock(&sets_lock);
return set;
} else {
if (type == DATASET_TYPE_NOTSET) {
Expand Down Expand Up @@ -759,7 +754,6 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
set->next = sets;
sets = set;

SCMutexUnlock(&sets_lock);
return set;
out_err:
if (set) {
Expand All @@ -768,7 +762,6 @@ Dataset *DatasetGet(const char *name, enum DatasetTypes type, const char *save,
}
SCFree(set);
}
SCMutexUnlock(&sets_lock);
return NULL;
}

Expand Down
2 changes: 0 additions & 2 deletions src/detect-dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
#define DETECT_DATASET_CMD_ISNOTSET 2
#define DETECT_DATASET_CMD_ISSET 3

int DetectDatasetMatch (ThreadVars *, DetectEngineThreadCtx *, Packet *,
const Signature *, const SigMatchCtx *);
static int DetectDatasetSetup (DetectEngineCtx *, Signature *, const char *);
void DetectDatasetFree (DetectEngineCtx *, void *);

Expand Down
Loading