kernel/fs: Add some more lock assertions.
This commit is contained in:
@@ -78,6 +78,9 @@ EntryCache::~EntryCache()
|
|||||||
status_t
|
status_t
|
||||||
EntryCache::Init()
|
EntryCache::Init()
|
||||||
{
|
{
|
||||||
|
WriteLocker locker(fLock);
|
||||||
|
ASSERT(fGenerationCount == 0);
|
||||||
|
|
||||||
status_t error = fEntries.Init();
|
status_t error = fEntries.Init();
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ alloc_fd(void)
|
|||||||
bool
|
bool
|
||||||
fd_close_on_exec(const struct io_context* context, int fd)
|
fd_close_on_exec(const struct io_context* context, int fd)
|
||||||
{
|
{
|
||||||
|
ASSERT_READ_LOCKED_RW_LOCK(&context->lock);
|
||||||
|
|
||||||
return CHECK_BIT(context->fds_close_on_exec[fd / 8], fd & 7) ? true : false;
|
return CHECK_BIT(context->fds_close_on_exec[fd / 8], fd & 7) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +104,8 @@ fd_close_on_exec(const struct io_context* context, int fd)
|
|||||||
void
|
void
|
||||||
fd_set_close_on_exec(struct io_context* context, int fd, bool closeFD)
|
fd_set_close_on_exec(struct io_context* context, int fd, bool closeFD)
|
||||||
{
|
{
|
||||||
|
ASSERT_WRITE_LOCKED_RW_LOCK(&context->lock);
|
||||||
|
|
||||||
if (closeFD)
|
if (closeFD)
|
||||||
context->fds_close_on_exec[fd / 8] |= (1 << (fd & 7));
|
context->fds_close_on_exec[fd / 8] |= (1 << (fd & 7));
|
||||||
else
|
else
|
||||||
@@ -112,6 +116,8 @@ fd_set_close_on_exec(struct io_context* context, int fd, bool closeFD)
|
|||||||
bool
|
bool
|
||||||
fd_close_on_fork(const struct io_context* context, int fd)
|
fd_close_on_fork(const struct io_context* context, int fd)
|
||||||
{
|
{
|
||||||
|
ASSERT_READ_LOCKED_RW_LOCK(&context->lock);
|
||||||
|
|
||||||
return CHECK_BIT(context->fds_close_on_fork[fd / 8], fd & 7) ? true : false;
|
return CHECK_BIT(context->fds_close_on_fork[fd / 8], fd & 7) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +125,8 @@ fd_close_on_fork(const struct io_context* context, int fd)
|
|||||||
void
|
void
|
||||||
fd_set_close_on_fork(struct io_context* context, int fd, bool closeFD)
|
fd_set_close_on_fork(struct io_context* context, int fd, bool closeFD)
|
||||||
{
|
{
|
||||||
|
ASSERT_WRITE_LOCKED_RW_LOCK(&context->lock);
|
||||||
|
|
||||||
if (closeFD)
|
if (closeFD)
|
||||||
context->fds_close_on_fork[fd / 8] |= (1 << (fd & 7));
|
context->fds_close_on_fork[fd / 8] |= (1 << (fd & 7));
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -4994,6 +4994,7 @@ vfs_new_io_context(const io_context* parentContext, bool purgeCloseOnExec)
|
|||||||
context->ref_count = 1;
|
context->ref_count = 1;
|
||||||
rw_lock_init(&context->lock, "I/O context");
|
rw_lock_init(&context->lock, "I/O context");
|
||||||
|
|
||||||
|
WriteLocker contextLocker(context->lock);
|
||||||
ReadLocker parentLocker;
|
ReadLocker parentLocker;
|
||||||
|
|
||||||
size_t tableSize;
|
size_t tableSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user