我按照你提示先c.Close() 再c.mountinfo.SyncFs(),但是仍然报错runtime.cgocall(0x1e985a0, 0xc0010552c0) /usr/local/go/src/runtime/cgocall.go:157 +0x5c fp=0xc001055298 sp=0xc001055260 pc=0x40bdfc github.com/ceph/go-ceph/cephfs._Cfunc_ceph_is_mounted(0x0) _cgo_gotypes.go:664 +0x4c fp=0xc0010552c0 sp=0xc001055298 pc=0x99662c github.com/ceph/go-ceph/cephfs.(*MountInfo).IsMounted.func1(0x7f905805c230?) /home/ibu/cy/etp-server/vendor/github.com/ceph/go-ceph/cephfs/cephfs.go:234 +0x46 fp=0xc0010552f8 sp=0xc0010552c0 pc=0x99a746 github.com/ceph/go-ceph/cephfs.(*MountInfo).IsMounted(0x2a0fb00?) /home/ibu/cy/etp-server/vendor/github.com/ceph/go-ceph/cephfs/cephfs.go:234 +0x19 fp=0xc001055310 sp=0xc0010552f8 pc=0x99a6d9 etp-server/pkg/ceph.(*CephFSClientSet).Close(0xc00114ac30) /home/ibu/cy/etp-server/pkg/ceph/ceph.go:100 +0x2a fp=0xc001055328 sp=0xc001055310 pc=0x9a5daa etp-server/pkg/ceph.(*CephFSClientSet).Close(0xc00114ac30) /home/ibu/cy/etp-server/pkg/ceph/ceph.go:103 +0x54 fp=0xc001055340 sp=0xc001055328 pc=0x9a5dd4
时间: 2023-06-30 19:16:22 浏览: 300
这个错误可能是由于 CephFS 文件系统客户端关闭时出现异常导致的。你可以尝试在关闭客户端之前,添加一些检查和处理异常的代码,以确保客户端能够正常关闭,例如:
```go
func (c *CephFSClientSet) Close() error {
if c == nil {
return nil
}
if err := c.mountinfo.Unmount(); err != nil {
return err
}
if err := c.mountinfo.Release(); err != nil {
return err
}
if err := c.mountinfo.SyncFs(); err != nil {
return err
}
if err := c.fs.Shutdown(); err != nil {
return err
}
c.fs = nil
c.mountinfo = nil
return nil
}
```
这样可以确保在关闭文件系统客户端时,能够处理任何可能出现的异常。如果问题仍然存在,你可以尝试调试程序,检查异常的来源并进行处理。
阅读全文