From ad4fa177fa9b3931c5460dc47cb8b62630c01705 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 19 May 2006 02:45:13 +0000 Subject: [PATCH] Fix race in dir_reopen(). Thanks to Godmar Back for pointing this out (twice). --- solutions/p4.patch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/solutions/p4.patch b/solutions/p4.patch index 9e11e25..7ab0046 100644 --- a/solutions/p4.patch +++ b/solutions/p4.patch @@ -726,7 +726,7 @@ diff -u src/filesys/directory.c~ src/filesys/directory.c return dir != NULL; } -@@ -61,22 +99,34 @@ dir_open_root (struct dir **dirp) +@@ -61,22 +99,36 @@ dir_open_root (struct dir **dirp) return dir_open (inode_open (ROOT_DIR_SECTOR), dirp); } @@ -734,7 +734,9 @@ diff -u src/filesys/directory.c~ src/filesys/directory.c +bool +dir_reopen (struct dir *dir) +{ ++ lock_acquire (&dir->dir_lock); + dir->open_cnt++; ++ lock_release (&dir->dir_lock); + return true; +} + -- 2.30.2