aboutsummaryrefslogtreecommitdiff
path: root/tools/virtiofsd/helper.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2018-11-14 16:52:03 +0100
committerDr. David Alan Gilbert <dgilbert@redhat.com>2020-01-23 16:41:36 +0000
commit5fe319a7b19c9c328e6e061bffcf1ff6cc8b89ce (patch)
tree258008123741e2d70ad0e23185b8c04b6720df31 /tools/virtiofsd/helper.c
parent73b4d19dfc4248a74c1f3e511cfa934681d9c602 (diff)
virtiofsd: passthrough_ll: add fallback for racy ops
We have two operations that cannot be done race-free on a symlink in certain cases: utimes and link. Add racy fallback for these if the race-free method doesn't work. We do our best to avoid races even in this case: - get absolute path by reading /proc/self/fd/NN symlink - lookup parent directory: after this we are safe against renames in ancestors - lookup name in parent directory, and verify that we got to the original inode, if not retry the whole thing Both utimes(2) and link(2) hold i_lock on the inode across the operation, so a racing rename/delete by this fuse instance is not possible, only from other entities changing the filesystem. If the "norace" option is given, then disable the racy fallbacks. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'tools/virtiofsd/helper.c')
-rw-r--r--tools/virtiofsd/helper.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
index b8ec5ac8dc..5531425223 100644
--- a/tools/virtiofsd/helper.c
+++ b/tools/virtiofsd/helper.c
@@ -142,7 +142,10 @@ void fuse_cmdline_help(void)
" --daemonize run in background\n"
" -o max_idle_threads the maximum number of idle worker "
"threads\n"
- " allowed (default: 10)\n");
+ " allowed (default: 10)\n"
+ " -o norace disable racy fallback\n"
+ " default: false\n"
+ );
}
static int fuse_helper_opt_proc(void *data, const char *arg, int key,