Notify kernel of creation of new workspace multifs.

To test this, set attribute/entry TTLs of the test mount.

Change-Id: I31c92e3a5f046a720171703b2d61d069d8f54549
diff --git a/fs/gitilesfs_test.go b/fs/gitilesfs_test.go
index 42bcef7..c568e35 100644
--- a/fs/gitilesfs_test.go
+++ b/fs/gitilesfs_test.go
@@ -29,6 +29,7 @@
 	"strings"
 	"syscall"
 	"testing"
+	"time"
 
 	"github.com/google/gitfs/cache"
 	"github.com/google/gitfs/gitiles"
@@ -527,8 +528,14 @@
 		return err
 	}
 
+	fuseOpts := &nodefs.Options{
+		EntryTimeout:    time.Hour,
+		NegativeTimeout: time.Hour,
+		AttrTimeout:     time.Hour,
+	}
+
 	var err error
-	f.server, _, err = nodefs.MountRoot(f.mntDir, root, nil)
+	f.server, _, err = nodefs.MountRoot(f.mntDir, root, fuseOpts)
 	if err != nil {
 		return err
 	}
@@ -542,18 +549,13 @@
 	return nil
 }
 
-func TestMultiFS(t *testing.T) {
+func TestMultiFSBrokenXML(t *testing.T) {
 	fix, err := newTestFixture()
 	if err != nil {
 		t.Fatalf("newTestFixture: %v", err)
 	}
 	defer fix.cleanup()
 
-	xmlFile := filepath.Join(fix.dir, "manifest.xml")
-	if err := ioutil.WriteFile(xmlFile, []byte(testManifestXML), 0644); err != nil {
-		t.Errorf("WriteFile(%s): %v", xmlFile, err)
-	}
-
 	brokenXMLFile := filepath.Join(fix.dir, "broken.xml")
 	if err := ioutil.WriteFile(brokenXMLFile, []byte("I'm not XML."), 0644); err != nil {
 		t.Errorf("WriteFile(%s): %v", brokenXMLFile, err)
@@ -569,6 +571,26 @@
 	if err := os.Symlink(brokenXMLFile, filepath.Join(fix.mntDir, "config", "ws")); err == nil {
 		t.Fatalf("want error for broken XML file")
 	}
+}
+
+func TestMultiFSBasic(t *testing.T) {
+	fix, err := newTestFixture()
+	if err != nil {
+		t.Fatalf("newTestFixture: %v", err)
+	}
+	defer fix.cleanup()
+
+	xmlFile := filepath.Join(fix.dir, "manifest.xml")
+	if err := ioutil.WriteFile(xmlFile, []byte(testManifestXML), 0644); err != nil {
+		t.Errorf("WriteFile(%s): %v", xmlFile, err)
+	}
+
+	opts := MultiFSOptions{}
+	fs := NewMultiFS(fix.service, fix.cache, opts)
+
+	if err := fix.mount(fs); err != nil {
+		t.Fatalf("mount: %v", err)
+	}
 
 	wsDir := filepath.Join(fix.mntDir, "ws")
 	if fi, err := os.Lstat(wsDir); err == nil {
diff --git a/fs/multifs.go b/fs/multifs.go
index 444b49a..c8edfcb 100644
--- a/fs/multifs.go
+++ b/fs/multifs.go
@@ -126,8 +126,8 @@
 	}
 	fs.(*manifestFSRoot).nodeCache = c.root.nodeCache
 
-	ch := c.root.Inode().NewChild(name, true, fs)
-	if ch == nil {
+	child := c.root.Inode().NewChild(name, true, fs)
+	if child == nil {
 		// TODO(hanwen): can this ever happen?
 		return nil, fuse.EINVAL
 	}
@@ -140,12 +140,14 @@
 
 	if err := fs.(*manifestFSRoot).onMount(c.root.fsConn); err != nil {
 		log.Println("onMount(%s): %v", name, err)
-		for k := range ch.Children() {
-			ch.RmChild(k)
+		for k := range child.Children() {
+			child.RmChild(k)
 		}
 
-		ch.NewChild("ERROR", false, &dataNode{nodefs.NewDefaultNode(), []byte(err.Error())})
+		child.NewChild("ERROR", false, &dataNode{nodefs.NewDefaultNode(), []byte(err.Error())})
 	}
 
+	c.root.fsConn.EntryNotify(c.root.Inode(), name)
+
 	return config, fuse.OK
 }