From 43c8f9d8c2392deaa42309703f8a0d4636d24fd4 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Tue, 9 Jun 2015 13:25:28 +1000 Subject: [PATCH] Fixed a bug in forgetfs. This manifested as ForgetFSTest.MkDir pacicking now and then in a manner like this: https://gist.githubusercontent.com/jacobsa/2d12150beca1043f71b0/raw/28e0a01a9276799ad820970a05b522367222c331/gistfile1.txt --- samples/forgetfs/forget_fs.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/samples/forgetfs/forget_fs.go b/samples/forgetfs/forget_fs.go index d0b934b..eae5c4a 100644 --- a/samples/forgetfs/forget_fs.go +++ b/samples/forgetfs/forget_fs.go @@ -66,6 +66,13 @@ func NewFileSystem() (fs *ForgetFS) { // The root inode starts with a lookup count of one. impl.inodes[cannedID_Root].IncrementLookupCount() + // The canned inodes are supposed to be stable from the user's point of view, + // so we should allow them to be looked up at any point even if the kernel + // has balanced its lookups with its forgets. Ensure that they never go to + // zero until the file system is destroyed. + impl.inodes[cannedID_Foo].IncrementLookupCount() + impl.inodes[cannedID_Bar].IncrementLookupCount() + // Set up the mutex. impl.mu = syncutil.NewInvariantMutex(impl.checkInvariants)