summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-05-03 23:46:52 +0200
committerJakob Unterwurzacher2017-05-03 23:46:52 +0200
commitc52e1abc5869dd27a28f71ff43ec4e1c1917acf4 (patch)
tree2ce95ae3c1edac0d2ff84c3584eb96fb6a42f67b
parentb32fc212afebd5014cc037f046a6a7fa75c154a3 (diff)
fusefrontend: log "too many open files" errors
This usually indicates that the open file limit for gocryptfs is too low. We should report this to the user.
-rw-r--r--internal/fusefrontend/fs.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index 5e5157c..c589302 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -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)
}