Commit b9d45b55 authored by Ivan Krasin's avatar Ivan Krasin

Crash reproduced on a smaller range. I don't call any system call here, so the...

Crash reproduced on a smaller range. I don't call any system call here, so the problem supposed to be located
parent a6dfd5ae
...@@ -87,11 +87,12 @@ func (m *MountPoint) loop() { ...@@ -87,11 +87,12 @@ func (m *MountPoint) loop() {
break break
} }
go m.handle(buf[0:n], toW, errors) go handle(m.fs, buf[0:n], toW, errors)
} }
} }
func (m *MountPoint) handle(in_data []byte, toW chan [][]byte, errors chan os.Error) { func handle(fs FileSystem, in_data []byte, toW chan [][]byte, errors chan os.Error) {
fmt.Printf("in_data: %v\n", in_data)
r := bytes.NewBuffer(in_data) r := bytes.NewBuffer(in_data)
h := new(InHeader) h := new(InHeader)
err := binary.Read(r, binary.LittleEndian, h) err := binary.Read(r, binary.LittleEndian, h)
...@@ -113,7 +114,7 @@ func (m *MountPoint) handle(in_data []byte, toW chan [][]byte, errors chan os.Er ...@@ -113,7 +114,7 @@ func (m *MountPoint) handle(in_data []byte, toW chan [][]byte, errors chan os.Er
} }
fmt.Printf("in: %v\n", in) fmt.Printf("in: %v\n", in)
var init_out *InitOut var init_out *InitOut
init_out, result = m.fs.Init(in) init_out, result = fs.Init(in)
if init_out != nil { if init_out != nil {
out = init_out out = init_out
} }
......
...@@ -30,6 +30,13 @@ func (fs *testFuse) Init(in *InitIn) (out *InitOut, code Error) { ...@@ -30,6 +30,13 @@ func (fs *testFuse) Init(in *InitIn) (out *InitOut, code Error) {
func TestMount(t *testing.T) { func TestMount(t *testing.T) {
fs := new(testFuse) fs := new(testFuse)
toW := make(chan [][]byte, 100)
errors := make(chan os.Error, 100)
in_data := []byte { 56, 0, 0, 0, 26, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 13, 0, 0, 0, 0, 0, 2, 0, 123, 0, 0, 0, }
handle(fs, in_data, toW, errors)
return
err := os.Mkdir(tempMountDir, 0777) err := os.Mkdir(tempMountDir, 0777)
if err != nil { if err != nil {
t.Fatalf("Can't create temp mount dir at %s, err: %v", tempMountDir, err) t.Fatalf("Can't create temp mount dir at %s, err: %v", tempMountDir, err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment