Commit 98229206 authored by Kirill Smelkov's avatar Kirill Smelkov Committed by Han-Wen Nienhuys

fuse: Add FOPEN_STREAM

FOPEN_STREAM, together with FOPEN_NONSEEKABLE must be used on
stream-like file handles that provide both read and write to avoid
hitting deadlock in the kernel.

Please see the following kernel patch for details on how the deadlock
can happen:

	git.kernel.org/linus/10dce8af3422

Adding FOPEN_STREAM to kernel FUSE is in fuse.git#for-next now and is likely
to enter mainline kernel when 5.2 merge window opens way or another:

	https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/commit/?id=bbd84f33652
	https://lore.kernel.org/linux-fsdevel/CAHk-=whQQdoQsgEx1vO7OkfPDcV5hurPnMRLgzfXAPN63n5Sbg@mail.gmail.com/
	https://lore.kernel.org/linux-fsdevel/CAHk-=wjEOyba5As1PEMk6RitNVOJH9oJ_Jbg4y=5B0fcX1iKGw@mail.gmail.com/
	https://lore.kernel.org/linux-fsdevel/CAHk-=wgh234SyBG810=vB360PCzVkAhQRqGg8aFdATZd+daCFw@mail.gmail.com/
	https://lore.kernel.org/linux-fsdevel/20190424183012.GB3798@deco.navytux.spb.ru/

Here is example for FOPEN_STREAM usage:

	https://lab.nexedi.com/kirr/wendelin.core/blob/7783ecf4/wcfs/misc.go#L327-335
	https://lab.nexedi.com/kirr/wendelin.core/blob/7783ecf4/wcfs/misc.go#L276-428
parent 698ea1ab
...@@ -69,6 +69,7 @@ var ( ...@@ -69,6 +69,7 @@ var (
FOPEN_KEEP_CACHE: "CACHE", FOPEN_KEEP_CACHE: "CACHE",
FOPEN_NONSEEKABLE: "NONSEEK", FOPEN_NONSEEKABLE: "NONSEEK",
FOPEN_CACHE_DIR: "CACHE_DIR", FOPEN_CACHE_DIR: "CACHE_DIR",
FOPEN_STREAM: "STREAM",
} }
accessFlagName = map[int64]string{ accessFlagName = map[int64]string{
X_OK: "x", X_OK: "x",
......
...@@ -254,6 +254,7 @@ const ( ...@@ -254,6 +254,7 @@ const (
FOPEN_KEEP_CACHE = (1 << 1) FOPEN_KEEP_CACHE = (1 << 1)
FOPEN_NONSEEKABLE = (1 << 2) FOPEN_NONSEEKABLE = (1 << 2)
FOPEN_CACHE_DIR = (1 << 3) FOPEN_CACHE_DIR = (1 << 3)
FOPEN_STREAM = (1 << 4)
) )
type OpenOut struct { type OpenOut struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment