From 55dfca079f7d8fe8bf8a3425578b3718b79e41b6 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Thu, 15 Jun 2023 09:56:46 +0800 Subject: [PATCH] fs: modify or remove sched_[un]lock Signed-off-by: hujun5 --- fs/aio/aio_cancel.c | 2 -- fs/mqueue/mq_unlink.c | 3 --- fs/procfs/fs_procfs.c | 3 --- fs/semaphore/sem_open.c | 11 ----------- fs/semaphore/sem_unlink.c | 3 --- 5 files changed, 22 deletions(-) diff --git a/fs/aio/aio_cancel.c b/fs/aio/aio_cancel.c index ac8b4119a9cfc..a3a6ca9cd9297 100644 --- a/fs/aio/aio_cancel.c +++ b/fs/aio/aio_cancel.c @@ -100,7 +100,6 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp) */ ret = AIO_ALLDONE; - sched_lock(); aio_lock(); if (aiocbp) @@ -220,7 +219,6 @@ int aio_cancel(int fildes, FAR struct aiocb *aiocbp) } aio_unlock(); - sched_unlock(); return ret; } diff --git a/fs/mqueue/mq_unlink.c b/fs/mqueue/mq_unlink.c index 9360ca2f7f90a..95e92dea64f4b 100644 --- a/fs/mqueue/mq_unlink.c +++ b/fs/mqueue/mq_unlink.c @@ -112,7 +112,6 @@ int file_mq_unlink(FAR const char *mq_name) SETUP_SEARCH(&desc, fullpath, false); - sched_lock(); ret = inode_find(&desc); if (ret < 0) { @@ -175,7 +174,6 @@ int file_mq_unlink(FAR const char *mq_name) inode_unlock(); mq_inode_release(inode); RELEASE_SEARCH(&desc); - sched_unlock(); return OK; errout_with_lock: @@ -186,7 +184,6 @@ int file_mq_unlink(FAR const char *mq_name) errout_with_search: RELEASE_SEARCH(&desc); - sched_unlock(); return ret; } diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 74cd06924a63d..12522ec08243e 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -1172,8 +1172,6 @@ int procfs_register(FAR const struct procfs_entry_s *entry) newcount = g_procfs_entrycount + 1; newsize = newcount * sizeof(struct procfs_entry_s); - sched_lock(); - newtable = (FAR struct procfs_entry_s *) kmm_realloc(g_procfs_entries, newsize); if (newtable != NULL) @@ -1190,7 +1188,6 @@ int procfs_register(FAR const struct procfs_entry_s *entry) ret = OK; } - sched_unlock(); return ret; } #endif diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index 7ba1a7cb9fd7c..4e0014f5d3826 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -103,15 +103,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...) DEBUGASSERT(name != NULL); - /* The POSIX specification requires that the "check for the existence - * of a semaphore and the creation of the semaphore if it does not - * exist shall be atomic with respect to other processes executing - * sem_open()..." A simple sched_lock() should be sufficient to meet - * this requirement. - */ - - sched_lock(); - /* Get the full path to the semaphore */ snprintf(fullpath, MAX_SEMPATH, @@ -239,7 +230,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...) } RELEASE_SEARCH(&desc); - sched_unlock(); return sem; errout_with_inode: @@ -248,7 +238,6 @@ FAR sem_t *sem_open(FAR const char *name, int oflags, ...) errout_with_lock: RELEASE_SEARCH(&desc); set_errno(errcode); - sched_unlock(); return SEM_FAILED; } diff --git a/fs/semaphore/sem_unlink.c b/fs/semaphore/sem_unlink.c index f363c2a534f47..785d94292235c 100644 --- a/fs/semaphore/sem_unlink.c +++ b/fs/semaphore/sem_unlink.c @@ -78,7 +78,6 @@ int sem_unlink(FAR const char *name) SETUP_SEARCH(&desc, fullpath, false); - sched_lock(); ret = inode_find(&desc); if (ret < 0) { @@ -143,7 +142,6 @@ int sem_unlink(FAR const char *name) inode_unlock(); ret = sem_close(&inode->u.i_nsem->ns_sem); RELEASE_SEARCH(&desc); - sched_unlock(); return ret; errout_with_lock: @@ -155,6 +153,5 @@ int sem_unlink(FAR const char *name) errout_with_search: RELEASE_SEARCH(&desc); set_errno(errcode); - sched_unlock(); return ERROR; }