Fixed a bug in forgetfs.

This manifested as ForgetFSTest.MkDir pacicking now and then in a manner
like this:

    28e0a01a92/gistfile1.txt
geesefs-0-30-9
Aaron Jacobs 2015-06-09 13:25:28 +10:00
parent 0f62458e21
commit 43c8f9d8c2
1 changed files with 7 additions and 0 deletions

View File

@ -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)