summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/fs.go
diff options
context:
space:
mode:
authorSebastian Lackner2019-01-15 11:35:20 +0100
committerrfjakob2019-01-15 22:07:37 +0100
commit8f331456511a14d8d936bd4bdc60c4bf587b4d3a (patch)
tree33a59807a98a7d688615627c9fc110a79cb610a1 /internal/fusefrontend/fs.go
parentd8bb223dd3f3449b4a2d4962292bfa18e2f8b3b6 (diff)
fusefrontend: Print 'too many open files' warning for both short and long names.
While we're at it, also replace os.* constants with syscall.* constants.
Diffstat (limited to 'internal/fusefrontend/fs.go')
-rw-r--r--internal/fusefrontend/fs.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go
index 7492778..4c8af2d 100644
--- a/internal/fusefrontend/fs.go
+++ b/internal/fusefrontend/fs.go
@@ -254,23 +254,22 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte
return nil, fuse.ToStatus(err)
}
// Create content
- fd, err = syscallcompat.OpenatUser(dirfd, cName, newFlags|os.O_CREATE|os.O_EXCL, mode, context)
+ fd, err = syscallcompat.OpenatUser(dirfd, cName, newFlags|syscall.O_CREAT|syscall.O_EXCL, mode, context)
if err != nil {
nametransform.DeleteLongNameAt(dirfd, cName)
- return nil, fuse.ToStatus(err)
}
} else {
// Create content, normal (short) file name
fd, err = syscallcompat.OpenatUser(dirfd, cName, newFlags|syscall.O_CREAT|syscall.O_EXCL, mode, context)
- if err != nil {
- // xfstests generic/488 triggers this
- if err == syscall.EMFILE {
- var lim syscall.Rlimit
- syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim)
- tlog.Warn.Printf("Create %q: too many open files. Current \"ulimit -n\": %d", cName, lim.Cur)
- }
- return nil, fuse.ToStatus(err)
+ }
+ if err != nil {
+ // xfstests generic/488 triggers this
+ if err == syscall.EMFILE {
+ var lim syscall.Rlimit
+ syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim)
+ tlog.Warn.Printf("Create %q: too many open files. Current \"ulimit -n\": %d", cName, lim.Cur)
}
+ return nil, fuse.ToStatus(err)
}
f := os.NewFile(uintptr(fd), cName)
return NewFile(f, fs)