kernel/fs: Add some more lock assertions.

This commit is contained in:
Augustin Cavalier
2025-10-17 15:50:51 -04:00
parent 0f9f1f124f
commit c02707824b
3 changed files with 12 additions and 0 deletions
+3
View File
@@ -78,6 +78,9 @@ EntryCache::~EntryCache()
status_t
EntryCache::Init()
{
WriteLocker locker(fLock);
ASSERT(fGenerationCount == 0);
status_t error = fEntries.Init();
if (error != B_OK)
return error;
+8
View File
@@ -95,6 +95,8 @@ alloc_fd(void)
bool
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;
}
@@ -102,6 +104,8 @@ fd_close_on_exec(const struct io_context* context, int fd)
void
fd_set_close_on_exec(struct io_context* context, int fd, bool closeFD)
{
ASSERT_WRITE_LOCKED_RW_LOCK(&context->lock);
if (closeFD)
context->fds_close_on_exec[fd / 8] |= (1 << (fd & 7));
else
@@ -112,6 +116,8 @@ fd_set_close_on_exec(struct io_context* context, int fd, bool closeFD)
bool
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;
}
@@ -119,6 +125,8 @@ fd_close_on_fork(const struct io_context* context, int fd)
void
fd_set_close_on_fork(struct io_context* context, int fd, bool closeFD)
{
ASSERT_WRITE_LOCKED_RW_LOCK(&context->lock);
if (closeFD)
context->fds_close_on_fork[fd / 8] |= (1 << (fd & 7));
else
+1
View File
@@ -4994,6 +4994,7 @@ vfs_new_io_context(const io_context* parentContext, bool purgeCloseOnExec)
context->ref_count = 1;
rw_lock_init(&context->lock, "I/O context");
WriteLocker contextLocker(context->lock);
ReadLocker parentLocker;
size_t tableSize;