From 60e7a0ca9f2a2bcf8a727f606db134d60e9a5e18 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 12 Nov 2018 22:22:10 +0100 Subject: 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. --- internal/fusefrontend/xattr_linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'internal/fusefrontend/xattr_linux.go') 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 } -- cgit v1.2.3