Skip to content

Commit

Permalink
fusefrontend: log "too many open files" errors
Browse files Browse the repository at this point in the history
This usually indicates that the open file limit for gocryptfs is
too low. We should report this to the user.
  • Loading branch information
rfjakob committed May 3, 2017
1 parent b32fc21 commit c52e1ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/fusefrontend/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ func (fs *FS) Open(path string, flags uint32, context *fuse.Context) (fuseFile n
tlog.Debug.Printf("Open: %s", cPath)
f, err := os.OpenFile(cPath, newFlags, 0666)
if err != nil {
err2 := err.(*os.PathError)
if err2.Err == syscall.EMFILE {
var lim syscall.Rlimit
syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim)
tlog.Warn.Printf("Open %q: too many open files. Current \"ulimit -n\": %d", cPath, lim.Cur)
}
return nil, fuse.ToStatus(err)
}

Expand Down

0 comments on commit c52e1ab

Please sign in to comment.