Fix some unbalanced sched_lock()/sched_unlock() pairs int the re-implemented VFS semaphore and message queue logic

This commit is contained in:
Gregory Nutt 2014-09-29 16:13:07 -06:00
parent e340d89990
commit 5462ede661
5 changed files with 12 additions and 4 deletions

View File

@ -150,6 +150,7 @@ int mq_close(mqd_t mqdes)
/* Decrement the reference count on the inode */
mq_inode_release(inode);
sched_unlock();
}
return OK;

View File

@ -235,9 +235,10 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
inode->u.i_mqueue = msgq;
msgq->inode = inode;
}
sched_unlock();
}
sched_unlock();
return mqdes;
errout_with_msgq:

View File

@ -160,6 +160,7 @@ int mq_unlink(FAR const char *mq_name)
inode_semgive();
mq_inode_release(inode);
sched_unlock();
return OK;
errout_with_semaphore:
@ -168,5 +169,6 @@ errout_with_inode:
inode_release(inode);
errout:
set_errno(errcode);
sched_unlock();
return ERROR;
}

View File

@ -255,16 +255,17 @@ FAR sem_t *sem_open (FAR const char *name, int oflags, ...)
sem = &nsem->ns_sem;
}
sched_unlock();
}
sched_unlock();
return sem;
errout_with_inode:
inode_release(inode);
errout_with_lock:
sched_unlock();
set_errno(errcode);
sched_unlock();
return (FAR sem_t *)ERROR;
}

View File

@ -162,7 +162,9 @@ int sem_unlink(FAR const char *name)
*/
inode_semgive();
return sem_close((FAR sem_t *)inode->u.i_nsem);
ret = sem_close((FAR sem_t *)inode->u.i_nsem);
sched_unlock();
return ret;
errout_with_semaphore:
inode_semgive();
@ -170,5 +172,6 @@ errout_with_inode:
inode_release(inode);
errout:
set_errno(errcode);
sched_unlock();
return ERROR;
}