fix race in completion code

This commit is contained in:
Thomas Schoebel-Theuer 2011-11-16 10:34:06 +01:00 committed by Thomas Schoebel-Theuer
parent b97aa05479
commit b53ba3124b
1 changed files with 7 additions and 8 deletions

View File

@ -144,16 +144,15 @@ void log_flush(struct log_status *logst)
logst->count = 0;
logst->log_mref = NULL;
if (cb_info->nr_cb > 0) {
down(&cb_info->mutex);
for (i = 0; i < cb_info->nr_cb; i++) {
void (*cbf)(void *private) = cb_info->preios[i];
if (cbf) {
cbf(cb_info->privates[i]);
}
down(&cb_info->mutex);
for (i = 0; i < cb_info->nr_cb; i++) {
void (*cbf)(void *private) = cb_info->preios[i];
if (cbf) {
cbf(cb_info->privates[i]);
}
up(&cb_info->mutex);
}
up(&cb_info->mutex);
put_log_cb_info(cb_info);
}
EXPORT_SYMBOL_GPL(log_flush);