From aedb72246b161e4087a556e2e409e866650c315d Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Sun, 24 Nov 2024 15:41:18 +0000 Subject: [PATCH] fix: do not acquire filesys_lock for tell and seek --- src/userprog/syscall.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 2f07d1b..3efe7b5 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -348,12 +348,7 @@ syscall_seek (int fd, unsigned position) /* Find the file from the FD. If it does not exist, do nothing. */ struct open_file *file_info = fd_get_file (fd); if (file_info != NULL) - { - /* File exists: Acquire the file system lock to prevent race conditions. */ - lock_acquire (&filesys_lock); file_seek (file_info->file, position); - lock_release (&filesys_lock); - } } /* Handles the syscall for returning the next byte in a file referenced by @@ -367,10 +362,7 @@ syscall_tell (int fd) if (file_info == NULL) return 0; - /* Acquire the file system lock to prevent race conditions. */ - lock_acquire (&filesys_lock); unsigned pos = file_tell (file_info->file); - lock_release (&filesys_lock); /* Return the current position in the file. */ return pos; -- 2.49.1