diff options
author | Jakob Unterwurzacher | 2018-11-12 22:22:10 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2019-01-01 16:24:25 +0100 |
commit | 60e7a0ca9f2a2bcf8a727f606db134d60e9a5e18 (patch) | |
tree | a318ec9b98f99313200a26edbce0ffab6b57582d /internal/fusefrontend/xattr_linux.go | |
parent | 1d5500c3db3b4b1f5a5fbc49c7934d3665739a0a (diff) |
fusefrontend: xattr: fix hang on FIFOs
An Open() a fifo blocks until it is opened for writing.
This meant that xattr operations on FIFOs would block.
Pass O_NONBLOCK to fix that, and add a test.
Diffstat (limited to 'internal/fusefrontend/xattr_linux.go')
-rw-r--r-- | internal/fusefrontend/xattr_linux.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/fusefrontend/xattr_linux.go b/internal/fusefrontend/xattr_linux.go index 915713d..a96a147 100644 --- a/internal/fusefrontend/xattr_linux.go +++ b/internal/fusefrontend/xattr_linux.go @@ -35,11 +35,12 @@ func procFd(fd int) string { // getFileFd calls fs.Open() on relative plaintext path "relPath" and returns // the resulting fusefrontend.*File along with the underlying fd. The caller -// MUST call file.Release() when done with the file. +// MUST call file.Release() when done with the file. The O_NONBLOCK flag is +// used to not block on FIFOs. // // Used by xattrGet() and friends. func (fs *FS) getFileFd(relPath string, context *fuse.Context) (*File, int, fuse.Status) { - fuseFile, status := fs.Open(relPath, syscall.O_RDONLY, context) + fuseFile, status := fs.Open(relPath, syscall.O_RDONLY|syscall.O_NONBLOCK, context) if !status.Ok() { return nil, -1, status } |