Permalink
Browse files

Propagate fetch error to Open return status.

  • Loading branch information...
1 parent b03ad25 commit 4adaa44ed2ca90cfe2d82596d770171be2e7e7d7 @hanwen committed Jun 14, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 fs.go
View
6 fs.go
@@ -342,13 +342,17 @@ func (n *fileNode) fetch() error {
dt.Nanoseconds()/1e6, 1e3*float64(sz)/float64(dt.Nanoseconds()))
} else {
log.Printf("error fetching: %v", err)
+ err = syscall.EIO
}
return err
}
func (n *fileNode) Open(flags uint32, context *fuse.Context) (file fuse.File, code fuse.Status) {
- n.fetch()
+ err := n.fetch()
+ if err != nil {
+ return nil, fuse.ToStatus(err)
+ }
f, err := os.OpenFile(n.backing, int(flags), 0644)
if err != nil {
return nil, fuse.ToStatus(err)

0 comments on commit 4adaa44

Please sign in to comment.