Skip to contentSkip to conversation

virtiofs daemon [all]

PATCH In review Dr. David Alan Gilbert (git) 6 participants 141 messages Jan 21, 2020 – Jan 24, 2020 Page 2 of 2

Subsystems (2)
lore
Share & tools
lore
#58 lore raw

PATCH v2 51/109 virtiofsd: add seccomp whitelist

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Only allow system calls that are needed by virtiofsd. All other system calls cause SIGSYS to be directed at the thread and the process will coredump.

Restricting system calls reduces the kernel attack surface and limits what the process can do when compromised.

with additional entries by:

---
 Makefile                         |   2 +-
 tools/virtiofsd/Makefile.objs    |   5 +-
 tools/virtiofsd/passthrough_ll.c |   2 +
 tools/virtiofsd/seccomp.c        | 150 +++++++++++++++++++++++++++++++
 tools/virtiofsd/seccomp.h        |  14 +++
 5 files changed, 171 insertions(+), 2 deletions(-)
 create mode 100644 tools/virtiofsd/seccomp.c
 create mode 100644 tools/virtiofsd/seccomp.h
Makefile +1 -1
index a87e06ad93..967d59c98a 100644
@@ -327,7 +327,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF)
 vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
 endif
 
-ifdef CONFIG_LINUX
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP),yy)
 HELPERS-y += virtiofsd$(EXESUF)
 vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
 endif
tools/virtiofsd/Makefile.objs +4 -1
index 45a807500d..076f667e46 100644
@@ -5,5 +5,8 @@ virtiofsd-obj-y = buffer.o \
                   fuse_signals.o \
                   fuse_virtio.o \
                   helper.o \
-                  passthrough_ll.o
+                  passthrough_ll.o \
+                  seccomp.o
 
+seccomp.o-cflags := $(SECCOMP_CFLAGS)
+seccomp.o-libs := $(SECCOMP_LIBS)
tools/virtiofsd/passthrough_ll.c +2 -0
index 752beb459a..8748e64f33 100644
@@ -58,6 +58,7 @@
 #include <unistd.h>
 
 #include "passthrough_helpers.h"
+#include "seccomp.h"
 
 struct lo_map_elem {
     union {
@@ -2090,6 +2091,7 @@ static void setup_sandbox(struct lo_data *lo, struct fuse_session *se)
 {
     setup_namespaces(lo, se);
     setup_mounts(lo->source);
+    setup_seccomp();
 }
 
 int main(int argc, char *argv[])
tools/virtiofsd/seccomp.c new file +150 -0

150 lines not on this page · raw message

tools/virtiofsd/seccomp.h new file +14 -0
new file mode 100644
index 0000000000..86bce72652
@@ -0,0 +1,14 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef VIRTIOFSD_SECCOMP_H
+#define VIRTIOFSD_SECCOMP_H
+
+void setup_seccomp(void);
+
+#endif /* VIRTIOFSD_SECCOMP_H */
Signature · 1 line
2.24.1
#59 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

Quoted 33 lines · Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Only allow system calls that are needed by virtiofsd. All other system calls cause SIGSYS to be directed at the thread and the process will coredump.

Restricting system calls reduces the kernel attack surface and limits what the process can do when compromised.

with additional entries by:

---
  Makefile                         |   2 +-
  tools/virtiofsd/Makefile.objs    |   5 +-
  tools/virtiofsd/passthrough_ll.c |   2 +
  tools/virtiofsd/seccomp.c        | 150 +++++++++++++++++++++++++++++++
  tools/virtiofsd/seccomp.h        |  14 +++
  5 files changed, 171 insertions(+), 2 deletions(-)

create mode 100644 tools/virtiofsd/seccomp.c
create mode 100644 tools/virtiofsd/seccomp.h

Makefile +0 -0
index a87e06ad93..967d59c98a 100644

Makefile HELPERS-y += vhost-user-gpu$(EXESUF) · line 331

Quoted 6 lines
Makefile +1 -1
@@ -327,7 +327,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF)
  vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
  endif
 
-ifdef CONFIG_LINUX
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP),yy)
  HELPERS-y += virtiofsd$(EXESUF)

Something is weird here, because I got:

$ make virtiofsd
  ...
  CC      tools/virtiofsd/seccomp.o
tools/virtiofsd/seccomp.c:14:21: fatal error: seccomp.h: No such file or directory
 #include <seccomp.h>
                     ^

Indeed I don't have libseccomp installed, ./configure reported:

...
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
debug stack usage no
...

Note also:

$ make print-CONFIG_LINUX
CONFIG_LINUX=y
$ make print-CONFIG_SECCOMP
CONFIG_SECCOMP=
$ make print-CONFIG_LIBCAP_NG
CONFIG_LIBCAP_NG=y
$ make print-HELPERS-y
HELPERS-y=qemu-bridge-helper
Quoted 213 lines
Makefile +0 -0
  vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
  endif
tools/virtiofsd/Makefile.objs +4 -1
index 45a807500d..076f667e46 100644
@@ -5,5 +5,8 @@ virtiofsd-obj-y = buffer.o \
                    fuse_signals.o \
                    fuse_virtio.o \
                    helper.o \
-                  passthrough_ll.o
+                  passthrough_ll.o \
+                  seccomp.o
 
+seccomp.o-cflags := $(SECCOMP_CFLAGS)
+seccomp.o-libs := $(SECCOMP_LIBS)
tools/virtiofsd/passthrough_ll.c +2 -0
index 752beb459a..8748e64f33 100644
@@ -58,6 +58,7 @@
  #include <unistd.h>
 
  #include "passthrough_helpers.h"
+#include "seccomp.h"
 
  struct lo_map_elem {
      union {
@@ -2090,6 +2091,7 @@ static void setup_sandbox(struct lo_data *lo, struct fuse_session *se)
  {
      setup_namespaces(lo, se);
      setup_mounts(lo->source);
+    setup_seccomp();
  }
 
  int main(int argc, char *argv[])
tools/virtiofsd/seccomp.c new file +150 -0
new file mode 100644
index 0000000000..2aa4d3cc66
@@ -0,0 +1,150 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "seccomp.h"
+#include "fuse_i.h"
+#include "fuse_log.h"
+#include <errno.h>
+#include <glib.h>
+#include <seccomp.h>
+#include <stdlib.h>
+
+/* Bodge for libseccomp 2.4.2 which broke ppoll */
+#if !defined(__SNR_ppoll) && defined(__SNR_brk)
+#ifdef __NR_ppoll
+#define __SNR_ppoll __NR_ppoll
+#else
+#define __SNR_ppoll __PNR_ppoll
+#endif
+#endif
+
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
+    SCMP_SYS(clone),
+#ifdef __NR_clone3
+    SCMP_SYS(clone3),
+#endif
+    SCMP_SYS(close),
+    SCMP_SYS(copy_file_range),
+    SCMP_SYS(dup),
+    SCMP_SYS(eventfd2),
+    SCMP_SYS(exit),
+    SCMP_SYS(exit_group),
+    SCMP_SYS(fallocate),
+    SCMP_SYS(fchmodat),
+    SCMP_SYS(fchownat),
+    SCMP_SYS(fcntl),
+    SCMP_SYS(fdatasync),
+    SCMP_SYS(fgetxattr),
+    SCMP_SYS(flistxattr),
+    SCMP_SYS(flock),
+    SCMP_SYS(fremovexattr),
+    SCMP_SYS(fsetxattr),
+    SCMP_SYS(fstat),
+    SCMP_SYS(fstatfs),
+    SCMP_SYS(fsync),
+    SCMP_SYS(ftruncate),
+    SCMP_SYS(futex),
+    SCMP_SYS(getdents),
+    SCMP_SYS(getdents64),
+    SCMP_SYS(getegid),
+    SCMP_SYS(geteuid),
+    SCMP_SYS(getpid),
+    SCMP_SYS(gettid),
+    SCMP_SYS(gettimeofday),
+    SCMP_SYS(linkat),
+    SCMP_SYS(lseek),
+    SCMP_SYS(madvise),
+    SCMP_SYS(mkdirat),
+    SCMP_SYS(mknodat),
+    SCMP_SYS(mmap),
+    SCMP_SYS(mprotect),
+    SCMP_SYS(mremap),
+    SCMP_SYS(munmap),
+    SCMP_SYS(newfstatat),
+    SCMP_SYS(open),
+    SCMP_SYS(openat),
+    SCMP_SYS(ppoll),
+    SCMP_SYS(prctl), /* TODO restrict to just PR_SET_NAME? */
+    SCMP_SYS(preadv),
+    SCMP_SYS(pread64),
+    SCMP_SYS(pwritev),
+    SCMP_SYS(pwrite64),
+    SCMP_SYS(read),
+    SCMP_SYS(readlinkat),
+    SCMP_SYS(recvmsg),
+    SCMP_SYS(renameat),
+    SCMP_SYS(renameat2),
+    SCMP_SYS(rt_sigaction),
+    SCMP_SYS(rt_sigprocmask),
+    SCMP_SYS(rt_sigreturn),
+    SCMP_SYS(sendmsg),
+    SCMP_SYS(setresgid),
+    SCMP_SYS(setresuid),
+#ifdef __NR_setresgid32
+    SCMP_SYS(setresgid32),
+#endif
+#ifdef __NR_setresuid32
+    SCMP_SYS(setresuid32),
+#endif
+    SCMP_SYS(set_robust_list),
+    SCMP_SYS(symlinkat),
+    SCMP_SYS(time), /* Rarely needed, except on static builds */
+    SCMP_SYS(tgkill),
+    SCMP_SYS(unlinkat),
+    SCMP_SYS(utimensat),
+    SCMP_SYS(write),
+    SCMP_SYS(writev),
+};
+
+void setup_seccomp(void)
+{
+    scmp_filter_ctx ctx;
+    size_t i;
+
+#ifdef SCMP_ACT_KILL_PROCESS
+    ctx = seccomp_init(SCMP_ACT_KILL_PROCESS);
+    /* Handle a newer libseccomp but an older kernel */
+    if (!ctx && errno == EOPNOTSUPP) {
+        ctx = seccomp_init(SCMP_ACT_TRAP);
+    }
+#else
+    ctx = seccomp_init(SCMP_ACT_TRAP);
+#endif
+    if (!ctx) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_init() failed\n");
+        exit(1);
+    }
+
+    for (i = 0; i < G_N_ELEMENTS(syscall_whitelist); i++) {
+        if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW,
+                             syscall_whitelist[i], 0) != 0) {
+            fuse_log(FUSE_LOG_ERR, "seccomp_rule_add syscall %d",
+                     syscall_whitelist[i]);
+            exit(1);
+        }
+    }
+
+    /* libvhost-user calls this for post-copy migration, we don't need it */
+    if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(ENOSYS),
+                         SCMP_SYS(userfaultfd), 0) != 0) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_rule_add userfaultfd failed\n");
+        exit(1);
+    }
+
+    if (seccomp_load(ctx) < 0) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_load() failed\n");
+        exit(1);
+    }
+
+    seccomp_release(ctx);
+}
tools/virtiofsd/seccomp.h new file +14 -0
new file mode 100644
index 0000000000..86bce72652
@@ -0,0 +1,14 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef VIRTIOFSD_SECCOMP_H
+#define VIRTIOFSD_SECCOMP_H
+
+void setup_seccomp(void);
+
+#endif /* VIRTIOFSD_SECCOMP_H */
#60 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

Quoted 62 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 33 lines · Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Only allow system calls that are needed by virtiofsd. All other system calls cause SIGSYS to be directed at the thread and the process will coredump.

Restricting system calls reduces the kernel attack surface and limits what the process can do when compromised.

with additional entries by:

---
  Makefile                         |   2 +-
  tools/virtiofsd/Makefile.objs    |   5 +-
  tools/virtiofsd/passthrough_ll.c |   2 +
  tools/virtiofsd/seccomp.c        | 150 +++++++++++++++++++++++++++++++
  tools/virtiofsd/seccomp.h        |  14 +++
  5 files changed, 171 insertions(+), 2 deletions(-)

create mode 100644 tools/virtiofsd/seccomp.c
create mode 100644 tools/virtiofsd/seccomp.h

Makefile +0 -0
index a87e06ad93..967d59c98a 100644

Makefile HELPERS-y += vhost-user-gpu$(EXESUF) · line 330

Quoted 5 lines
Makefile +1 -1
@@ -327,7 +327,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF)
  vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
  endif
-ifdef CONFIG_LINUX
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP),yy)
  HELPERS-y += virtiofsd$(EXESUF)

Something is weird here, because I got:

$ make virtiofsd
  ...
  CC      tools/virtiofsd/seccomp.o
tools/virtiofsd/seccomp.c:14:21: fatal error: seccomp.h: No such file or
directory
 #include <seccomp.h>
                     ^

Indeed I don't have libseccomp installed, ./configure reported:

...
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
debug stack usage no
...

Note also:

Quoted 8 lines
$ make print-CONFIG_LINUX
CONFIG_LINUX=y
$ make print-CONFIG_SECCOMP
CONFIG_SECCOMP=
$ make print-CONFIG_LIBCAP_NG
CONFIG_LIBCAP_NG=y
$ make print-HELPERS-y
HELPERS-y=qemu-bridge-helper

The same thing happens if you uninstall mesa-libgbm-devel and do a 'make vhost-user-gpu'

These ifeq's don't remove the definition of the target, they just remove it from the HELPERS-y list, so stop it being built on an unqualified 'make' but don't change the behaviour when you explicitly ask for the target.

Can you try:

Makefile +3 -2
index ba7e2e5ebc..346a981f0e 100644
@@ -676,8 +676,9 @@ vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
 rdmacm-mux$(EXESUF): LIBS += "-libumad"
 rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
        $(call LINK, $^)
-
-ifdef CONFIG_LINUX # relies on Linux-specific syscalls
+#
+# relies on Linux specific syscalls
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
 virtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS)
        $(call LINK, $^)
 endif
Quoted 201 lines
Quoted 201 lines
Makefile +0 -0
  vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
  endif
tools/virtiofsd/Makefile.objs +4 -1
index 45a807500d..076f667e46 100644
@@ -5,5 +5,8 @@ virtiofsd-obj-y = buffer.o \
                    fuse_signals.o \
                    fuse_virtio.o \
                    helper.o \
-                  passthrough_ll.o
+                  passthrough_ll.o \
+                  seccomp.o
+seccomp.o-cflags := $(SECCOMP_CFLAGS)
+seccomp.o-libs := $(SECCOMP_LIBS)
tools/virtiofsd/passthrough_ll.c +2 -0
index 752beb459a..8748e64f33 100644
@@ -58,6 +58,7 @@
  #include <unistd.h>
  #include "passthrough_helpers.h"
+#include "seccomp.h"
  struct lo_map_elem {
      union {
@@ -2090,6 +2091,7 @@ static void setup_sandbox(struct lo_data *lo, struct fuse_session *se)
  {
      setup_namespaces(lo, se);
      setup_mounts(lo->source);
+    setup_seccomp();
  }
  int main(int argc, char *argv[])
tools/virtiofsd/seccomp.c new file +150 -0
new file mode 100644
index 0000000000..2aa4d3cc66
@@ -0,0 +1,150 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "seccomp.h"
+#include "fuse_i.h"
+#include "fuse_log.h"
+#include <errno.h>
+#include <glib.h>
+#include <seccomp.h>
+#include <stdlib.h>
+
+/* Bodge for libseccomp 2.4.2 which broke ppoll */
+#if !defined(__SNR_ppoll) && defined(__SNR_brk)
+#ifdef __NR_ppoll
+#define __SNR_ppoll __NR_ppoll
+#else
+#define __SNR_ppoll __PNR_ppoll
+#endif
+#endif
+
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
+    SCMP_SYS(clone),
+#ifdef __NR_clone3
+    SCMP_SYS(clone3),
+#endif
+    SCMP_SYS(close),
+    SCMP_SYS(copy_file_range),
+    SCMP_SYS(dup),
+    SCMP_SYS(eventfd2),
+    SCMP_SYS(exit),
+    SCMP_SYS(exit_group),
+    SCMP_SYS(fallocate),
+    SCMP_SYS(fchmodat),
+    SCMP_SYS(fchownat),
+    SCMP_SYS(fcntl),
+    SCMP_SYS(fdatasync),
+    SCMP_SYS(fgetxattr),
+    SCMP_SYS(flistxattr),
+    SCMP_SYS(flock),
+    SCMP_SYS(fremovexattr),
+    SCMP_SYS(fsetxattr),
+    SCMP_SYS(fstat),
+    SCMP_SYS(fstatfs),
+    SCMP_SYS(fsync),
+    SCMP_SYS(ftruncate),
+    SCMP_SYS(futex),
+    SCMP_SYS(getdents),
+    SCMP_SYS(getdents64),
+    SCMP_SYS(getegid),
+    SCMP_SYS(geteuid),
+    SCMP_SYS(getpid),
+    SCMP_SYS(gettid),
+    SCMP_SYS(gettimeofday),
+    SCMP_SYS(linkat),
+    SCMP_SYS(lseek),
+    SCMP_SYS(madvise),
+    SCMP_SYS(mkdirat),
+    SCMP_SYS(mknodat),
+    SCMP_SYS(mmap),
+    SCMP_SYS(mprotect),
+    SCMP_SYS(mremap),
+    SCMP_SYS(munmap),
+    SCMP_SYS(newfstatat),
+    SCMP_SYS(open),
+    SCMP_SYS(openat),
+    SCMP_SYS(ppoll),
+    SCMP_SYS(prctl), /* TODO restrict to just PR_SET_NAME? */
+    SCMP_SYS(preadv),
+    SCMP_SYS(pread64),
+    SCMP_SYS(pwritev),
+    SCMP_SYS(pwrite64),
+    SCMP_SYS(read),
+    SCMP_SYS(readlinkat),
+    SCMP_SYS(recvmsg),
+    SCMP_SYS(renameat),
+    SCMP_SYS(renameat2),
+    SCMP_SYS(rt_sigaction),
+    SCMP_SYS(rt_sigprocmask),
+    SCMP_SYS(rt_sigreturn),
+    SCMP_SYS(sendmsg),
+    SCMP_SYS(setresgid),
+    SCMP_SYS(setresuid),
+#ifdef __NR_setresgid32
+    SCMP_SYS(setresgid32),
+#endif
+#ifdef __NR_setresuid32
+    SCMP_SYS(setresuid32),
+#endif
+    SCMP_SYS(set_robust_list),
+    SCMP_SYS(symlinkat),
+    SCMP_SYS(time), /* Rarely needed, except on static builds */
+    SCMP_SYS(tgkill),
+    SCMP_SYS(unlinkat),
+    SCMP_SYS(utimensat),
+    SCMP_SYS(write),
+    SCMP_SYS(writev),
+};
+
+void setup_seccomp(void)
+{
+    scmp_filter_ctx ctx;
+    size_t i;
+
+#ifdef SCMP_ACT_KILL_PROCESS
+    ctx = seccomp_init(SCMP_ACT_KILL_PROCESS);
+    /* Handle a newer libseccomp but an older kernel */
+    if (!ctx && errno == EOPNOTSUPP) {
+        ctx = seccomp_init(SCMP_ACT_TRAP);
+    }
+#else
+    ctx = seccomp_init(SCMP_ACT_TRAP);
+#endif
+    if (!ctx) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_init() failed\n");
+        exit(1);
+    }
+
+    for (i = 0; i < G_N_ELEMENTS(syscall_whitelist); i++) {
+        if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW,
+                             syscall_whitelist[i], 0) != 0) {
+            fuse_log(FUSE_LOG_ERR, "seccomp_rule_add syscall %d",
+                     syscall_whitelist[i]);
+            exit(1);
+        }
+    }
+
+    /* libvhost-user calls this for post-copy migration, we don't need it */
+    if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(ENOSYS),
+                         SCMP_SYS(userfaultfd), 0) != 0) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_rule_add userfaultfd failed\n");
+        exit(1);
+    }
+
+    if (seccomp_load(ctx) < 0) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_load() failed\n");
+        exit(1);
+    }
+
+    seccomp_release(ctx);
+}
tools/virtiofsd/seccomp.h new file +7 -0
new file mode 100644
index 0000000000..86bce72652
@@ -0,0 +1,14 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
Quoted 9 lines

tools/virtiofsd/seccomp.h line 14

Quoted 8 lines
tools/virtiofsd/seccomp.h new file +7 -0
+
+#ifndef VIRTIOFSD_SECCOMP_H
+#define VIRTIOFSD_SECCOMP_H
+
+void setup_seccomp(void);
+
+#endif /* VIRTIOFSD_SECCOMP_H */

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#61 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

Quoted 88 lines · Dr. David Alan Gilbert
Quoted 62 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 33 lines · Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Only allow system calls that are needed by virtiofsd. All other system calls cause SIGSYS to be directed at the thread and the process will coredump.

Restricting system calls reduces the kernel attack surface and limits what the process can do when compromised.

with additional entries by:

---
   Makefile                         |   2 +-
   tools/virtiofsd/Makefile.objs    |   5 +-
   tools/virtiofsd/passthrough_ll.c |   2 +
   tools/virtiofsd/seccomp.c        | 150 +++++++++++++++++++++++++++++++
   tools/virtiofsd/seccomp.h        |  14 +++
   5 files changed, 171 insertions(+), 2 deletions(-)

create mode 100644 tools/virtiofsd/seccomp.c
create mode 100644 tools/virtiofsd/seccomp.h

Makefile +0 -0
index a87e06ad93..967d59c98a 100644

Makefile HELPERS-y += vhost-user-gpu$(EXESUF) · line 330

Quoted 5 lines
Makefile +1 -1
@@ -327,7 +327,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF)
   vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
   endif
-ifdef CONFIG_LINUX
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP),yy)
   HELPERS-y += virtiofsd$(EXESUF)

Something is weird here, because I got:

$ make virtiofsd
   ...
   CC      tools/virtiofsd/seccomp.o
tools/virtiofsd/seccomp.c:14:21: fatal error: seccomp.h: No such file or
directory
  #include <seccomp.h>
                      ^

Indeed I don't have libseccomp installed, ./configure reported:

...
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
debug stack usage no
...

Note also:

Quoted 8 lines
$ make print-CONFIG_LINUX
CONFIG_LINUX=y
$ make print-CONFIG_SECCOMP
CONFIG_SECCOMP=
$ make print-CONFIG_LIBCAP_NG
CONFIG_LIBCAP_NG=y
$ make print-HELPERS-y
HELPERS-y=qemu-bridge-helper

The same thing happens if you uninstall mesa-libgbm-devel and do a 'make vhost-user-gpu'

These ifeq's don't remove the definition of the target, they just remove it from the HELPERS-y list, so stop it being built on an unqualified 'make' but don't change the behaviour when you explicitly ask for the target.

Can you try:

Makefile +0 -0
index ba7e2e5ebc..346a981f0e 100644
@@ -676,8 +676,9 @@ vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a
  rdmacm-mux$(EXESUF): LIBS += "-libumad"

Makefile vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a · line 684

Quoted 10 lines
Makefile +3 -2
  rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS)
         $(call LINK, $^)
-
-ifdef CONFIG_LINUX # relies on Linux-specific syscalls
+#
+# relies on Linux specific syscalls
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
  virtiofsd$(EXESUF): $(virtiofsd-obj-y) libvhost-user.a $(COMMON_LDADDS)
         $(call LINK, $^)
  endif
$ make print-HELPERS-y
HELPERS-y=qemu-bridge-helper
$ make virtiofsd
  GEN     config-host.h
make[1]: Entering directory 'slirp'
  CC      slirp/src/state.o
  CC      slirp/src/tcp_timer.o
  CC      slirp/src/dhcpv6.o
  CC      slirp/src/ip_input.o
  CC      slirp/src/ip6_icmp.o
  CC      slirp/src/bootp.o
  CC      slirp/src/ip6_input.o
  CC      slirp/src/slirp.o
  CC      slirp/src/vmstate.o
  CC      slirp/src/ip_output.o
  CC      slirp/src/ncsi.o
  CC      slirp/src/tcp_output.o
  CC      slirp/src/ndp_table.o
  CC      slirp/src/version.o
  CC      slirp/src/misc.o
  CC      slirp/src/ip6_output.o
  CC      slirp/src/mbuf.o
  CC      slirp/src/tftp.o
  CC      slirp/src/arp_table.o
  CC      slirp/src/util.o
  CC      slirp/src/socket.o
  CC      slirp/src/sbuf.o
  CC      slirp/src/stream.o
  CC      slirp/src/dnssearch.o
  CC      slirp/src/udp.o
  CC      slirp/src/tcp_input.o
  CC      slirp/src/if.o
  CC      slirp/src/cksum.o
  CC      slirp/src/tcp_subr.o
  CC      slirp/src/udp6.o
  CC      slirp/src/ip_icmp.o
  AR      slirp/libslirp.a
make[1]: Leaving directory 'slirp'
         DEP dtc/libfdt/fdt_overlay.c
         DEP dtc/libfdt/fdt_addresses.c
         DEP dtc/libfdt/fdt_empty_tree.c
         DEP dtc/libfdt/fdt_strerror.c
         DEP dtc/libfdt/fdt_rw.c
         DEP dtc/libfdt/fdt_sw.c
         DEP dtc/libfdt/fdt_wip.c
         DEP dtc/libfdt/fdt_ro.c
         DEP dtc/libfdt/fdt.c
         DEP dtc/util.c
         DEP dtc/fdtoverlay.c
         DEP dtc/fdtput.c
         DEP dtc/fdtget.c
         DEP dtc/fdtdump.c
         DEP convert-dtsv0-lexer.lex.c
         DEP dtc/srcpos.c
         DEP dtc-parser.tab.c
         DEP dtc-lexer.lex.c
         DEP dtc/treesource.c
         DEP dtc/livetree.c
         DEP dtc/fstree.c
         DEP dtc/flattree.c
         DEP dtc/dtc.c
         DEP dtc/data.c
         DEP dtc/checks.c
         CC libfdt/fdt.o
         CC libfdt/fdt_ro.o
         CC libfdt/fdt_wip.o
         CC libfdt/fdt_sw.o
         CC libfdt/fdt_rw.o
         CC libfdt/fdt_strerror.o
         CC libfdt/fdt_empty_tree.o
         CC libfdt/fdt_addresses.o
         CC libfdt/fdt_overlay.o
         AR libfdt/libfdt.a
r - libfdt/fdt.o
r - libfdt/fdt_ro.o
r - libfdt/fdt_wip.o
r - libfdt/fdt_sw.o
r - libfdt/fdt_rw.o
r - libfdt/fdt_strerror.o
r - libfdt/fdt_empty_tree.o
r - libfdt/fdt_addresses.o
r - libfdt/fdt_overlay.o
  CC      cs.o
  CC      utils.o
  CC      SStream.o
  CC      MCInstrDesc.o
  CC      MCRegisterInfo.o
  CC      arch/ARM/ARMDisassembler.o
  CC      arch/ARM/ARMInstPrinter.o
  CC      arch/ARM/ARMMapping.o
  CC      arch/ARM/ARMModule.o
  CC      arch/AArch64/AArch64BaseInfo.o
  CC      arch/AArch64/AArch64Disassembler.o
  CC      arch/AArch64/AArch64InstPrinter.o
  CC      arch/AArch64/AArch64Mapping.o
  CC      arch/AArch64/AArch64Module.o
  CC      arch/Mips/MipsDisassembler.o
  CC      arch/Mips/MipsInstPrinter.o
  CC      arch/Mips/MipsMapping.o
  CC      arch/Mips/MipsModule.o
  CC      arch/PowerPC/PPCDisassembler.o
  CC      arch/PowerPC/PPCInstPrinter.o
  CC      arch/PowerPC/PPCMapping.o
  CC      arch/PowerPC/PPCModule.o
  CC      arch/Sparc/SparcDisassembler.o
  CC      arch/Sparc/SparcInstPrinter.o
  CC      arch/Sparc/SparcMapping.o
  CC      arch/Sparc/SparcModule.o
  CC      arch/SystemZ/SystemZDisassembler.o
  CC      arch/SystemZ/SystemZInstPrinter.o
  CC      arch/SystemZ/SystemZMapping.o
  CC      arch/SystemZ/SystemZModule.o
  CC      arch/SystemZ/SystemZMCTargetDesc.o
  CC      arch/X86/X86DisassemblerDecoder.o
  CC      arch/X86/X86Disassembler.o
  CC      arch/X86/X86IntelInstPrinter.o
  CC      arch/X86/X86ATTInstPrinter.o
  CC      arch/X86/X86Mapping.o
  CC      arch/X86/X86Module.o
  CC      arch/XCore/XCoreDisassembler.o
  CC      arch/XCore/XCoreInstPrinter.o
  CC      arch/XCore/XCoreMapping.o
  CC      arch/XCore/XCoreModule.o
  CC      MCInst.o
  AR      libcapstone.a
  GEN     trace/generated-tcg-tracers.h
  GEN     trace/generated-helpers-wrappers.h
  GEN     trace/generated-helpers.h
  GEN     trace/generated-helpers.c
  GEN     module_block.h
  GEN     trace-root.h
  GEN     accel/kvm/trace.h
  GEN     accel/tcg/trace.h
  GEN     backends/trace.h
  GEN     crypto/trace.h
  GEN     monitor/trace.h
  GEN     linux-user/trace.h
  GEN     authz/trace.h
  GEN     block/trace.h
  GEN     io/trace.h
  GEN     nbd/trace.h
  GEN     scsi/trace.h
  GEN     chardev/trace.h
  GEN     audio/trace.h
  GEN     hw/9pfs/trace.h
  GEN     hw/acpi/trace.h
  GEN     hw/alpha/trace.h
  GEN     hw/arm/trace.h
  GEN     hw/audio/trace.h
  GEN     hw/block/trace.h
  GEN     hw/block/dataplane/trace.h
  GEN     hw/char/trace.h
  GEN     hw/dma/trace.h
  GEN     hw/hppa/trace.h
  GEN     hw/i2c/trace.h
  GEN     hw/i386/trace.h
  GEN     hw/i386/xen/trace.h
  GEN     hw/ide/trace.h
  GEN     hw/input/trace.h
  GEN     hw/intc/trace.h
  GEN     hw/isa/trace.h
  GEN     hw/mem/trace.h
  GEN     hw/mips/trace.h
  GEN     hw/misc/trace.h
  GEN     hw/misc/macio/trace.h
  GEN     hw/net/trace.h
  GEN     hw/nvram/trace.h
  GEN     hw/pci/trace.h
  GEN     hw/pci-host/trace.h
  GEN     hw/ppc/trace.h
  GEN     hw/rdma/trace.h
  GEN     hw/rdma/vmw/trace.h
  GEN     hw/rtc/trace.h
  GEN     hw/s390x/trace.h
  GEN     hw/scsi/trace.h
  GEN     hw/sd/trace.h
  GEN     hw/sparc/trace.h
  GEN     hw/sparc64/trace.h
  GEN     hw/timer/trace.h
  GEN     hw/tpm/trace.h
  GEN     hw/usb/trace.h
  GEN     hw/vfio/trace.h
  GEN     hw/virtio/trace.h
  GEN     hw/watchdog/trace.h
  GEN     hw/xen/trace.h
  GEN     hw/gpio/trace.h
  GEN     hw/riscv/trace.h
  GEN     migration/trace.h
  GEN     net/trace.h
  GEN     ui/trace.h
  GEN     hw/display/trace.h
  GEN     qapi/trace.h
  GEN     qom/trace.h
  GEN     target/arm/trace.h
  GEN     target/hppa/trace.h
  GEN     target/i386/trace.h
  GEN     target/mips/trace.h
  GEN     target/ppc/trace.h
  GEN     target/riscv/trace.h
  GEN     target/s390x/trace.h
  GEN     target/sparc/trace.h
  GEN     util/trace.h
  GEN     hw/core/trace.h
  GEN     trace-root.c
  GEN     accel/kvm/trace.c
  GEN     accel/tcg/trace.c
  GEN     backends/trace.c
  GEN     crypto/trace.c
  GEN     monitor/trace.c
  GEN     linux-user/trace.c
  GEN     authz/trace.c
  GEN     block/trace.c
  GEN     io/trace.c
  GEN     nbd/trace.c
  GEN     scsi/trace.c
  GEN     chardev/trace.c
  GEN     audio/trace.c
  GEN     hw/9pfs/trace.c
  GEN     hw/acpi/trace.c
  GEN     hw/alpha/trace.c
  GEN     hw/arm/trace.c
  GEN     hw/audio/trace.c
  GEN     hw/block/trace.c
  GEN     hw/block/dataplane/trace.c
  GEN     hw/char/trace.c
  GEN     hw/dma/trace.c
  GEN     hw/hppa/trace.c
  GEN     hw/i2c/trace.c
  GEN     hw/i386/trace.c
  GEN     hw/i386/xen/trace.c
  GEN     hw/ide/trace.c
  GEN     hw/input/trace.c
  GEN     hw/intc/trace.c
  GEN     hw/isa/trace.c
  GEN     hw/mem/trace.c
  GEN     hw/mips/trace.c
  GEN     hw/misc/trace.c
  GEN     hw/misc/macio/trace.c
  GEN     hw/net/trace.c
  GEN     hw/nvram/trace.c
  GEN     hw/pci/trace.c
  GEN     hw/pci-host/trace.c
  GEN     hw/ppc/trace.c
  GEN     hw/rdma/trace.c
  GEN     hw/rdma/vmw/trace.c
  GEN     hw/rtc/trace.c
  GEN     hw/s390x/trace.c
  GEN     hw/scsi/trace.c
  GEN     hw/sd/trace.c
  GEN     hw/sparc/trace.c
  GEN     hw/sparc64/trace.c
  GEN     hw/timer/trace.c
  GEN     hw/tpm/trace.c
  GEN     hw/usb/trace.c
  GEN     hw/vfio/trace.c
  GEN     hw/virtio/trace.c
  GEN     hw/watchdog/trace.c
  GEN     hw/xen/trace.c
  GEN     hw/gpio/trace.c
  GEN     hw/riscv/trace.c
  GEN     migration/trace.c
  GEN     net/trace.c
  GEN     ui/trace.c
  GEN     hw/display/trace.c
  GEN     qapi/trace.c
  GEN     qom/trace.c
  GEN     target/arm/trace.c
  GEN     target/hppa/trace.c
  GEN     target/i386/trace.c
  GEN     target/mips/trace.c
  GEN     target/ppc/trace.c
  GEN     target/riscv/trace.c
  GEN     target/s390x/trace.c
  GEN     target/sparc/trace.c
  GEN     util/trace.c
  GEN     hw/core/trace.c
make: *** No rule to make target 'virtiofsd'.  Stop.

This is better, thanks!

(We should also fix vhost-user-gpu, but this is out of the scope of this series).

Quoted 213 lines
Quoted 201 lines
Quoted 201 lines
Makefile +0 -0
   vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
   endif
tools/virtiofsd/Makefile.objs +4 -1
index 45a807500d..076f667e46 100644
@@ -5,5 +5,8 @@ virtiofsd-obj-y = buffer.o \
                     fuse_signals.o \
                     fuse_virtio.o \
                     helper.o \
-                  passthrough_ll.o
+                  passthrough_ll.o \
+                  seccomp.o
+seccomp.o-cflags := $(SECCOMP_CFLAGS)
+seccomp.o-libs := $(SECCOMP_LIBS)
tools/virtiofsd/passthrough_ll.c +2 -0
index 752beb459a..8748e64f33 100644
@@ -58,6 +58,7 @@
   #include <unistd.h>
   #include "passthrough_helpers.h"
+#include "seccomp.h"
   struct lo_map_elem {
       union {
@@ -2090,6 +2091,7 @@ static void setup_sandbox(struct lo_data *lo, struct fuse_session *se)
   {
       setup_namespaces(lo, se);
       setup_mounts(lo->source);
+    setup_seccomp();
   }
   int main(int argc, char *argv[])
tools/virtiofsd/seccomp.c new file +150 -0
new file mode 100644
index 0000000000..2aa4d3cc66
@@ -0,0 +1,150 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "seccomp.h"
+#include "fuse_i.h"
+#include "fuse_log.h"
+#include <errno.h>
+#include <glib.h>
+#include <seccomp.h>
+#include <stdlib.h>
+
+/* Bodge for libseccomp 2.4.2 which broke ppoll */
+#if !defined(__SNR_ppoll) && defined(__SNR_brk)
+#ifdef __NR_ppoll
+#define __SNR_ppoll __NR_ppoll
+#else
+#define __SNR_ppoll __PNR_ppoll
+#endif
+#endif
+
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
+    SCMP_SYS(clone),
+#ifdef __NR_clone3
+    SCMP_SYS(clone3),
+#endif
+    SCMP_SYS(close),
+    SCMP_SYS(copy_file_range),
+    SCMP_SYS(dup),
+    SCMP_SYS(eventfd2),
+    SCMP_SYS(exit),
+    SCMP_SYS(exit_group),
+    SCMP_SYS(fallocate),
+    SCMP_SYS(fchmodat),
+    SCMP_SYS(fchownat),
+    SCMP_SYS(fcntl),
+    SCMP_SYS(fdatasync),
+    SCMP_SYS(fgetxattr),
+    SCMP_SYS(flistxattr),
+    SCMP_SYS(flock),
+    SCMP_SYS(fremovexattr),
+    SCMP_SYS(fsetxattr),
+    SCMP_SYS(fstat),
+    SCMP_SYS(fstatfs),
+    SCMP_SYS(fsync),
+    SCMP_SYS(ftruncate),
+    SCMP_SYS(futex),
+    SCMP_SYS(getdents),
+    SCMP_SYS(getdents64),
+    SCMP_SYS(getegid),
+    SCMP_SYS(geteuid),
+    SCMP_SYS(getpid),
+    SCMP_SYS(gettid),
+    SCMP_SYS(gettimeofday),
+    SCMP_SYS(linkat),
+    SCMP_SYS(lseek),
+    SCMP_SYS(madvise),
+    SCMP_SYS(mkdirat),
+    SCMP_SYS(mknodat),
+    SCMP_SYS(mmap),
+    SCMP_SYS(mprotect),
+    SCMP_SYS(mremap),
+    SCMP_SYS(munmap),
+    SCMP_SYS(newfstatat),
+    SCMP_SYS(open),
+    SCMP_SYS(openat),
+    SCMP_SYS(ppoll),
+    SCMP_SYS(prctl), /* TODO restrict to just PR_SET_NAME? */
+    SCMP_SYS(preadv),
+    SCMP_SYS(pread64),
+    SCMP_SYS(pwritev),
+    SCMP_SYS(pwrite64),
+    SCMP_SYS(read),
+    SCMP_SYS(readlinkat),
+    SCMP_SYS(recvmsg),
+    SCMP_SYS(renameat),
+    SCMP_SYS(renameat2),
+    SCMP_SYS(rt_sigaction),
+    SCMP_SYS(rt_sigprocmask),
+    SCMP_SYS(rt_sigreturn),
+    SCMP_SYS(sendmsg),
+    SCMP_SYS(setresgid),
+    SCMP_SYS(setresuid),
+#ifdef __NR_setresgid32
+    SCMP_SYS(setresgid32),
+#endif
+#ifdef __NR_setresuid32
+    SCMP_SYS(setresuid32),
+#endif
+    SCMP_SYS(set_robust_list),
+    SCMP_SYS(symlinkat),
+    SCMP_SYS(time), /* Rarely needed, except on static builds */
+    SCMP_SYS(tgkill),
+    SCMP_SYS(unlinkat),
+    SCMP_SYS(utimensat),
+    SCMP_SYS(write),
+    SCMP_SYS(writev),
+};
+
+void setup_seccomp(void)
+{
+    scmp_filter_ctx ctx;
+    size_t i;
+
+#ifdef SCMP_ACT_KILL_PROCESS
+    ctx = seccomp_init(SCMP_ACT_KILL_PROCESS);
+    /* Handle a newer libseccomp but an older kernel */
+    if (!ctx && errno == EOPNOTSUPP) {
+        ctx = seccomp_init(SCMP_ACT_TRAP);
+    }
+#else
+    ctx = seccomp_init(SCMP_ACT_TRAP);
+#endif
+    if (!ctx) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_init() failed\n");
+        exit(1);
+    }
+
+    for (i = 0; i < G_N_ELEMENTS(syscall_whitelist); i++) {
+        if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW,
+                             syscall_whitelist[i], 0) != 0) {
+            fuse_log(FUSE_LOG_ERR, "seccomp_rule_add syscall %d",
+                     syscall_whitelist[i]);
+            exit(1);
+        }
+    }
+
+    /* libvhost-user calls this for post-copy migration, we don't need it */
+    if (seccomp_rule_add(ctx, SCMP_ACT_ERRNO(ENOSYS),
+                         SCMP_SYS(userfaultfd), 0) != 0) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_rule_add userfaultfd failed\n");
+        exit(1);
+    }
+
+    if (seccomp_load(ctx) < 0) {
+        fuse_log(FUSE_LOG_ERR, "seccomp_load() failed\n");
+        exit(1);
+    }
+
+    seccomp_release(ctx);
+}
tools/virtiofsd/seccomp.h new file +7 -0
new file mode 100644
index 0000000000..86bce72652
@@ -0,0 +1,14 @@
+/*
+ * Seccomp sandboxing for virtiofsd
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
Quoted 9 lines

tools/virtiofsd/seccomp.h line 14

Quoted 8 lines
tools/virtiofsd/seccomp.h new file +7 -0
+
+#ifndef VIRTIOFSD_SECCOMP_H
+#define VIRTIOFSD_SECCOMP_H
+
+void setup_seccomp(void);
+
+#endif /* VIRTIOFSD_SECCOMP_H */

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#62 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

In reply to Dr. David Alan Gilbert (git)

* David Alan Gilbert:

tools/virtiofsd/seccomp.c line 63

Quoted 8 lines
tools/virtiofsd/seccomp.c new file +7 -0
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
 
+    SCMP_SYS(gettimeofday),

Is this to suppose to work on 32-bit architectures? Then you need to add the time64 system call variants as well.

Thanks,
Florian

#63 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

Quoted 9 lines · * Florian Weimer ([email protected]) wrote:

* David Alan Gilbert:

Quoted 6 lines
tools/virtiofsd/seccomp.c new file +6 -0
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
Quoted 4 lines
Quoted 1 line

+ SCMP_SYS(gettimeofday),

Is this to suppose to work on 32-bit architectures? Then you need to add the time64 system call variants as well.

I've build tested on 32 but not tried running it; I'd added time(2) after hitting it on a static build but didn't know of time64 (not that it has a manpage!).

I'll do a follow up to fix it.

Dave

Quoted 2 lines

Thanks,
Florian

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#64 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

In reply to Florian Weimer
Quoted 9 lines · * Florian Weimer ([email protected]) wrote:

* David Alan Gilbert:

Quoted 6 lines
tools/virtiofsd/seccomp.c new file +6 -0
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
Quoted 4 lines
Quoted 1 line

+ SCMP_SYS(gettimeofday),

Is this to suppose to work on 32-bit architectures? Then you need to add the time64 system call variants as well.

Trying SCMP_SYS(time64) gives me an error for an undefined __NR_time64 on both 64 and 32 bit.

Dave

Quoted 2 lines

Thanks,
Florian

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#65 lore raw

Re: [PATCH v2 051/109] virtiofsd: add seccomp whitelist

* David Alan Gilbert:

Quoted 10 lines · * Florian Weimer ([email protected]) wrote:
Quoted 9 lines

* David Alan Gilbert:

Quoted 6 lines
tools/virtiofsd/seccomp.c new file +6 -0
+static const int syscall_whitelist[] = {
+    /* TODO ireg sem*() syscalls */
+    SCMP_SYS(brk),
+    SCMP_SYS(capget), /* For CAP_FSETID */
+    SCMP_SYS(capset),
+    SCMP_SYS(clock_gettime),
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

+ SCMP_SYS(gettimeofday),

Is this to suppose to work on 32-bit architectures? Then you need to add the time64 system call variants as well.

Trying SCMP_SYS(time64) gives me an error for an undefined __NR_time64 on both 64 and 32 bit.

Sorry, time64 does not exist, Userspace is supposed to use clock_gettime64 with CLOCK_REALTIME_COARSE.

I actually meant that you'll also need futex_time64, ppoll_time64, recvmmsg_time64, utimensat_time64. (Based on cursory checking against the permit list you posted.)

And for a port to 32-bit RISC-V, I think the 32-bit syscalls need to be protected by #ifdef because new 32-bit architectures do not have them anymore.

Thanks,
Florian

#66 lore raw

PATCH v2 52/109 virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV

In reply to Dr. David Alan Gilbert (git)

From: Vivek Goyal <[email protected]>

Caller can set FUSE_WRITE_KILL_PRIV in write_flags. Parse it and pass it to the filesystem.

---
 tools/virtiofsd/fuse_common.h   | 6 +++++-
 tools/virtiofsd/fuse_lowlevel.c | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)
tools/virtiofsd/fuse_common.h +5 -1
index deac132081..4b2c215fd9 100644
@@ -93,8 +93,12 @@ struct fuse_file_info {
      */
     unsigned int cache_readdir:1;
 
+    /* Indicates that suid/sgid bits should be removed upon write */
+    unsigned int kill_priv:1;
+
+
     /** Padding.  Reserved for future use*/
-    unsigned int padding:25;
+    unsigned int padding:24;
     unsigned int padding2:32;
 
     /*
tools/virtiofsd/fuse_lowlevel.c +3 -1
index f3e7f46008..63df56da6e 100644
@@ -1143,6 +1143,7 @@ static void do_write(fuse_req_t req, fuse_ino_t nodeid,
     memset(&fi, 0, sizeof(fi));
     fi.fh = arg->fh;
     fi.writepage = (arg->write_flags & FUSE_WRITE_CACHE) != 0;
+    fi.kill_priv = !!(arg->write_flags & FUSE_WRITE_KILL_PRIV);
 
     fi.lock_owner = arg->lock_owner;
     fi.flags = arg->flags;
@@ -1178,7 +1179,8 @@ static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid,
     fi.lock_owner = arg->lock_owner;
     fi.flags = arg->flags;
     fi.fh = arg->fh;
-    fi.writepage = arg->write_flags & FUSE_WRITE_CACHE;
+    fi.writepage = !!(arg->write_flags & FUSE_WRITE_CACHE);
+    fi.kill_priv = !!(arg->write_flags & FUSE_WRITE_KILL_PRIV);
 
     if (ibufv->count == 1) {
         assert(!(tmpbufv.buf[0].flags & FUSE_BUF_IS_FD));
Signature · 1 line
2.24.1
#67 lore raw

PATCH v2 53/109 virtiofsd: cap-ng helpers

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

libcap-ng reads /proc during capng_get_caps_process, and virtiofsd's sandboxing doesn't have /proc mounted; thus we have to do the caps read before we sandbox it and save/restore the state.

---
 Makefile                         |  2 +-
 tools/virtiofsd/passthrough_ll.c | 72 ++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 1 deletion(-)
Makefile +1 -1
index 967d59c98a..18f52d6270 100644
@@ -327,7 +327,7 @@ HELPERS-y += vhost-user-gpu$(EXESUF)
 vhost-user-json-y += contrib/vhost-user-gpu/50-qemu-gpu.json
 endif
 
-ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP),yy)
+ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
 HELPERS-y += virtiofsd$(EXESUF)
 vhost-user-json-y += tools/virtiofsd/50-qemu-virtiofsd.json
 endif
tools/virtiofsd/passthrough_ll.c +72 -0

108 lines not on this page · raw message

Signature · 1 line
2.24.1
#68 lore raw

PATCH v2 54/109 virtiofsd: Drop CAP_FSETID if client asked for it

In reply to Dr. David Alan Gilbert (git)

From: Vivek Goyal <[email protected]>

If client requested killing setuid/setgid bits on file being written, drop CAP_FSETID capability so that setuid/setgid bits are cleared upon write automatically.

pjdfstest chown/12.t needs this.

dgilbert: reworked for libcap-ng

---
 tools/virtiofsd/passthrough_ll.c | 105 +++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
tools/virtiofsd/passthrough_ll.c +105 -0
index bf939d06ae..3f7ec85938 100644
@@ -200,6 +200,91 @@ static int load_capng(void)
     return 0;
 }
 
+/*
+ * Helpers for dropping and regaining effective capabilities. Returns 0
+ * on success, error otherwise
+ */
+static int drop_effective_cap(const char *cap_name, bool *cap_dropped)
+{
+    int cap, ret;
+
+    cap = capng_name_to_capability(cap_name);
+    if (cap < 0) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "capng_name_to_capability(%s) failed:%s\n",
+                 cap_name, strerror(errno));
+        goto out;
+    }
+
+    if (load_capng()) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "load_capng() failed\n");
+        goto out;
+    }
+
+    /* We dont have this capability in effective set already. */
+    if (!capng_have_capability(CAPNG_EFFECTIVE, cap)) {
+        ret = 0;
+        goto out;
+    }
+
+    if (capng_update(CAPNG_DROP, CAPNG_EFFECTIVE, cap)) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "capng_update(DROP,) failed\n");
+        goto out;
+    }
+
+    if (capng_apply(CAPNG_SELECT_CAPS)) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "drop:capng_apply() failed\n");
+        goto out;
+    }
+
+    ret = 0;
+    if (cap_dropped) {
+        *cap_dropped = true;
+    }
+
+out:
+    return ret;
+}
+
+static int gain_effective_cap(const char *cap_name)
+{
+    int cap;
+    int ret = 0;
+
+    cap = capng_name_to_capability(cap_name);
+    if (cap < 0) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "capng_name_to_capability(%s) failed:%s\n",
+                 cap_name, strerror(errno));
+        goto out;
+    }
+
+    if (load_capng()) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "load_capng() failed\n");
+        goto out;
+    }
+
+    if (capng_update(CAPNG_ADD, CAPNG_EFFECTIVE, cap)) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "capng_update(ADD,) failed\n");
+        goto out;
+    }
+
+    if (capng_apply(CAPNG_SELECT_CAPS)) {
+        ret = errno;
+        fuse_log(FUSE_LOG_ERR, "gain:capng_apply() failed\n");
+        goto out;
+    }
+    ret = 0;
+
+out:
+    return ret;
+}
+
 static void lo_map_init(struct lo_map *map)
 {
     map->elems = NULL;
@@ -1576,6 +1661,7 @@ static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
     (void)ino;
     ssize_t res;
     struct fuse_bufvec out_buf = FUSE_BUFVEC_INIT(fuse_buf_size(in_buf));
+    bool cap_fsetid_dropped = false;
 
     out_buf.buf[0].flags = FUSE_BUF_IS_FD | FUSE_BUF_FD_SEEK;
     out_buf.buf[0].fd = lo_fi_fd(req, fi);
@@ -1587,12 +1673,31 @@ static void lo_write_buf(fuse_req_t req, fuse_ino_t ino,
                  out_buf.buf[0].size, (unsigned long)off);
     }
 
+    /*
+     * If kill_priv is set, drop CAP_FSETID which should lead to kernel
+     * clearing setuid/setgid on file.
+     */
+    if (fi->kill_priv) {
+        res = drop_effective_cap("FSETID", &cap_fsetid_dropped);
+        if (res != 0) {
+            fuse_reply_err(req, res);
+            return;
+        }
+    }
+
     res = fuse_buf_copy(&out_buf, in_buf, 0);
     if (res < 0) {
         fuse_reply_err(req, -res);
     } else {
         fuse_reply_write(req, (size_t)res);
     }
+
+    if (cap_fsetid_dropped) {
+        res = gain_effective_cap("FSETID");
+        if (res) {
+            fuse_log(FUSE_LOG_ERR, "Failed to gain CAP_FSETID\n");
+        }
+    }
 }
 
 static void lo_statfs(fuse_req_t req, fuse_ino_t ino)
Signature · 1 line
2.24.1
#69 lore raw

PATCH v2 55/109 virtiofsd: set maximum RLIMIT_NOFILE limit

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

virtiofsd can exceed the default open file descriptor limit easily on most systems. Take advantage of the fact that it runs as root to raise the limit.

---
 tools/virtiofsd/passthrough_ll.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
tools/virtiofsd/passthrough_ll.c +32 -0
index 3f7ec85938..7257a4a512 100644
@@ -52,6 +52,7 @@
 #include <sys/file.h>
 #include <sys/mount.h>
 #include <sys/prctl.h>
+#include <sys/resource.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -2267,6 +2268,35 @@ static void setup_sandbox(struct lo_data *lo, struct fuse_session *se)
     setup_seccomp();
 }
 
+/* Raise the maximum number of open file descriptors */
+static void setup_nofile_rlimit(void)
+{
+    const rlim_t max_fds = 1000000;
+    struct rlimit rlim;
+
+    if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) {
+        fuse_log(FUSE_LOG_ERR, "getrlimit(RLIMIT_NOFILE): %m\n");
+        exit(1);
+    }
+
+    if (rlim.rlim_cur >= max_fds) {
+        return; /* nothing to do */
+    }
+
+    rlim.rlim_cur = max_fds;
+    rlim.rlim_max = max_fds;
+
+    if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
+        /* Ignore SELinux denials */
+        if (errno == EPERM) {
+            return;
+        }
+
+        fuse_log(FUSE_LOG_ERR, "setrlimit(RLIMIT_NOFILE): %m\n");
+        exit(1);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -2388,6 +2418,8 @@ int main(int argc, char *argv[])
 
     fuse_daemonize(opts.foreground);
 
+    setup_nofile_rlimit();
+
     /* Must be before sandbox since it wants /proc */
     setup_capng();
 
Signature · 1 line
2.24.1
#70 lore raw

PATCH v2 56/109 virtiofsd: fix libfuse information leaks

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Some FUSE message replies contain padding fields that are not initialized by libfuse. This is fine in traditional FUSE applications because the kernel is trusted. virtiofsd does not trust the guest and must not expose uninitialized memory.

Use C struct initializers to automatically zero out memory. Not all of these code changes are strictly necessary but they will prevent future information leaks if the structs are extended.

---
 tools/virtiofsd/fuse_lowlevel.c | 150 ++++++++++++++++----------------
 1 file changed, 76 insertions(+), 74 deletions(-)
tools/virtiofsd/fuse_lowlevel.c +76 -74
index 63df56da6e..765d700c3f 100644
@@ -43,21 +43,23 @@ static __attribute__((constructor)) void fuse_ll_init_pagesize(void)
 
 static void convert_stat(const struct stat *stbuf, struct fuse_attr *attr)
 {
-    attr->ino = stbuf->st_ino;
-    attr->mode = stbuf->st_mode;
-    attr->nlink = stbuf->st_nlink;
-    attr->uid = stbuf->st_uid;
-    attr->gid = stbuf->st_gid;
-    attr->rdev = stbuf->st_rdev;
-    attr->size = stbuf->st_size;
-    attr->blksize = stbuf->st_blksize;
-    attr->blocks = stbuf->st_blocks;
-    attr->atime = stbuf->st_atime;
-    attr->mtime = stbuf->st_mtime;
-    attr->ctime = stbuf->st_ctime;
-    attr->atimensec = ST_ATIM_NSEC(stbuf);
-    attr->mtimensec = ST_MTIM_NSEC(stbuf);
-    attr->ctimensec = ST_CTIM_NSEC(stbuf);
+    *attr = (struct fuse_attr){
+        .ino = stbuf->st_ino,
+        .mode = stbuf->st_mode,
+        .nlink = stbuf->st_nlink,
+        .uid = stbuf->st_uid,
+        .gid = stbuf->st_gid,
+        .rdev = stbuf->st_rdev,
+        .size = stbuf->st_size,
+        .blksize = stbuf->st_blksize,
+        .blocks = stbuf->st_blocks,
+        .atime = stbuf->st_atime,
+        .mtime = stbuf->st_mtime,
+        .ctime = stbuf->st_ctime,
+        .atimensec = ST_ATIM_NSEC(stbuf),
+        .mtimensec = ST_MTIM_NSEC(stbuf),
+        .ctimensec = ST_CTIM_NSEC(stbuf),
+    };
 }
 
 static void convert_attr(const struct fuse_setattr_in *attr, struct stat *stbuf)
@@ -182,16 +184,16 @@ static int fuse_send_msg(struct fuse_session *se, struct fuse_chan *ch,
 int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
                                int count)
 {
-    struct fuse_out_header out;
+    struct fuse_out_header out = {
+        .unique = req->unique,
+        .error = error,
+    };
 
     if (error <= -1000 || error > 0) {
         fuse_log(FUSE_LOG_ERR, "fuse: bad error value: %i\n", error);
         error = -ERANGE;
     }
 
-    out.unique = req->unique;
-    out.error = error;
-
     iov[0].iov_base = &out;
     iov[0].iov_len = sizeof(struct fuse_out_header);
 
@@ -276,14 +278,16 @@ size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
 static void convert_statfs(const struct statvfs *stbuf,
                            struct fuse_kstatfs *kstatfs)
 {
-    kstatfs->bsize = stbuf->f_bsize;
-    kstatfs->frsize = stbuf->f_frsize;
-    kstatfs->blocks = stbuf->f_blocks;
-    kstatfs->bfree = stbuf->f_bfree;
-    kstatfs->bavail = stbuf->f_bavail;
-    kstatfs->files = stbuf->f_files;
-    kstatfs->ffree = stbuf->f_ffree;
-    kstatfs->namelen = stbuf->f_namemax;
+    *kstatfs = (struct fuse_kstatfs){
+        .bsize = stbuf->f_bsize,
+        .frsize = stbuf->f_frsize,
+        .blocks = stbuf->f_blocks,
+        .bfree = stbuf->f_bfree,
+        .bavail = stbuf->f_bavail,
+        .files = stbuf->f_files,
+        .ffree = stbuf->f_ffree,
+        .namelen = stbuf->f_namemax,
+    };
 }
 
 static int send_reply_ok(fuse_req_t req, const void *arg, size_t argsize)
@@ -327,12 +331,14 @@ static unsigned int calc_timeout_nsec(double t)
 static void fill_entry(struct fuse_entry_out *arg,
                        const struct fuse_entry_param *e)
 {
-    arg->nodeid = e->ino;
-    arg->generation = e->generation;
-    arg->entry_valid = calc_timeout_sec(e->entry_timeout);
-    arg->entry_valid_nsec = calc_timeout_nsec(e->entry_timeout);
-    arg->attr_valid = calc_timeout_sec(e->attr_timeout);
-    arg->attr_valid_nsec = calc_timeout_nsec(e->attr_timeout);
+    *arg = (struct fuse_entry_out){
+        .nodeid = e->ino,
+        .generation = e->generation,
+        .entry_valid = calc_timeout_sec(e->entry_timeout),
+        .entry_valid_nsec = calc_timeout_nsec(e->entry_timeout),
+        .attr_valid = calc_timeout_sec(e->attr_timeout),
+        .attr_valid_nsec = calc_timeout_nsec(e->attr_timeout),
+    };
     convert_stat(&e->attr, &arg->attr);
 }
 
@@ -361,10 +367,12 @@ size_t fuse_add_direntry_plus(fuse_req_t req, char *buf, size_t bufsize,
     fill_entry(&dp->entry_out, e);
 
     struct fuse_dirent *dirent = &dp->dirent;
-    dirent->ino = e->attr.st_ino;
-    dirent->off = off;
-    dirent->namelen = namelen;
-    dirent->type = (e->attr.st_mode & S_IFMT) >> 12;
+    *dirent = (struct fuse_dirent){
+        .ino = e->attr.st_ino,
+        .off = off,
+        .namelen = namelen,
+        .type = (e->attr.st_mode & S_IFMT) >> 12,
+    };
     memcpy(dirent->name, name, namelen);
     memset(dirent->name + namelen, 0, entlen_padded - entlen);
 
@@ -497,15 +505,14 @@ int fuse_reply_data(fuse_req_t req, struct fuse_bufvec *bufv,
                     enum fuse_buf_copy_flags flags)
 {
     struct iovec iov[2];
-    struct fuse_out_header out;
+    struct fuse_out_header out = {
+        .unique = req->unique,
+    };
     int res;
 
     iov[0].iov_base = &out;
     iov[0].iov_len = sizeof(struct fuse_out_header);
 
-    out.unique = req->unique;
-    out.error = 0;
-
     res = fuse_send_data_iov(req->se, req->ch, iov, 1, bufv, flags);
     if (res <= 0) {
         fuse_free_req(req);
@@ -2146,14 +2153,14 @@ static void do_destroy(fuse_req_t req, fuse_ino_t nodeid,
 static int send_notify_iov(struct fuse_session *se, int notify_code,
                            struct iovec *iov, int count)
 {
-    struct fuse_out_header out;
+    struct fuse_out_header out = {
+        .error = notify_code,
+    };
 
     if (!se->got_init) {
         return -ENOTCONN;
     }
 
-    out.unique = 0;
-    out.error = notify_code;
     iov[0].iov_base = &out;
     iov[0].iov_len = sizeof(struct fuse_out_header);
 
@@ -2163,11 +2170,11 @@ static int send_notify_iov(struct fuse_session *se, int notify_code,
 int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph)
 {
     if (ph != NULL) {
-        struct fuse_notify_poll_wakeup_out outarg;
+        struct fuse_notify_poll_wakeup_out outarg = {
+            .kh = ph->kh,
+        };
         struct iovec iov[2];
 
-        outarg.kh = ph->kh;
-
         iov[1].iov_base = &outarg;
         iov[1].iov_len = sizeof(outarg);
 
@@ -2180,17 +2187,17 @@ int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph)
 int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino,
                                      off_t off, off_t len)
 {
-    struct fuse_notify_inval_inode_out outarg;
+    struct fuse_notify_inval_inode_out outarg = {
+        .ino = ino,
+        .off = off,
+        .len = len,
+    };
     struct iovec iov[2];
 
     if (!se) {
         return -EINVAL;
     }
 
-    outarg.ino = ino;
-    outarg.off = off;
-    outarg.len = len;
-
     iov[1].iov_base = &outarg;
     iov[1].iov_len = sizeof(outarg);
 
@@ -2200,17 +2207,16 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino,
 int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent,
                                      const char *name, size_t namelen)
 {
-    struct fuse_notify_inval_entry_out outarg;
+    struct fuse_notify_inval_entry_out outarg = {
+        .parent = parent,
+        .namelen = namelen,
+    };
     struct iovec iov[3];
 
     if (!se) {
         return -EINVAL;
     }
 
-    outarg.parent = parent;
-    outarg.namelen = namelen;
-    outarg.padding = 0;
-
     iov[1].iov_base = &outarg;
     iov[1].iov_len = sizeof(outarg);
     iov[2].iov_base = (void *)name;
@@ -2223,18 +2229,17 @@ int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent,
                                 fuse_ino_t child, const char *name,
                                 size_t namelen)
 {
-    struct fuse_notify_delete_out outarg;
+    struct fuse_notify_delete_out outarg = {
+        .parent = parent,
+        .child = child,
+        .namelen = namelen,
+    };
     struct iovec iov[3];
 
     if (!se) {
         return -EINVAL;
     }
 
-    outarg.parent = parent;
-    outarg.child = child;
-    outarg.namelen = namelen;
-    outarg.padding = 0;
-
     iov[1].iov_base = &outarg;
     iov[1].iov_len = sizeof(outarg);
     iov[2].iov_base = (void *)name;
@@ -2247,24 +2252,21 @@ int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
                                off_t offset, struct fuse_bufvec *bufv,
                                enum fuse_buf_copy_flags flags)
 {
-    struct fuse_out_header out;
-    struct fuse_notify_store_out outarg;
+    struct fuse_out_header out = {
+        .error = FUSE_NOTIFY_STORE,
+    };
+    struct fuse_notify_store_out outarg = {
+        .nodeid = ino,
+        .offset = offset,
+        .size = fuse_buf_size(bufv),
+    };
     struct iovec iov[3];
-    size_t size = fuse_buf_size(bufv);
     int res;
 
     if (!se) {
         return -EINVAL;
     }
 
-    out.unique = 0;
-    out.error = FUSE_NOTIFY_STORE;
-
-    outarg.nodeid = ino;
-    outarg.offset = offset;
-    outarg.size = size;
-    outarg.padding = 0;
-
     iov[0].iov_base = &out;
     iov[0].iov_len = sizeof(out);
     iov[1].iov_base = &outarg;
Signature · 1 line
2.24.1
#71 lore raw

PATCH v2 57/109 docs: Add docs/tools

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Create docs/tools based on docs/dev based on docs/devel.

---
 Makefile             |  9 ++++++++-
 docs/index.rst       |  1 +
 docs/tools/conf.py   | 16 ++++++++++++++++
 docs/tools/index.rst | 12 ++++++++++++
 4 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 docs/tools/conf.py
 create mode 100644 docs/tools/index.rst
Makefile +8 -1
index 18f52d6270..2375a1f81c 100644
@@ -822,6 +822,7 @@ endef
 install-sphinxdocs: sphinxdocs
 	$(call install-manual,interop)
 	$(call install-manual,specs)
+	$(call install-manual,tools)
 
 install-doc: $(DOCS) install-sphinxdocs
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
@@ -1009,7 +1010,10 @@ docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
 # and handles "don't rebuild things unless necessary" itself.
 # The '.doctrees' files are cached information to speed this up.
 .PHONY: sphinxdocs
-sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index.html $(MANUAL_BUILDDIR)/specs/index.html
+sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
+            $(MANUAL_BUILDDIR)/interop/index.html \
+            $(MANUAL_BUILDDIR)/specs/index.html \
+            $(MANUAL_BUILDDIR)/tools/index.html
 
 # Canned command to build a single manual
 # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
@@ -1029,6 +1033,9 @@ $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
 $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
 	$(call build-manual,specs,html)
 
+$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools)
+	$(call build-manual,tools,html)
+
 $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
 	$(call build-manual,interop,man)
 
docs/index.rst +1 -0
index baa5791c17..f15ca17bf4 100644
@@ -13,4 +13,5 @@ Welcome to QEMU's documentation!
    interop/index
    devel/index
    specs/index
+   tools/index
 
docs/tools/conf.py new file +16 -0
new file mode 100644
index 0000000000..f9f76ff597
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+#
+# QEMU documentation build configuration file for the 'tools' manual.
+#
+# This includes the top level conf file and then makes any necessary tweaks.
+import sys
+import os
+
+qemu_docdir = os.path.abspath("..")
+parent_config = os.path.join(qemu_docdir, "conf.py")
+exec(compile(open(parent_config, "rb").read(), parent_config, 'exec'))
+
+# This slightly misuses the 'description', but is the best way to get
+# the manual title to appear in the sidebar.
+html_theme_options['description'] = u'Tools'
+
docs/tools/index.rst new file +12 -0
new file mode 100644
index 0000000000..adbcd3bc72
@@ -0,0 +1,12 @@
+.. This is the top level page for the 'tools' manual.
+
+
+QEMU tools
+==========
+
+This manual documents various tools included with QEMU.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
Signature · 1 line
2.24.1
Reviewed-by Tested-by on v2 57/109
#72 lore raw

Re: [PATCH v2 057/109] docs: Add docs/tools

Cc'ing Peter who is currently doing modification is this.

Quoted 5 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Create docs/tools based on docs/dev based on docs/devel.

Quoted 94 lines
---
  Makefile             |  9 ++++++++-
  docs/index.rst       |  1 +
  docs/tools/conf.py   | 16 ++++++++++++++++
  docs/tools/index.rst | 12 ++++++++++++
  4 files changed, 37 insertions(+), 1 deletion(-)

create mode 100644 docs/tools/conf.py
create mode 100644 docs/tools/index.rst

Makefile +8 -1
index 18f52d6270..2375a1f81c 100644
@@ -822,6 +822,7 @@ endef
  install-sphinxdocs: sphinxdocs
  	$(call install-manual,interop)
  	$(call install-manual,specs)
+	$(call install-manual,tools)
 
  install-doc: $(DOCS) install-sphinxdocs
  	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
@@ -1009,7 +1010,10 @@ docs/version.texi: $(SRC_PATH)/VERSION config-host.mak
  # and handles "don't rebuild things unless necessary" itself.
  # The '.doctrees' files are cached information to speed this up.
  .PHONY: sphinxdocs
-sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop/index.html $(MANUAL_BUILDDIR)/specs/index.html
+sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
+            $(MANUAL_BUILDDIR)/interop/index.html \
+            $(MANUAL_BUILDDIR)/specs/index.html \
+            $(MANUAL_BUILDDIR)/tools/index.html
 
  # Canned command to build a single manual
  # Arguments: $1 = manual name, $2 = Sphinx builder ('html' or 'man')
@@ -1029,6 +1033,9 @@ $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-deps,interop)
  $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
  	$(call build-manual,specs,html)
 
+$(MANUAL_BUILDDIR)/tools/index.html: $(call manual-deps,tools)
+	$(call build-manual,tools,html)
+
  $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
  	$(call build-manual,interop,man)
 
docs/index.rst +1 -0
index baa5791c17..f15ca17bf4 100644
@@ -13,4 +13,5 @@ Welcome to QEMU's documentation!
     interop/index
     devel/index
     specs/index
+   tools/index
 
docs/tools/conf.py new file +16 -0
new file mode 100644
index 0000000000..f9f76ff597
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+#
+# QEMU documentation build configuration file for the 'tools' manual.
+#
+# This includes the top level conf file and then makes any necessary tweaks.
+import sys
+import os
+
+qemu_docdir = os.path.abspath("..")
+parent_config = os.path.join(qemu_docdir, "conf.py")
+exec(compile(open(parent_config, "rb").read(), parent_config, 'exec'))
+
+# This slightly misuses the 'description', but is the best way to get
+# the manual title to appear in the sidebar.
+html_theme_options['description'] = u'Tools'
+
docs/tools/index.rst new file +12 -0
new file mode 100644
index 0000000000..adbcd3bc72
@@ -0,0 +1,12 @@
+.. This is the top level page for the 'tools' manual.
+
+
+QEMU tools
+==========
+
+This manual documents various tools included with QEMU.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
#73 lore raw

PATCH v2 58/109 virtiofsd: add security guide document

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Many people want to know: what's up with virtiofsd and security? This document provides the answers!

---
 docs/tools/index.rst              |   2 +
 docs/tools/virtiofsd-security.rst | 118 ++++++++++++++++++++++++++++++
 2 files changed, 120 insertions(+)
 create mode 100644 docs/tools/virtiofsd-security.rst
docs/tools/index.rst +2 -0
index adbcd3bc72..b9f8b70995 100644
@@ -10,3 +10,5 @@ Contents:
 
 .. toctree::
    :maxdepth: 2
+
+   virtiofsd-security
docs/tools/virtiofsd-security.rst new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.24.1
#74 lore raw

PATCH v2 59/109 virtiofsd: add --syslog command-line option

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Sometimes collecting output from stderr is inconvenient or does not fit within the overall logging architecture. Add syslog(3) support for cases where stderr cannot be used.

dgilbert: Reworked as a logging function

---
 tools/virtiofsd/fuse_lowlevel.h  |  1 +
 tools/virtiofsd/helper.c         |  2 ++
 tools/virtiofsd/passthrough_ll.c | 50 ++++++++++++++++++++++++++++++--
 tools/virtiofsd/seccomp.c        | 32 ++++++++++++++------
 tools/virtiofsd/seccomp.h        |  4 ++-
 5 files changed, 76 insertions(+), 13 deletions(-)
tools/virtiofsd/fuse_lowlevel.h +1 -0
index a95bc641fa..300d38b3a4 100644
@@ -1827,6 +1827,7 @@ struct fuse_cmdline_opts {
     int show_version;
     int show_help;
     int print_capabilities;
+    int syslog;
     unsigned int max_idle_threads;
 };
 
tools/virtiofsd/helper.c +2 -0
index d6fde8604b..bac3fd51ea 100644
@@ -54,6 +54,7 @@ static const struct fuse_opt fuse_helper_opts[] = {
     FUSE_HELPER_OPT("subtype=", nodefault_subtype),
     FUSE_OPT_KEY("subtype=", FUSE_OPT_KEY_KEEP),
     FUSE_HELPER_OPT("max_idle_threads=%u", max_idle_threads),
+    FUSE_HELPER_OPT("--syslog", syslog),
     FUSE_OPT_END
 };
 
@@ -138,6 +139,7 @@ void fuse_cmdline_help(void)
            "    -V   --version             print version\n"
            "    --print-capabilities       print vhost-user.json\n"
            "    -d   -o debug              enable debug output (implies -f)\n"
+           "    --syslog                   log to syslog (default stderr)\n"
            "    -f                         foreground operation\n"
            "    --daemonize                run in background\n"
            "    -s                         disable multi-threaded operation\n"
tools/virtiofsd/passthrough_ll.c +47 -3

89 lines not on this page · raw message

tools/virtiofsd/seccomp.c +23 -9
index 2aa4d3cc66..66ef2e5ea4 100644
@@ -106,11 +106,28 @@ static const int syscall_whitelist[] = {
     SCMP_SYS(writev),
 };
 
-void setup_seccomp(void)
+/* Syscalls used when --syslog is enabled */
+static const int syscall_whitelist_syslog[] = {
+    SCMP_SYS(sendto),
+};
+
+static void add_whitelist(scmp_filter_ctx ctx, const int syscalls[], size_t len)
 {
-    scmp_filter_ctx ctx;
     size_t i;
 
+    for (i = 0; i < len; i++) {
+        if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, syscalls[i], 0) != 0) {
+            fuse_log(FUSE_LOG_ERR, "seccomp_rule_add syscall %d failed\n",
+                     syscalls[i]);
+            exit(1);
+        }
+    }
+}
+
+void setup_seccomp(bool enable_syslog)
+{
+    scmp_filter_ctx ctx;
+
 #ifdef SCMP_ACT_KILL_PROCESS
     ctx = seccomp_init(SCMP_ACT_KILL_PROCESS);
     /* Handle a newer libseccomp but an older kernel */
@@ -125,13 +142,10 @@ void setup_seccomp(void)
         exit(1);
     }
 
-    for (i = 0; i < G_N_ELEMENTS(syscall_whitelist); i++) {
-        if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW,
-                             syscall_whitelist[i], 0) != 0) {
-            fuse_log(FUSE_LOG_ERR, "seccomp_rule_add syscall %d",
-                     syscall_whitelist[i]);
-            exit(1);
-        }
+    add_whitelist(ctx, syscall_whitelist, G_N_ELEMENTS(syscall_whitelist));
+    if (enable_syslog) {
+        add_whitelist(ctx, syscall_whitelist_syslog,
+                      G_N_ELEMENTS(syscall_whitelist_syslog));
     }
 
     /* libvhost-user calls this for post-copy migration, we don't need it */
tools/virtiofsd/seccomp.h +3 -1
index 86bce72652..d47c8eade6 100644
@@ -9,6 +9,8 @@
 #ifndef VIRTIOFSD_SECCOMP_H
 #define VIRTIOFSD_SECCOMP_H
 
-void setup_seccomp(void);
+#include <stdbool.h>
+
+void setup_seccomp(bool enable_syslog);
 
 #endif /* VIRTIOFSD_SECCOMP_H */
Signature · 1 line
2.24.1
#75 lore raw

PATCH v2 60/109 virtiofsd: print log only when priority is high enough

In reply to Dr. David Alan Gilbert (git)

From: Eryu Guan <[email protected]>

Introduce "-o log_level=" command line option to specify current log level (priority), valid values are "debug info warn err", e.g.

./virtiofsd -o log_level=debug ...

So only log priority higher than "debug" will be printed to stderr/syslog. And the default level is info.

The "-o debug"/"-d" options are kept, and imply debug log level.

dgilbert: Reworked for libfuse's log_func

with fix by:

---
 tools/virtiofsd/fuse_lowlevel.c  |  75 ++++++++------------
 tools/virtiofsd/fuse_lowlevel.h  |   1 +
 tools/virtiofsd/helper.c         |   8 ++-
 tools/virtiofsd/passthrough_ll.c | 118 +++++++++++++------------------
 4 files changed, 87 insertions(+), 115 deletions(-)
tools/virtiofsd/fuse_lowlevel.c +30 -45
index 765d700c3f..da2e618dd1 100644
@@ -157,19 +157,17 @@ static int fuse_send_msg(struct fuse_session *se, struct fuse_chan *ch,
     struct fuse_out_header *out = iov[0].iov_base;
 
     out->len = iov_length(iov, count);
-    if (se->debug) {
-        if (out->unique == 0) {
-            fuse_log(FUSE_LOG_DEBUG, "NOTIFY: code=%d length=%u\n", out->error,
-                     out->len);
-        } else if (out->error) {
-            fuse_log(FUSE_LOG_DEBUG,
-                     "   unique: %llu, error: %i (%s), outsize: %i\n",
-                     (unsigned long long)out->unique, out->error,
-                     strerror(-out->error), out->len);
-        } else {
-            fuse_log(FUSE_LOG_DEBUG, "   unique: %llu, success, outsize: %i\n",
-                     (unsigned long long)out->unique, out->len);
-        }
+    if (out->unique == 0) {
+        fuse_log(FUSE_LOG_DEBUG, "NOTIFY: code=%d length=%u\n", out->error,
+                 out->len);
+    } else if (out->error) {
+        fuse_log(FUSE_LOG_DEBUG,
+                 "   unique: %llu, error: %i (%s), outsize: %i\n",
+                 (unsigned long long)out->unique, out->error,
+                 strerror(-out->error), out->len);
+    } else {
+        fuse_log(FUSE_LOG_DEBUG, "   unique: %llu, success, outsize: %i\n",
+                 (unsigned long long)out->unique, out->len);
     }
 
     if (fuse_lowlevel_is_virtio(se)) {
@@ -1663,10 +1661,8 @@ static void do_interrupt(fuse_req_t req, fuse_ino_t nodeid,
         return;
     }
 
-    if (se->debug) {
-        fuse_log(FUSE_LOG_DEBUG, "INTERRUPT: %llu\n",
-                 (unsigned long long)arg->unique);
-    }
+    fuse_log(FUSE_LOG_DEBUG, "INTERRUPT: %llu\n",
+             (unsigned long long)arg->unique);
 
     req->u.i.unique = arg->unique;
 
@@ -1902,13 +1898,10 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
         }
     }
 
-    if (se->debug) {
-        fuse_log(FUSE_LOG_DEBUG, "INIT: %u.%u\n", arg->major, arg->minor);
-        if (arg->major == 7 && arg->minor >= 6) {
-            fuse_log(FUSE_LOG_DEBUG, "flags=0x%08x\n", arg->flags);
-            fuse_log(FUSE_LOG_DEBUG, "max_readahead=0x%08x\n",
-                     arg->max_readahead);
-        }
+    fuse_log(FUSE_LOG_DEBUG, "INIT: %u.%u\n", arg->major, arg->minor);
+    if (arg->major == 7 && arg->minor >= 6) {
+        fuse_log(FUSE_LOG_DEBUG, "flags=0x%08x\n", arg->flags);
+        fuse_log(FUSE_LOG_DEBUG, "max_readahead=0x%08x\n", arg->max_readahead);
     }
     se->conn.proto_major = arg->major;
     se->conn.proto_minor = arg->minor;
@@ -2117,19 +2110,14 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
     outarg.congestion_threshold = se->conn.congestion_threshold;
     outarg.time_gran = se->conn.time_gran;
 
-    if (se->debug) {
-        fuse_log(FUSE_LOG_DEBUG, "   INIT: %u.%u\n", outarg.major,
-                 outarg.minor);
-        fuse_log(FUSE_LOG_DEBUG, "   flags=0x%08x\n", outarg.flags);
-        fuse_log(FUSE_LOG_DEBUG, "   max_readahead=0x%08x\n",
-                 outarg.max_readahead);
-        fuse_log(FUSE_LOG_DEBUG, "   max_write=0x%08x\n", outarg.max_write);
-        fuse_log(FUSE_LOG_DEBUG, "   max_background=%i\n",
-                 outarg.max_background);
-        fuse_log(FUSE_LOG_DEBUG, "   congestion_threshold=%i\n",
-                 outarg.congestion_threshold);
-        fuse_log(FUSE_LOG_DEBUG, "   time_gran=%u\n", outarg.time_gran);
-    }
+    fuse_log(FUSE_LOG_DEBUG, "   INIT: %u.%u\n", outarg.major, outarg.minor);
+    fuse_log(FUSE_LOG_DEBUG, "   flags=0x%08x\n", outarg.flags);
+    fuse_log(FUSE_LOG_DEBUG, "   max_readahead=0x%08x\n", outarg.max_readahead);
+    fuse_log(FUSE_LOG_DEBUG, "   max_write=0x%08x\n", outarg.max_write);
+    fuse_log(FUSE_LOG_DEBUG, "   max_background=%i\n", outarg.max_background);
+    fuse_log(FUSE_LOG_DEBUG, "   congestion_threshold=%i\n",
+             outarg.congestion_threshold);
+    fuse_log(FUSE_LOG_DEBUG, "   time_gran=%u\n", outarg.time_gran);
 
     send_reply_ok(req, &outarg, outargsize);
 }
@@ -2409,14 +2397,11 @@ void fuse_session_process_buf_int(struct fuse_session *se,
     in = fuse_mbuf_iter_advance(&iter, sizeof(*in));
     assert(in); /* caller guarantees the input buffer is large enough */
 
-    if (se->debug) {
-        fuse_log(FUSE_LOG_DEBUG,
-                 "unique: %llu, opcode: %s (%i), nodeid: %llu, insize: %zu, "
-                 "pid: %u\n",
-                 (unsigned long long)in->unique,
-                 opname((enum fuse_opcode)in->opcode), in->opcode,
-                 (unsigned long long)in->nodeid, buf->size, in->pid);
-    }
+    fuse_log(
+        FUSE_LOG_DEBUG,
+        "unique: %llu, opcode: %s (%i), nodeid: %llu, insize: %zu, pid: %u\n",
+        (unsigned long long)in->unique, opname((enum fuse_opcode)in->opcode),
+        in->opcode, (unsigned long long)in->nodeid, buf->size, in->pid);
 
     req = fuse_ll_alloc_req(se);
     if (req == NULL) {
tools/virtiofsd/fuse_lowlevel.h +1 -0
index 300d38b3a4..3a7213f42f 100644
@@ -1828,6 +1828,7 @@ struct fuse_cmdline_opts {
     int show_help;
     int print_capabilities;
     int syslog;
+    int log_level;
     unsigned int max_idle_threads;
 };
 
tools/virtiofsd/helper.c +7 -1
index bac3fd51ea..c8cb88afdd 100644
@@ -33,7 +33,6 @@
         t, offsetof(struct fuse_cmdline_opts, p), v \
     }
 
-
 static const struct fuse_opt fuse_helper_opts[] = {
     FUSE_HELPER_OPT("-h", show_help),
     FUSE_HELPER_OPT("--help", show_help),
@@ -55,6 +54,10 @@ static const struct fuse_opt fuse_helper_opts[] = {
     FUSE_OPT_KEY("subtype=", FUSE_OPT_KEY_KEEP),
     FUSE_HELPER_OPT("max_idle_threads=%u", max_idle_threads),
     FUSE_HELPER_OPT("--syslog", syslog),
+    FUSE_HELPER_OPT_VALUE("log_level=debug", log_level, FUSE_LOG_DEBUG),
+    FUSE_HELPER_OPT_VALUE("log_level=info", log_level, FUSE_LOG_INFO),
+    FUSE_HELPER_OPT_VALUE("log_level=warn", log_level, FUSE_LOG_WARNING),
+    FUSE_HELPER_OPT_VALUE("log_level=err", log_level, FUSE_LOG_ERR),
     FUSE_OPT_END
 };
 
@@ -143,6 +146,9 @@ void fuse_cmdline_help(void)
            "    -f                         foreground operation\n"
            "    --daemonize                run in background\n"
            "    -s                         disable multi-threaded operation\n"
+           "    -o log_level=<level>       log level, default to \"info\"\n"
+           "                               level could be one of \"debug, "
+           "info, warn, err\"\n"
            "    -o max_idle_threads        the maximum number of idle worker "
            "threads\n"
            "                               allowed (default: 10)\n"
tools/virtiofsd/passthrough_ll.c +49 -69

237 lines not on this page · raw message

Signature · 1 line
2.24.1
#76 lore raw

PATCH v2 61/109 virtiofsd: Add ID to the log with FUSE_LOG_DEBUG level

In reply to Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

virtiofsd has some threads, so we see a lot of logs with debug option. It would be useful for debugging if we can identify the specific thread from the log.

Add ID, which is got by gettid(), to the log with FUSE_LOG_DEBUG level so that we can grep the specific thread.

The log is like as:

]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 -o cache=auto
...
[ID: 00000097] unique: 12696, success, outsize: 120
[ID: 00000097] virtio_send_msg: elem 18: with 2 in desc of length 120
[ID: 00000003] fv_queue_thread: Got queue event on Queue 1
[ID: 00000003] fv_queue_thread: Queue 1 gave evalue: 1 available: in: 65552 out: 80 [ID: 00000003] fv_queue_thread: Waiting for Queue 1 event
[ID: 00000071] fv_queue_worker: elem 33: with 2 out desc of length 80 bad_in_num=0 bad_out_num=0 [ID: 00000071] unique: 12694, opcode: READ (15), nodeid: 2, insize: 80, pid: 2014 [ID: 00000071] lo_read(ino=2, size=65536, off=131072)

added rework as suggested by Daniel P. Berrangé during review

---
 tools/virtiofsd/passthrough_ll.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/virtiofsd/passthrough_ll.c +8 -0
index 20b5a242cb..991de69334 100644
@@ -42,6 +42,7 @@
 #include <cap-ng.h>
 #include <dirent.h>
 #include <errno.h>
+#include <glib.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <pthread.h>
@@ -2267,10 +2268,17 @@ static void setup_nofile_rlimit(void)
 
 static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
 {
+    g_autofree char *localfmt = NULL;
+
     if (current_log_level < level) {
         return;
     }
 
+    if (current_log_level == FUSE_LOG_DEBUG) {
+        localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid), fmt);
+        fmt = localfmt;
+    }
+
     if (use_syslog) {
         int priority = LOG_ERR;
         switch (level) {
Signature · 1 line
2.24.1
Reviewed-by on v2 61/109
#77 lore raw

Re: [PATCH v2 061/109] virtiofsd: Add ID to the log with FUSE_LOG_DEBUG level

Quoted 51 lines · Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

virtiofsd has some threads, so we see a lot of logs with debug option. It would be useful for debugging if we can identify the specific thread from the log.

Add ID, which is got by gettid(), to the log with FUSE_LOG_DEBUG level so that we can grep the specific thread.

The log is like as:

   ]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 -o cache=auto
   ...
   [ID: 00000097]    unique: 12696, success, outsize: 120
   [ID: 00000097] virtio_send_msg: elem 18: with 2 in desc of length 120
   [ID: 00000003] fv_queue_thread: Got queue event on Queue 1
   [ID: 00000003] fv_queue_thread: Queue 1 gave evalue: 1 available: in: 65552 out: 80
   [ID: 00000003] fv_queue_thread: Waiting for Queue 1 event
   [ID: 00000071] fv_queue_worker: elem 33: with 2 out desc of length 80 bad_in_num=0 bad_out_num=0
   [ID: 00000071] unique: 12694, opcode: READ (15), nodeid: 2, insize: 80, pid: 2014
   [ID: 00000071] lo_read(ino=2, size=65536, off=131072)

added rework as suggested by Daniel P. Berrangé during review

---
  tools/virtiofsd/passthrough_ll.c | 8 ++++++++
  1 file changed, 8 insertions(+)
tools/virtiofsd/passthrough_ll.c +3 -0
index 20b5a242cb..991de69334 100644
@@ -42,6 +42,7 @@
  #include <cap-ng.h>
  #include <dirent.h>
  #include <errno.h>
+#include <glib.h>
  #include <inttypes.h>
  #include <limits.h>
  #include <pthread.h>
@@ -2267,10 +2268,17 @@ static void setup_nofile_rlimit(void)
 
  static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
  {
+    g_autofree char *localfmt = NULL;
+
      if (current_log_level < level) {
          return;

tools/virtiofsd/passthrough_ll.c static void setup_nofile_rlimit(void) · line 2284

Quoted 10 lines
tools/virtiofsd/passthrough_ll.c +5 -0
      }
 
+    if (current_log_level == FUSE_LOG_DEBUG) {
+        localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid), fmt);
+        fmt = localfmt;
+    }
+
      if (use_syslog) {
          int priority = LOG_ERR;
          switch (level) {
#78 lore raw

PATCH v2 62/109 virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level

In reply to Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

virtiofsd has some threads, so we see a lot of logs with debug option. It would be useful for debugging if we can see the timestamp.

Add nano second timestamp, which got by get_clock(), to the log with FUSE_LOG_DEBUG level if the syslog option isn't set.

The log is like as:

]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 -o cache=auto
...
[5365943125463727] [ID: 00000002] fv_queue_thread: Start for queue 0 kick_fd 9 [5365943125568644] [ID: 00000002] fv_queue_thread: Waiting for Queue 0 event [5365943125573561] [ID: 00000002] fv_queue_thread: Got queue event on Queue 0

---
 tools/virtiofsd/passthrough_ll.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/virtiofsd/passthrough_ll.c +9 -1
index 991de69334..a7fb34ac0c 100644
@@ -35,6 +35,8 @@
  * \include passthrough_ll.c
  */
 
+#include "qemu/osdep.h"
+#include "qemu/timer.h"
 #include "fuse_virtio.h"
 #include "fuse_log.h"
 #include "fuse_lowlevel.h"
@@ -2275,7 +2277,13 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
     }
 
     if (current_log_level == FUSE_LOG_DEBUG) {
-        localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid), fmt);
+        if (!use_syslog) {
+            localfmt = g_strdup_printf("[%" PRId64 "] [ID: %08ld] %s",
+                                       get_clock(), syscall(__NR_gettid), fmt);
+        } else {
+            localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid),
+                                       fmt);
+        }
         fmt = localfmt;
     }
 
Signature · 1 line
2.24.1
Reviewed-by on v2 62/109
#79 lore raw

Re: [PATCH v2 062/109] virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level

Quoted 11 lines · Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

virtiofsd has some threads, so we see a lot of logs with debug option. It would be useful for debugging if we can see the timestamp.

Add nano second timestamp, which got by get_clock(), to the log with FUSE_LOG_DEBUG level if the syslog option isn't set.

The log is like as:

]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 -o cache=auto

First ']' is incorrect copy/pasting?

Quoted 15 lines
   ...
   [5365943125463727] [ID: 00000002] fv_queue_thread: Start for queue 0 kick_fd 9
   [5365943125568644] [ID: 00000002] fv_queue_thread: Waiting for Queue 0 event
   [5365943125573561] [ID: 00000002] fv_queue_thread: Got queue event on Queue 0
---
  tools/virtiofsd/passthrough_ll.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
tools/virtiofsd/passthrough_ll.c +0 -0
index 991de69334..a7fb34ac0c 100644

tools/virtiofsd/passthrough_ll.c line 38

Quoted 4 lines
tools/virtiofsd/passthrough_ll.c +1 -0
@@ -35,6 +35,8 @@
   * \include passthrough_ll.c
   */
 
+#include "qemu/osdep.h"

I think this include belongs to patch #011 "virtiofsd: Fix common header and define for QEMU builds".

Quoted 20 lines
tools/virtiofsd/passthrough_ll.c +8 -1
+#include "qemu/timer.h"
  #include "fuse_virtio.h"
  #include "fuse_log.h"
  #include "fuse_lowlevel.h"
@@ -2275,7 +2277,13 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
      }
 
      if (current_log_level == FUSE_LOG_DEBUG) {
-        localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid), fmt);
+        if (!use_syslog) {
+            localfmt = g_strdup_printf("[%" PRId64 "] [ID: %08ld] %s",
+                                       get_clock(), syscall(__NR_gettid), fmt);
+        } else {
+            localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid),
+                                       fmt);
+        }
          fmt = localfmt;
      }
 
#80 lore raw

Re: [PATCH v2 062/109] virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level

Quoted 6 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

virtiofsd has some threads, so we see a lot of logs with debug option. It would be useful for debugging if we can see the timestamp.

Quoted 8 lines
Quoted 6 lines

Add nano second timestamp, which got by get_clock(), to the log with FUSE_LOG_DEBUG level if the syslog option isn't set.

The log is like as:

]# ./virtiofsd -d -o vhost_user_socket=/tmp/vhostqemu0 -o source=/tmp/share0 -o cache=auto

First ']' is incorrect copy/pasting?

Oops yes, removed.

Quoted 10 lines
Quoted 10 lines
   ...
   [5365943125463727] [ID: 00000002] fv_queue_thread: Start for queue 0 kick_fd 9
   [5365943125568644] [ID: 00000002] fv_queue_thread: Waiting for Queue 0 event
   [5365943125573561] [ID: 00000002] fv_queue_thread: Got queue event on Queue 0
---
  tools/virtiofsd/passthrough_ll.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
Quoted 11 lines

tools/virtiofsd/passthrough_ll.c line 37

Quoted 8 lines
tools/virtiofsd/passthrough_ll.c +1 -0
index 991de69334..a7fb34ac0c 100644
@@ -35,6 +35,8 @@
   * \include passthrough_ll.c
   */
+#include "qemu/osdep.h"

I think this include belongs to patch #011 "virtiofsd: Fix common header and define for QEMU builds".

Moved.

Quoted 2 lines

Thanks.

Quoted 10 lines
Quoted 10 lines
tools/virtiofsd/passthrough_ll.c +3 -1
+#include "qemu/timer.h"
  #include "fuse_virtio.h"
  #include "fuse_log.h"
  #include "fuse_lowlevel.h"
@@ -2275,7 +2277,13 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
      }
      if (current_log_level == FUSE_LOG_DEBUG) {
-        localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid), fmt);
+        if (!use_syslog) {
+            localfmt = g_strdup_printf("[%" PRId64 "] [ID: %08ld] %s",
Quoted 9 lines

tools/virtiofsd/passthrough_ll.c static void log_func(enum fuse_log_level level, const char *fmt, va_list ap) · line 2289

Quoted 8 lines
tools/virtiofsd/passthrough_ll.c +5 -0
+                                       get_clock(), syscall(__NR_gettid), fmt);
+        } else {
+            localfmt = g_strdup_printf("[ID: %08ld] %s", syscall(__NR_gettid),
+                                       fmt);
+        }
          fmt = localfmt;
      }
 

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#81 lore raw

PATCH v2 63/109 virtiofsd: Handle reinit

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Allow init->destroy->init for mount->umount->mount

---
 tools/virtiofsd/fuse_lowlevel.c | 2 ++
 1 file changed, 2 insertions(+)
tools/virtiofsd/fuse_lowlevel.c +2 -0
index da2e618dd1..5565f78208 100644
@@ -2029,6 +2029,7 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
     }
 
     se->got_init = 1;
+    se->got_destroy = 0;
     if (se->op.init) {
         se->op.init(se->userdata, &se->conn);
     }
@@ -2131,6 +2132,7 @@ static void do_destroy(fuse_req_t req, fuse_ino_t nodeid,
     (void)iter;
 
     se->got_destroy = 1;
+    se->got_init = 0;
     if (se->op.destroy) {
         se->op.destroy(se->userdata);
     }
Signature · 1 line
2.24.1
#82 lore raw

PATCH v2 64/109 virtiofsd: Handle hard reboot

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Handle a
mount
hard reboot (without unmount)
mount

we get another 'init' which FUSE doesn't normally expect.

---
 tools/virtiofsd/fuse_lowlevel.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
tools/virtiofsd/fuse_lowlevel.c +15 -1
index 5565f78208..7dafe02db8 100644
@@ -2435,7 +2435,21 @@ void fuse_session_process_buf_int(struct fuse_session *se,
             goto reply_err;
         }
     } else if (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT) {
-        goto reply_err;
+        if (fuse_lowlevel_is_virtio(se)) {
+            /*
+             * TODO: This is after a hard reboot typically, we need to do
+             * a destroy, but we can't reply to this request yet so
+             * we can't use do_destroy
+             */
+            fuse_log(FUSE_LOG_DEBUG, "%s: reinit\n", __func__);
+            se->got_destroy = 1;
+            se->got_init = 0;
+            if (se->op.destroy) {
+                se->op.destroy(se->userdata);
+            }
+        } else {
+            goto reply_err;
+        }
     }
 
     err = EACCES;
Signature · 1 line
2.24.1
#83 lore raw

PATCH v2 65/109 virtiofsd: Kill threads when queues are stopped

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Kill the threads we've started when the queues get stopped.

With improvements by:

---
 tools/virtiofsd/fuse_virtio.c | 51 ++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 7 deletions(-)
tools/virtiofsd/fuse_virtio.c +44 -7
index 872968f2c8..7a8774a3ee 100644
@@ -41,6 +41,7 @@ struct fv_QueueInfo {
     /* Our queue index, corresponds to array position */
     int qidx;
     int kick_fd;
+    int kill_fd; /* For killing the thread */
 
     /* The element for the command currently being processed */
     VuVirtqElement *qe;
@@ -412,14 +413,17 @@ static void *fv_queue_thread(void *opaque)
     fuse_log(FUSE_LOG_INFO, "%s: Start for queue %d kick_fd %d\n", __func__,
              qi->qidx, qi->kick_fd);
     while (1) {
-        struct pollfd pf[1];
+        struct pollfd pf[2];
         pf[0].fd = qi->kick_fd;
         pf[0].events = POLLIN;
         pf[0].revents = 0;
+        pf[1].fd = qi->kill_fd;
+        pf[1].events = POLLIN;
+        pf[1].revents = 0;
 
         fuse_log(FUSE_LOG_DEBUG, "%s: Waiting for Queue %d event\n", __func__,
                  qi->qidx);
-        int poll_res = ppoll(pf, 1, NULL, NULL);
+        int poll_res = ppoll(pf, 2, NULL, NULL);
 
         if (poll_res == -1) {
             if (errno == EINTR) {
@@ -430,12 +434,23 @@ static void *fv_queue_thread(void *opaque)
             fuse_log(FUSE_LOG_ERR, "fv_queue_thread ppoll: %m\n");
             break;
         }
-        assert(poll_res == 1);
+        assert(poll_res >= 1);
         if (pf[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
             fuse_log(FUSE_LOG_ERR, "%s: Unexpected poll revents %x Queue %d\n",
                      __func__, pf[0].revents, qi->qidx);
             break;
         }
+        if (pf[1].revents & (POLLERR | POLLHUP | POLLNVAL)) {
+            fuse_log(FUSE_LOG_ERR,
+                     "%s: Unexpected poll revents %x Queue %d killfd\n",
+                     __func__, pf[1].revents, qi->qidx);
+            break;
+        }
+        if (pf[1].revents) {
+            fuse_log(FUSE_LOG_INFO, "%s: kill event on queue %d - quitting\n",
+                     __func__, qi->qidx);
+            break;
+        }
         assert(pf[0].revents & POLLIN);
         fuse_log(FUSE_LOG_DEBUG, "%s: Got queue event on Queue %d\n", __func__,
                  qi->qidx);
@@ -589,6 +604,28 @@ out:
     return NULL;
 }
 
+static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx)
+{
+    int ret;
+    struct fv_QueueInfo *ourqi;
+
+    assert(qidx < vud->nqueues);
+    ourqi = vud->qi[qidx];
+
+    /* Kill the thread */
+    if (eventfd_write(ourqi->kill_fd, 1)) {
+        fuse_log(FUSE_LOG_ERR, "Eventfd_write for queue %d: %s\n",
+                 qidx, strerror(errno));
+    }
+    ret = pthread_join(ourqi->thread, NULL);
+    if (ret) {
+        fuse_log(FUSE_LOG_ERR, "%s: Failed to join thread idx %d err %d\n",
+                 __func__, qidx, ret);
+    }
+    close(ourqi->kill_fd);
+    ourqi->kick_fd = -1;
+}
+
 /* Callback from libvhost-user on start or stop of a queue */
 static void fv_queue_set_started(VuDev *dev, int qidx, bool started)
 {
@@ -633,16 +670,16 @@ static void fv_queue_set_started(VuDev *dev, int qidx, bool started)
         }
         ourqi = vud->qi[qidx];
         ourqi->kick_fd = dev->vq[qidx].kick_fd;
+
+        ourqi->kill_fd = eventfd(0, EFD_CLOEXEC | EFD_SEMAPHORE);
+        assert(ourqi->kill_fd != -1);
         if (pthread_create(&ourqi->thread, NULL, fv_queue_thread, ourqi)) {
             fuse_log(FUSE_LOG_ERR, "%s: Failed to create thread for queue %d\n",
                      __func__, qidx);
             assert(0);
         }
     } else {
-        /* TODO: Kill the thread */
-        assert(qidx < vud->nqueues);
-        ourqi = vud->qi[qidx];
-        ourqi->kick_fd = -1;
+        fv_queue_cleanup_thread(vud, qidx);
     }
 }
 
Signature · 1 line
2.24.1
#84 lore raw

PATCH v2 66/109 vhost-user: Print unexpected slave message types

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

When we receive an unexpected message type on the slave fd, print the type.

---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
index d27a10fcc6..9ec8c2a27c 100644
@@ -1061,7 +1061,7 @@ static void slave_read(void *opaque)
                                                           fd[0]);
         break;
     default:
-        error_report("Received unexpected msg type.");
+        error_report("Received unexpected msg type. (%d)", hdr.request);
         ret = -EINVAL;
     }
 
Signature · 1 line
2.24.1
Reviewed-by on v2 66/109
#85 lore raw

Re: [PATCH v2 066/109] vhost-user: Print unexpected slave message types

Quoted 16 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

When we receive an unexpected message type on the slave fd, print the type.

---
  hw/virtio/vhost-user.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +0 -0
index d27a10fcc6..9ec8c2a27c 100644

hw/virtio/vhost-user.c static void slave_read(void *opaque) · line 1064

Quoted 5 lines
hw/virtio/vhost-user.c +1 -1
@@ -1061,7 +1061,7 @@ static void slave_read(void *opaque)
                                                            fd[0]);
          break;
      default:
-        error_report("Received unexpected msg type.");
+        error_report("Received unexpected msg type. (%d)", hdr.request);

With either "Received unexpected msg type (%d)."
or "Received unexpected msg type: %d." instead:

Quoted 4 lines
hw/virtio/vhost-user.c +0 -0
          ret = -EINVAL;
      }
 
#86 lore raw

Re: [PATCH v2 066/109] vhost-user: Print unexpected slave message types

Quoted 12 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 11 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

When we receive an unexpected message type on the slave fd, print the type.

---
  hw/virtio/vhost-user.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

hw/virtio/vhost-user.c static void slave_read(void *opaque) · line 1064

Quoted 10 lines
hw/virtio/vhost-user.c +1 -1
index d27a10fcc6..9ec8c2a27c 100644
@@ -1061,7 +1061,7 @@ static void slave_read(void *opaque)
                                                            fd[0]);
          break;
      default:
-        error_report("Received unexpected msg type.");
+        error_report("Received unexpected msg type. (%d)", hdr.request);

With either "Received unexpected msg type (%d)."
or "Received unexpected msg type: %d." instead:

OK.

Quoted 1 line

Thanks.

Quoted 4 lines

hw/virtio/vhost-user.c static void slave_read(void *opaque) · line 1067

Quoted 3 lines
hw/virtio/vhost-user.c +0 -0
          ret = -EINVAL;
      }
 

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#87 lore raw

PATCH v2 67/109 contrib/libvhost-user: Protect slave fd with mutex

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

In future patches we'll be performing commands on the slave-fd driven by commands on queues, since those queues will be driven by individual threads we need to make sure they don't attempt to use the slave-fd for multiple commands in parallel.

---
 contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++++++++++----
 contrib/libvhost-user/libvhost-user.h |  3 +++
 2 files changed, 23 insertions(+), 4 deletions(-)
contrib/libvhost-user/libvhost-user.c +20 -4
index ec27b78ff1..63e41062a4 100644
@@ -392,26 +392,37 @@ vu_send_reply(VuDev *dev, int conn_fd, VhostUserMsg *vmsg)
     return vu_message_write(dev, conn_fd, vmsg);
 }
 
+/*
+ * Processes a reply on the slave channel.
+ * Entered with slave_mutex held and releases it before exit.
+ * Returns true on success.
+ */
 static bool
 vu_process_message_reply(VuDev *dev, const VhostUserMsg *vmsg)
 {
     VhostUserMsg msg_reply;
+    bool result = false;
 
     if ((vmsg->flags & VHOST_USER_NEED_REPLY_MASK) == 0) {
-        return true;
+        result = true;
+        goto out;
     }
 
     if (!vu_message_read(dev, dev->slave_fd, &msg_reply)) {
-        return false;
+        goto out;
     }
 
     if (msg_reply.request != vmsg->request) {
         DPRINT("Received unexpected msg type. Expected %d received %d",
                vmsg->request, msg_reply.request);
-        return false;
+        goto out;
     }
 
-    return msg_reply.payload.u64 == 0;
+    result = msg_reply.payload.u64 == 0;
+
+out:
+    pthread_mutex_unlock(&dev->slave_mutex);
+    return result;
 }
 
 /* Kick the log_call_fd if required. */
@@ -1105,10 +1116,13 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd,
         return false;
     }
 
+    pthread_mutex_lock(&dev->slave_mutex);
     if (!vu_message_write(dev, dev->slave_fd, &vmsg)) {
+        pthread_mutex_unlock(&dev->slave_mutex);
         return false;
     }
 
+    /* Also unlocks the slave_mutex */
     return vu_process_message_reply(dev, &vmsg);
 }
 
@@ -1628,6 +1642,7 @@ vu_deinit(VuDev *dev)
         close(dev->slave_fd);
         dev->slave_fd = -1;
     }
+    pthread_mutex_destroy(&dev->slave_mutex);
 
     if (dev->sock != -1) {
         close(dev->sock);
@@ -1663,6 +1678,7 @@ vu_init(VuDev *dev,
     dev->remove_watch = remove_watch;
     dev->iface = iface;
     dev->log_call_fd = -1;
+    pthread_mutex_init(&dev->slave_mutex, NULL);
     dev->slave_fd = -1;
     dev->max_queues = max_queues;
 
contrib/libvhost-user/libvhost-user.h +3 -0
index 46b600799b..1844b6f8d4 100644
@@ -19,6 +19,7 @@
 #include <stddef.h>
 #include <sys/poll.h>
 #include <linux/vhost.h>
+#include <pthread.h>
 #include "standard-headers/linux/virtio_ring.h"
 
 /* Based on qemu/hw/virtio/vhost-user.c */
@@ -355,6 +356,8 @@ struct VuDev {
     VuVirtq *vq;
     VuDevInflightInfo inflight_info;
     int log_call_fd;
+    /* Must be held while using slave_fd */
+    pthread_mutex_t slave_mutex;
     int slave_fd;
     uint64_t log_size;
     uint8_t *log_table;
Signature · 1 line
2.24.1
#88 lore raw

PATCH v2 68/109 virtiofsd: passthrough_ll: add renameat2 support

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

---
 tools/virtiofsd/passthrough_ll.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
tools/virtiofsd/passthrough_ll.c +10 -0
index a7fb34ac0c..6f3ad14141 100644
@@ -1099,7 +1099,17 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
     }
 
     if (flags) {
+#ifndef SYS_renameat2
         fuse_reply_err(req, EINVAL);
+#else
+        res = syscall(SYS_renameat2, lo_fd(req, parent), name,
+                       lo_fd(req, newparent), newname, flags);
+        if (res == -1 && errno == ENOSYS) {
+            fuse_reply_err(req, EINVAL);
+        } else {
+            fuse_reply_err(req, res == -1 ? errno : 0);
+        }
+#endif
         return;
     }
 
Signature · 1 line
2.24.1
#89 lore raw

PATCH v2 69/109 virtiofsd: passthrough_ll: disable readdirplus on cache=never

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

...because the attributes sent in the READDIRPLUS reply would be discarded anyway.

---
 tools/virtiofsd/passthrough_ll.c | 4 ++++
 1 file changed, 4 insertions(+)
tools/virtiofsd/passthrough_ll.c +4 -0
index 6f3ad14141..ae364a4825 100644
@@ -478,6 +478,10 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
     }
+    if (lo->cache == CACHE_NEVER) {
+        fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
+        conn->want &= ~FUSE_CAP_READDIRPLUS;
+    }
 }
 
 static void lo_getattr(fuse_req_t req, fuse_ino_t ino,
Signature · 1 line
2.24.1
#90 lore raw

PATCH v2 70/109 virtiofsd: passthrough_ll: control readdirplus

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

---
 tools/virtiofsd/helper.c         | 3 +++
 tools/virtiofsd/passthrough_ll.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
tools/virtiofsd/helper.c +3 -0
index c8cb88afdd..36eb273d8e 100644
@@ -154,6 +154,9 @@ void fuse_cmdline_help(void)
            "                               allowed (default: 10)\n"
            "    -o norace                  disable racy fallback\n"
            "                               default: false\n"
+           "    -o readdirplus|no_readdirplus\n"
+           "                               enable/disable readirplus\n"
+           "                               default: readdirplus\n"
           );
 }
 
tools/virtiofsd/passthrough_ll.c +6 -1
index ae364a4825..b15633a044 100644
@@ -117,6 +117,8 @@ struct lo_data {
     double timeout;
     int cache;
     int timeout_set;
+    int readdirplus_set;
+    int readdirplus_clear;
     struct lo_inode root; /* protected by lo->mutex */
     struct lo_map ino_map; /* protected by lo->mutex */
     struct lo_map dirp_map; /* protected by lo->mutex */
@@ -140,6 +142,8 @@ static const struct fuse_opt lo_opts[] = {
     { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
     { "norace", offsetof(struct lo_data, norace), 1 },
+    { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
+    { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 },
     FUSE_OPT_END
 };
 static bool use_syslog = false;
@@ -478,7 +482,8 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
     }
-    if (lo->cache == CACHE_NEVER) {
+    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
+        lo->readdirplus_clear) {
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
         conn->want &= ~FUSE_CAP_READDIRPLUS;
     }
Signature · 1 line
2.24.1
Reviewed-by on v2 70/109
#91 lore raw

Re: [PATCH v2 070/109] virtiofsd: passthrough_ll: control readdirplus

Quoted 13 lines

From: Miklos Szeredi <[email protected]>

---
 tools/virtiofsd/helper.c         | 3 +++
 tools/virtiofsd/passthrough_ll.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
tools/virtiofsd/helper.c +0 -0
index c8cb88afdd..36eb273d8e 100644

tools/virtiofsd/helper.c void fuse_cmdline_help(void) · line 159

Quoted 6 lines
tools/virtiofsd/helper.c +3 -0
@@ -154,6 +154,9 @@ void fuse_cmdline_help(void)
            "                               allowed (default: 10)\n"
            "    -o norace                  disable racy fallback\n"
            "                               default: false\n"
+           "    -o readdirplus|no_readdirplus\n"
+           "                               enable/disable readirplus\n"
+           "                               default: readdirplus\n"

Actually, default behavior is
1. no_readdirplus if cache=none
2. readdirplus otherwise.
So help message should be fixed.

other than that

Quoted 37 lines
tools/virtiofsd/helper.c +0 -0
           );
 }
 
tools/virtiofsd/passthrough_ll.c +6 -1
index ae364a4825..b15633a044 100644
@@ -117,6 +117,8 @@ struct lo_data {
     double timeout;
     int cache;
     int timeout_set;
+    int readdirplus_set;
+    int readdirplus_clear;
     struct lo_inode root; /* protected by lo->mutex */
     struct lo_map ino_map; /* protected by lo->mutex */
     struct lo_map dirp_map; /* protected by lo->mutex */
@@ -140,6 +142,8 @@ static const struct fuse_opt lo_opts[] = {
     { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
     { "norace", offsetof(struct lo_data, norace), 1 },
+    { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
+    { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 },
     FUSE_OPT_END
 };
 static bool use_syslog = false;
@@ -478,7 +482,8 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
     }
-    if (lo->cache == CACHE_NEVER) {
+    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
+        lo->readdirplus_clear) {
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
         conn->want &= ~FUSE_CAP_READDIRPLUS;
     }
Signature · 1 line
2.24.1
#92 lore raw

Re: [PATCH v2 070/109] virtiofsd: passthrough_ll: control readdirplus

Quoted 8 lines · * Misono Tomohiro ([email protected]) wrote:
Quoted 8 lines

From: Miklos Szeredi <[email protected]>

---
 tools/virtiofsd/helper.c         | 3 +++
 tools/virtiofsd/passthrough_ll.c | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
Quoted 16 lines

tools/virtiofsd/helper.c void fuse_cmdline_help(void) · line 159

Quoted 11 lines
tools/virtiofsd/helper.c +3 -0
index c8cb88afdd..36eb273d8e 100644
@@ -154,6 +154,9 @@ void fuse_cmdline_help(void)
            "                               allowed (default: 10)\n"
            "    -o norace                  disable racy fallback\n"
            "                               default: false\n"
+           "    -o readdirplus|no_readdirplus\n"
+           "                               enable/disable readirplus\n"
+           "                               default: readdirplus\n"

Actually, default behavior is
1. no_readdirplus if cache=none
2. readdirplus otherwise.
So help message should be fixed.

Thanks, I've made that:

-o readdirplus|no_readdirplus
enable/disable readirplus
default: readdirplus except with cache=never

and then swapped never for none in the 'clean up cache related options' patch.

Quoted 1 line

Thanks.

Quoted 30 lines
Quoted 30 lines
tools/virtiofsd/helper.c +0 -0
           );
 }
 
tools/virtiofsd/passthrough_ll.c +4 -0
index ae364a4825..b15633a044 100644
@@ -117,6 +117,8 @@ struct lo_data {
     double timeout;
     int cache;
     int timeout_set;
+    int readdirplus_set;
+    int readdirplus_clear;
     struct lo_inode root; /* protected by lo->mutex */
     struct lo_map ino_map; /* protected by lo->mutex */
     struct lo_map dirp_map; /* protected by lo->mutex */
@@ -140,6 +142,8 @@ static const struct fuse_opt lo_opts[] = {
     { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
     { "norace", offsetof(struct lo_data, norace), 1 },
+    { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
+    { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 },
     FUSE_OPT_END
 };
 static bool use_syslog = false;
@@ -478,7 +482,8 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
     }
Quoted 9 lines
Quoted 8 lines
tools/virtiofsd/passthrough_ll.c +2 -1
-    if (lo->cache == CACHE_NEVER) {
+    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
+        lo->readdirplus_clear) {
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
         conn->want &= ~FUSE_CAP_READDIRPLUS;
     }
Signature · 1 line
2.24.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#93 lore raw

PATCH v2 71/109 virtiofsd: rename unref_inode() to unref_inode_lolocked()

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

---
 tools/virtiofsd/passthrough_ll.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
tools/virtiofsd/passthrough_ll.c +8 -7
index b15633a044..57be7cf007 100644
@@ -148,8 +148,8 @@ static const struct fuse_opt lo_opts[] = {
 };
 static bool use_syslog = false;
 static int current_log_level;
-
-static void unref_inode(struct lo_data *lo, struct lo_inode *inode, uint64_t n);
+static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
+                                 uint64_t n);
 
 static struct {
     pthread_mutex_t mutex;
@@ -586,7 +586,7 @@ retry:
     return 0;
 
 fail_unref:
-    unref_inode(lo, p, 1);
+    unref_inode_lolocked(lo, p, 1);
 fail:
     if (retries) {
         retries--;
@@ -624,7 +624,7 @@ fallback:
     res = lo_parent_and_name(lo, inode, path, &parent);
     if (res != -1) {
         res = utimensat(parent->fd, path, tv, AT_SYMLINK_NOFOLLOW);
-        unref_inode(lo, parent, 1);
+        unref_inode_lolocked(lo, parent, 1);
     }
 
     return res;
@@ -1027,7 +1027,7 @@ fallback:
     res = lo_parent_and_name(lo, inode, path, &parent);
     if (res != -1) {
         res = linkat(parent->fd, path, dfd, name, 0);
-        unref_inode(lo, parent, 1);
+        unref_inode_lolocked(lo, parent, 1);
     }
 
     return res;
@@ -1141,7 +1141,8 @@ static void lo_unlink(fuse_req_t req, fuse_ino_t parent, const char *name)
     fuse_reply_err(req, res == -1 ? errno : 0);
 }
 
-static void unref_inode(struct lo_data *lo, struct lo_inode *inode, uint64_t n)
+static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
+                                 uint64_t n)
 {
     if (!inode) {
         return;
@@ -1181,7 +1182,7 @@ static void lo_forget_one(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
              (unsigned long long)ino, (unsigned long long)inode->refcount,
              (unsigned long long)nlookup);
 
-    unref_inode(lo, inode, nlookup);
+    unref_inode_lolocked(lo, inode, nlookup);
 }
 
 static void lo_forget(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
Signature · 1 line
2.24.1
#94 lore raw

PATCH v2 72/109 virtiofsd: fail when parent inode isn't known in lo_do_lookup()

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

The Linux file handle APIs (struct export_operations) can access inodes that are not attached to parents because path name traversal is not performed. Refuse if there is no parent in lo_do_lookup().

Also clean up lo_do_lookup() while we're here.

---
 tools/virtiofsd/passthrough_ll.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tools/virtiofsd/passthrough_ll.c +12 -2
index 57be7cf007..2d2c10ada9 100644
@@ -777,6 +777,15 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
     struct lo_data *lo = lo_data(req);
     struct lo_inode *inode, *dir = lo_inode(req, parent);
 
+    /*
+     * name_to_handle_at() and open_by_handle_at() can reach here with fuse
+     * mount point in guest, but we don't have its inode info in the
+     * ino_map.
+     */
+    if (!dir) {
+        return ENOENT;
+    }
+
     memset(e, 0, sizeof(*e));
     e->attr_timeout = lo->timeout;
     e->entry_timeout = lo->timeout;
@@ -786,7 +795,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         name = ".";
     }
 
-    newfd = openat(lo_fd(req, parent), name, O_PATH | O_NOFOLLOW);
+    newfd = openat(dir->fd, name, O_PATH | O_NOFOLLOW);
     if (newfd == -1) {
         goto out_err;
     }
@@ -796,7 +805,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         goto out_err;
     }
 
-    inode = lo_find(lo_data(req), &e->attr);
+    inode = lo_find(lo, &e->attr);
     if (inode) {
         close(newfd);
         newfd = -1;
@@ -812,6 +821,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         inode->is_symlink = S_ISLNK(e->attr.st_mode);
         inode->refcount = 1;
         inode->fd = newfd;
+        newfd = -1;
         inode->ino = e->attr.st_ino;
         inode->dev = e->attr.st_dev;
 
Signature · 1 line
2.24.1
#95 lore raw

PATCH v2 73/109 virtiofsd: extract root inode init into setup_root()

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

Inititialize the root inode in a single place.

dgilbert:
with fix suggested by Misono Tomohiro <[email protected]>

---
 tools/virtiofsd/passthrough_ll.c | 35 +++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 10 deletions(-)
tools/virtiofsd/passthrough_ll.c +25 -10
index 2d2c10ada9..f71085bf1b 100644
@@ -2351,6 +2351,30 @@ static void log_func(enum fuse_log_level level, const char *fmt, va_list ap)
     }
 }
 
+static void setup_root(struct lo_data *lo, struct lo_inode *root)
+{
+    int fd, res;
+    struct stat stat;
+
+    fd = open("/", O_PATH);
+    if (fd == -1) {
+        fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", lo->source);
+        exit(1);
+    }
+
+    res = fstatat(fd, "", &stat, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
+    if (res == -1) {
+        fuse_log(FUSE_LOG_ERR, "fstatat(%s): %m\n", lo->source);
+        exit(1);
+    }
+
+    root->is_symlink = false;
+    root->fd = fd;
+    root->ino = stat.st_ino;
+    root->dev = stat.st_dev;
+    root->refcount = 2;
+}
+
 int main(int argc, char *argv[])
 {
     struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -2426,8 +2450,6 @@ int main(int argc, char *argv[])
     if (lo.debug) {
         current_log_level = FUSE_LOG_DEBUG;
     }
-    lo.root.refcount = 2;
-
     if (lo.source) {
         struct stat stat;
         int res;
@@ -2446,7 +2468,6 @@ int main(int argc, char *argv[])
     } else {
         lo.source = "/";
     }
-    lo.root.is_symlink = false;
     if (!lo.timeout_set) {
         switch (lo.cache) {
         case CACHE_NEVER:
@@ -2466,13 +2487,6 @@ int main(int argc, char *argv[])
         exit(1);
     }
 
-    lo.root.fd = open(lo.source, O_PATH);
-
-    if (lo.root.fd == -1) {
-        fuse_log(FUSE_LOG_ERR, "open(\"%s\", O_PATH): %m\n", lo.source);
-        exit(1);
-    }
-
     se = fuse_session_new(&args, &lo_oper, sizeof(lo_oper), &lo);
     if (se == NULL) {
         goto err_out1;
@@ -2495,6 +2509,7 @@ int main(int argc, char *argv[])
 
     setup_sandbox(&lo, se, opts.syslog);
 
+    setup_root(&lo, &lo.root);
     /* Block until ctrl+c or fusermount -u */
     ret = virtio_loop(se);
 
Signature · 1 line
2.24.1
#97 lore raw

PATCH v2 74/109 virtiofsd: passthrough_ll: clean up cache related options

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

- Rename "cache=never" to "cache=none" to match 9p's similar option.

- Rename CACHE_NORMAL constant to CACHE_AUTO to match the "cache=auto" option.

---
 tools/virtiofsd/helper.c         |  3 +++
 tools/virtiofsd/passthrough_ll.c | 20 ++++++++++----------
 2 files changed, 13 insertions(+), 10 deletions(-)
tools/virtiofsd/helper.c +3 -0
index 36eb273d8e..93bb0713a9 100644
@@ -146,6 +146,9 @@ void fuse_cmdline_help(void)
            "    -f                         foreground operation\n"
            "    --daemonize                run in background\n"
            "    -s                         disable multi-threaded operation\n"
+           "    -o cache=<mode>            cache mode. could be one of \"auto, "
+           "always, none\"\n"
+           "                               default: auto\n"
            "    -o log_level=<level>       log level, default to \"info\"\n"
            "                               level could be one of \"debug, "
            "info, warn, err\"\n"
tools/virtiofsd/passthrough_ll.c +10 -10
index f71085bf1b..528820aa71 100644
@@ -101,8 +101,8 @@ struct lo_cred {
 };
 
 enum {
-    CACHE_NEVER,
-    CACHE_NORMAL,
+    CACHE_NONE,
+    CACHE_AUTO,
     CACHE_ALWAYS,
 };
 
@@ -138,8 +138,8 @@ static const struct fuse_opt lo_opts[] = {
     { "no_xattr", offsetof(struct lo_data, xattr), 0 },
     { "timeout=%lf", offsetof(struct lo_data, timeout), 0 },
     { "timeout=", offsetof(struct lo_data, timeout_set), 1 },
-    { "cache=never", offsetof(struct lo_data, cache), CACHE_NEVER },
-    { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
+    { "cache=none", offsetof(struct lo_data, cache), CACHE_NONE },
+    { "cache=auto", offsetof(struct lo_data, cache), CACHE_AUTO },
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
     { "norace", offsetof(struct lo_data, norace), 1 },
     { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
@@ -482,7 +482,7 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
     }
-    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
+    if ((lo->cache == CACHE_NONE && !lo->readdirplus_set) ||
         lo->readdirplus_clear) {
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
         conn->want &= ~FUSE_CAP_READDIRPLUS;
@@ -1493,7 +1493,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
         fi->fh = fh;
         err = lo_do_lookup(req, parent, name, &e);
     }
-    if (lo->cache == CACHE_NEVER) {
+    if (lo->cache == CACHE_NONE) {
         fi->direct_io = 1;
     } else if (lo->cache == CACHE_ALWAYS) {
         fi->keep_cache = 1;
@@ -1578,7 +1578,7 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
     }
 
     fi->fh = fh;
-    if (lo->cache == CACHE_NEVER) {
+    if (lo->cache == CACHE_NONE) {
         fi->direct_io = 1;
     } else if (lo->cache == CACHE_ALWAYS) {
         fi->keep_cache = 1;
@@ -2395,7 +2395,7 @@ int main(int argc, char *argv[])
     lo.root.next = lo.root.prev = &lo.root;
     lo.root.fd = -1;
     lo.root.fuse_ino = FUSE_ROOT_ID;
-    lo.cache = CACHE_NORMAL;
+    lo.cache = CACHE_AUTO;
 
     /*
      * Set up the ino map like this:
@@ -2470,11 +2470,11 @@ int main(int argc, char *argv[])
     }
     if (!lo.timeout_set) {
         switch (lo.cache) {
-        case CACHE_NEVER:
+        case CACHE_NONE:
             lo.timeout = 0.0;
             break;
 
-        case CACHE_NORMAL:
+        case CACHE_AUTO:
             lo.timeout = 1.0;
             break;
 
Signature · 1 line
2.24.1
#98 lore raw

PATCH v2 75/109 virtiofsd: passthrough_ll: use hashtable

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

Improve performance of inode lookup by using a hash table.

---
 tools/virtiofsd/passthrough_ll.c | 81 ++++++++++++++++++--------------
 1 file changed, 45 insertions(+), 36 deletions(-)
tools/virtiofsd/passthrough_ll.c +45 -36
index 528820aa71..e0f76b37b7 100644
@@ -84,13 +84,15 @@ struct lo_map {
     ssize_t freelist;
 };
 
+struct lo_key {
+    ino_t ino;
+    dev_t dev;
+};
+
 struct lo_inode {
-    struct lo_inode *next; /* protected by lo->mutex */
-    struct lo_inode *prev; /* protected by lo->mutex */
     int fd;
     bool is_symlink;
-    ino_t ino;
-    dev_t dev;
+    struct lo_key key;
     uint64_t refcount; /* protected by lo->mutex */
     fuse_ino_t fuse_ino;
 };
@@ -119,7 +121,8 @@ struct lo_data {
     int timeout_set;
     int readdirplus_set;
     int readdirplus_clear;
-    struct lo_inode root; /* protected by lo->mutex */
+    struct lo_inode root;
+    GHashTable *inodes; /* protected by lo->mutex */
     struct lo_map ino_map; /* protected by lo->mutex */
     struct lo_map dirp_map; /* protected by lo->mutex */
     struct lo_map fd_map; /* protected by lo->mutex */
@@ -573,7 +576,7 @@ retry:
         }
         goto fail_unref;
     }
-    if (stat.st_dev != inode->dev || stat.st_ino != inode->ino) {
+    if (stat.st_dev != inode->key.dev || stat.st_ino != inode->key.ino) {
         if (!retries) {
             fuse_log(FUSE_LOG_WARNING,
                      "%s: failed to match last\n", __func__);
@@ -753,19 +756,20 @@ out_err:
 static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st)
 {
     struct lo_inode *p;
-    struct lo_inode *ret = NULL;
+    struct lo_key key = {
+        .ino = st->st_ino,
+        .dev = st->st_dev,
+    };
 
     pthread_mutex_lock(&lo->mutex);
-    for (p = lo->root.next; p != &lo->root; p = p->next) {
-        if (p->ino == st->st_ino && p->dev == st->st_dev) {
-            assert(p->refcount > 0);
-            ret = p;
-            ret->refcount++;
-            break;
-        }
+    p = g_hash_table_lookup(lo->inodes, &key);
+    if (p) {
+        assert(p->refcount > 0);
+        p->refcount++;
     }
     pthread_mutex_unlock(&lo->mutex);
-    return ret;
+
+    return p;
 }
 
 static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
@@ -810,8 +814,6 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         close(newfd);
         newfd = -1;
     } else {
-        struct lo_inode *prev, *next;
-
         saverr = ENOMEM;
         inode = calloc(1, sizeof(struct lo_inode));
         if (!inode) {
@@ -822,17 +824,12 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         inode->refcount = 1;
         inode->fd = newfd;
         newfd = -1;
-        inode->ino = e->attr.st_ino;
-        inode->dev = e->attr.st_dev;
+        inode->key.ino = e->attr.st_ino;
+        inode->key.dev = e->attr.st_dev;
 
         pthread_mutex_lock(&lo->mutex);
         inode->fuse_ino = lo_add_inode_mapping(req, inode);
-        prev = &lo->root;
-        next = prev->next;
-        next->prev = inode;
-        inode->next = next;
-        inode->prev = prev;
-        prev->next = inode;
+        g_hash_table_insert(lo->inodes, &inode->key, inode);
         pthread_mutex_unlock(&lo->mutex);
     }
     e->ino = inode->fuse_ino;
@@ -1162,14 +1159,8 @@ static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
     assert(inode->refcount >= n);
     inode->refcount -= n;
     if (!inode->refcount) {
-        struct lo_inode *prev, *next;
-
-        prev = inode->prev;
-        next = inode->next;
-        next->prev = prev;
-        prev->next = next;
-
         lo_map_remove(&lo->ino_map, inode->fuse_ino);
+        g_hash_table_remove(lo->inodes, &inode->key);
         pthread_mutex_unlock(&lo->mutex);
         close(inode->fd);
         free(inode);
@@ -1369,7 +1360,7 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
 
         /* Hide root's parent directory */
         if (dinode == &lo->root && strcmp(name, "..") == 0) {
-            e.attr.st_ino = lo->root.ino;
+            e.attr.st_ino = lo->root.key.ino;
             e.attr.st_mode = DT_DIR << 12;
         }
 
@@ -2370,11 +2361,26 @@ static void setup_root(struct lo_data *lo, struct lo_inode *root)
 
     root->is_symlink = false;
     root->fd = fd;
-    root->ino = stat.st_ino;
-    root->dev = stat.st_dev;
+    root->key.ino = stat.st_ino;
+    root->key.dev = stat.st_dev;
     root->refcount = 2;
 }
 
+static guint lo_key_hash(gconstpointer key)
+{
+    const struct lo_key *lkey = key;
+
+    return (guint)lkey->ino + (guint)lkey->dev;
+}
+
+static gboolean lo_key_equal(gconstpointer a, gconstpointer b)
+{
+    const struct lo_key *la = a;
+    const struct lo_key *lb = b;
+
+    return la->ino == lb->ino && la->dev == lb->dev;
+}
+
 int main(int argc, char *argv[])
 {
     struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -2392,7 +2398,7 @@ int main(int argc, char *argv[])
     umask(0);
 
     pthread_mutex_init(&lo.mutex, NULL);
-    lo.root.next = lo.root.prev = &lo.root;
+    lo.inodes = g_hash_table_new(lo_key_hash, lo_key_equal);
     lo.root.fd = -1;
     lo.root.fuse_ino = FUSE_ROOT_ID;
     lo.cache = CACHE_AUTO;
@@ -2522,6 +2528,9 @@ err_out2:
 err_out1:
     fuse_opt_free_args(&args);
 
+    if (lo.inodes) {
+        g_hash_table_destroy(lo.inodes);
+    }
     lo_map_destroy(&lo.fd_map);
     lo_map_destroy(&lo.dirp_map);
     lo_map_destroy(&lo.ino_map);
Signature · 1 line
2.24.1
#99 lore raw

PATCH v2 76/109 virtiofsd: Clean up inodes on destroy

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Clear out our inodes and fd's on a 'destroy' - so we get rid of them if we reboot the guest.

---
 tools/virtiofsd/passthrough_ll.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
tools/virtiofsd/passthrough_ll.c +26 -0
index e0f76b37b7..3b60e61c74 100644
@@ -1169,6 +1169,25 @@ static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
     }
 }
 
+static int unref_all_inodes_cb(gpointer key, gpointer value, gpointer user_data)
+{
+    struct lo_inode *inode = value;
+    struct lo_data *lo = user_data;
+
+    inode->refcount = 0;
+    lo_map_remove(&lo->ino_map, inode->fuse_ino);
+    close(inode->fd);
+
+    return TRUE;
+}
+
+static void unref_all_inodes(struct lo_data *lo)
+{
+    pthread_mutex_lock(&lo->mutex);
+    g_hash_table_foreach_remove(lo->inodes, unref_all_inodes_cb, lo);
+    pthread_mutex_unlock(&lo->mutex);
+}
+
 static void lo_forget_one(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
 {
     struct lo_data *lo = lo_data(req);
@@ -2035,6 +2054,12 @@ static void lo_lseek(fuse_req_t req, fuse_ino_t ino, off_t off, int whence,
     }
 }
 
+static void lo_destroy(void *userdata)
+{
+    struct lo_data *lo = (struct lo_data *)userdata;
+    unref_all_inodes(lo);
+}
+
 static struct fuse_lowlevel_ops lo_oper = {
     .init = lo_init,
     .lookup = lo_lookup,
@@ -2073,6 +2098,7 @@ static struct fuse_lowlevel_ops lo_oper = {
     .copy_file_range = lo_copy_file_range,
 #endif
     .lseek = lo_lseek,
+    .destroy = lo_destroy,
 };
 
 /* Print vhost-user.json backend program capabilities */
Signature · 1 line
2.24.1
#100 lore raw

PATCH v2 77/109 virtiofsd: support nanosecond resolution for file timestamp

In reply to Dr. David Alan Gilbert (git)

From: Jiufei Xue <[email protected]>

Define HAVE_STRUCT_STAT_ST_ATIM to 1 if st_atim' is member of struct stat' which means support nanosecond resolution for the file timestamp fields.

---
 configure                   | 16 ++++++++++++++++
 tools/virtiofsd/fuse_misc.h |  1 +
 2 files changed, 17 insertions(+)
configure +16 -0
index 557e4382ea..9bc0441509 100755
@@ -5191,6 +5191,19 @@ if compile_prog "" "" ; then
     strchrnul=yes
 fi
 
+#########################################
+# check if we have st_atim
+
+st_atim=no
+cat > $TMPC << EOF
+#include <sys/stat.h>
+#include <stddef.h>
+int main(void) { return offsetof(struct stat, st_atim); }
+EOF
+if compile_prog "" "" ; then
+    st_atim=yes
+fi
+
 ##########################################
 # check if trace backend exists
 
@@ -6886,6 +6899,9 @@ fi
 if test "$strchrnul" = "yes" ; then
   echo "HAVE_STRCHRNUL=y" >> $config_host_mak
 fi
+if test "$st_atim" = "yes" ; then
+  echo "HAVE_STRUCT_STAT_ST_ATIM=y" >> $config_host_mak
+fi
 if test "$byteswap_h" = "yes" ; then
   echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
 fi
tools/virtiofsd/fuse_misc.h +1 -0
index f252baa752..5c618ce21f 100644
@@ -7,6 +7,7 @@
  */
 
 #include <pthread.h>
+#include "config-host.h"
 
 /*
  * Versioned symbols cannot be used in some cases because it
Signature · 1 line
2.24.1
#101 lore raw

PATCH v2 78/109 virtiofsd: fix error handling in main()

In reply to Dr. David Alan Gilbert (git)

From: Liu Bo <[email protected]>

Neither fuse_parse_cmdline() nor fuse_opt_parse() goes to the right place to do cleanup.

---
 tools/virtiofsd/passthrough_ll.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/virtiofsd/passthrough_ll.c +3 -2
index 3b60e61c74..4e01a37ddb 100644
@@ -2443,13 +2443,14 @@ int main(int argc, char *argv[])
     lo_map_init(&lo.fd_map);
 
     if (fuse_parse_cmdline(&args, &opts) != 0) {
-        return 1;
+        goto err_out1;
     }
     fuse_set_log_func(log_func);
     use_syslog = opts.syslog;
     if (use_syslog) {
         openlog("virtiofsd", LOG_PID, LOG_DAEMON);
     }
+
     if (opts.show_help) {
         printf("usage: %s [options]\n\n", argv[0]);
         fuse_cmdline_help();
@@ -2468,7 +2469,7 @@ int main(int argc, char *argv[])
     }
 
     if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1) {
-        return 1;
+        goto err_out1;
     }
 
     /*
Signature · 1 line
2.24.1
#102 lore raw

PATCH v2 79/109 virtiofsd: cleanup allocated resource in se

In reply to Dr. David Alan Gilbert (git)

From: Liu Bo <[email protected]>

This cleans up unfreed resources in se on quiting, including se->virtio_dev, se->vu_socket_path, se->vu_socketfd.

---
 tools/virtiofsd/fuse_lowlevel.c | 7 +++++++
 tools/virtiofsd/fuse_virtio.c   | 7 +++++++
 tools/virtiofsd/fuse_virtio.h   | 2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)
tools/virtiofsd/fuse_lowlevel.c +7 -0
index 7dafe02db8..2df120f35c 100644
@@ -2536,6 +2536,13 @@ void fuse_session_destroy(struct fuse_session *se)
     if (se->fd != -1) {
         close(se->fd);
     }
+
+    if (se->vu_socket_path) {
+        virtio_session_close(se);
+        free(se->vu_socket_path);
+        se->vu_socket_path = NULL;
+    }
+
     free(se);
 }
 
tools/virtiofsd/fuse_virtio.c +7 -0
index 7a8774a3ee..e7bd772805 100644
@@ -833,3 +833,10 @@ int virtio_session_mount(struct fuse_session *se)
 
     return 0;
 }
+
+void virtio_session_close(struct fuse_session *se)
+{
+    close(se->vu_socketfd);
+    free(se->virtio_dev);
+    se->virtio_dev = NULL;
+}
tools/virtiofsd/fuse_virtio.h +1 -1
index cc676b9193..111684032c 100644
@@ -19,7 +19,7 @@
 struct fuse_session;
 
 int virtio_session_mount(struct fuse_session *se);
-
+void virtio_session_close(struct fuse_session *se);
 int virtio_loop(struct fuse_session *se);
 
 
Signature · 1 line
2.24.1
#103 lore raw

PATCH v2 80/109 virtiofsd: fix memory leak on lo.source

In reply to Dr. David Alan Gilbert (git)

From: Liu Bo <[email protected]>

valgrind reported that lo.source is leaked on quiting, but it was defined as (const char*) as it may point to a const string "/".

---
 tools/virtiofsd/passthrough_ll.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/virtiofsd/passthrough_ll.c +4 -3
index 4e01a37ddb..462c250382 100644
@@ -115,7 +115,7 @@ struct lo_data {
     int writeback;
     int flock;
     int xattr;
-    const char *source;
+    char *source;
     double timeout;
     int cache;
     int timeout_set;
@@ -2497,9 +2497,8 @@ int main(int argc, char *argv[])
             fuse_log(FUSE_LOG_ERR, "source is not a directory\n");
             exit(1);
         }
-
     } else {
-        lo.source = "/";
+        lo.source = strdup("/");
     }
     if (!lo.timeout_set) {
         switch (lo.cache) {
@@ -2570,5 +2569,7 @@ err_out1:
         close(lo.root.fd);
     }
 
+    free(lo.source);
+
     return ret ? 1 : 0;
 }
Signature · 1 line
2.24.1
#105 lore raw

PATCH v2 81/109 virtiofsd: add helper for lo_data cleanup

In reply to Dr. David Alan Gilbert (git)

From: Liu Bo <[email protected]>

This offers an helper function for lo_data's cleanup.

---
 tools/virtiofsd/passthrough_ll.c | 37 ++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 16 deletions(-)
tools/virtiofsd/passthrough_ll.c +21 -16
index 462c250382..ac40cd4391 100644
@@ -2407,6 +2407,26 @@ static gboolean lo_key_equal(gconstpointer a, gconstpointer b)
     return la->ino == lb->ino && la->dev == lb->dev;
 }
 
+static void fuse_lo_data_cleanup(struct lo_data *lo)
+{
+    if (lo->inodes) {
+        g_hash_table_destroy(lo->inodes);
+    }
+    lo_map_destroy(&lo->fd_map);
+    lo_map_destroy(&lo->dirp_map);
+    lo_map_destroy(&lo->ino_map);
+
+    if (lo->proc_self_fd >= 0) {
+        close(lo->proc_self_fd);
+    }
+
+    if (lo->root.fd >= 0) {
+        close(lo->root.fd);
+    }
+
+    free(lo->source);
+}
+
 int main(int argc, char *argv[])
 {
     struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -2554,22 +2574,7 @@ err_out2:
 err_out1:
     fuse_opt_free_args(&args);
 
-    if (lo.inodes) {
-        g_hash_table_destroy(lo.inodes);
-    }
-    lo_map_destroy(&lo.fd_map);
-    lo_map_destroy(&lo.dirp_map);
-    lo_map_destroy(&lo.ino_map);
-
-    if (lo.proc_self_fd >= 0) {
-        close(lo.proc_self_fd);
-    }
-
-    if (lo.root.fd >= 0) {
-        close(lo.root.fd);
-    }
-
-    free(lo.source);
+    fuse_lo_data_cleanup(&lo);
 
     return ret ? 1 : 0;
 }
Signature · 1 line
2.24.1
#106 lore raw

PATCH v2 82/109 virtiofsd: Prevent multiply running with same vhost_user_socket

In reply to Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

virtiofsd can run multiply even if the vhost_user_socket is same path.

]# ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu -o source=/tmp/share &
[1] 244965
virtio_session_mount: Waiting for vhost-user socket connection... ]# ./virtiofsd -o vhost_user_socket=/tmp/vhostqemu -o source=/tmp/share &
[2] 244966
virtio_session_mount: Waiting for vhost-user socket connection... ]#

The user will get confused about the situation and maybe the cause of the unexpected problem. So it's better to prevent the multiple running.

Create a regular file under localstatedir directory to exclude the vhost_user_socket. To create and lock the file, use qemu_write_pidfile() because the API has some sanity checks and file lock.

Applied fixes from Stefan's review and moved osdep include

---
 tools/virtiofsd/fuse_lowlevel.c |  1 +
 tools/virtiofsd/fuse_virtio.c   | 49 ++++++++++++++++++++++++++++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)
tools/virtiofsd/fuse_lowlevel.c +1 -0
index 2df120f35c..22f2cc9409 100644
@@ -17,6 +17,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <glib.h>
 #include <limits.h>
 #include <stdbool.h>
 #include <stddef.h>
tools/virtiofsd/fuse_virtio.c +48 -1

71 lines not on this page · raw message

Signature · 1 line
2.24.1
#107 lore raw

PATCH v2 83/109 virtiofsd: enable PARALLEL_DIROPS during INIT

In reply to Dr. David Alan Gilbert (git)

From: Liu Bo <[email protected]>

lookup is a RO operations, PARALLEL_DIROPS can be enabled.

---
 tools/virtiofsd/fuse_lowlevel.c | 3 +++
 1 file changed, 3 insertions(+)
tools/virtiofsd/fuse_lowlevel.c +3 -0
index 22f2cc9409..6e8c30fd9b 100644
@@ -2063,6 +2063,9 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,
     if (se->conn.want & FUSE_CAP_ASYNC_READ) {
         outarg.flags |= FUSE_ASYNC_READ;
     }
+    if (se->conn.want & FUSE_CAP_PARALLEL_DIROPS) {
+        outarg.flags |= FUSE_PARALLEL_DIROPS;
+    }
     if (se->conn.want & FUSE_CAP_POSIX_LOCKS) {
         outarg.flags |= FUSE_POSIX_LOCKS;
     }
Signature · 1 line
2.24.1
#108 lore raw

PATCH v2 84/109 virtiofsd: fix incorrect error handling in lo_do_lookup

In reply to Dr. David Alan Gilbert (git)

From: Eric Ren <[email protected]>

---
 tools/virtiofsd/passthrough_ll.c | 1 -
 1 file changed, 1 deletion(-)
tools/virtiofsd/passthrough_ll.c +0 -1
index ac40cd4391..f8dd36b1c8 100644
@@ -814,7 +814,6 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         close(newfd);
         newfd = -1;
     } else {
-        saverr = ENOMEM;
         inode = calloc(1, sizeof(struct lo_inode));
         if (!inode) {
             goto out_err;
Signature · 1 line
2.24.1
#109 lore raw

PATCH v2 85/109 Virtiofsd: fix memory leak on fuse queueinfo

In reply to Dr. David Alan Gilbert (git)

From: Liu Bo <[email protected]>

For fuse's queueinfo, both queueinfo array and queueinfos are allocated in fv_queue_set_started() but not cleaned up when the daemon process quits.

This fixes the leak in proper places.

---
 tools/virtiofsd/fuse_virtio.c | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/virtiofsd/fuse_virtio.c +8 -0
index b7948def27..fb8d6d1379 100644
@@ -625,6 +625,8 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx)
     }
     close(ourqi->kill_fd);
     ourqi->kick_fd = -1;
+    free(vud->qi[qidx]);
+    vud->qi[qidx] = NULL;
 }
 
 /* Callback from libvhost-user on start or stop of a queue */
@@ -884,6 +886,12 @@ int virtio_session_mount(struct fuse_session *se)
 void virtio_session_close(struct fuse_session *se)
 {
     close(se->vu_socketfd);
+
+    if (!se->virtio_dev) {
+        return;
+    }
+
+    free(se->virtio_dev->qi);
     free(se->virtio_dev);
     se->virtio_dev = NULL;
 }
Signature · 1 line
2.24.1
#110 lore raw

PATCH v2 86/109 virtiofsd: Support remote posix locks

In reply to Dr. David Alan Gilbert (git)

From: Vivek Goyal <[email protected]>

Doing posix locks with-in guest kernel are not sufficient if a file/dir is being shared by multiple guests. So we need the notion of daemon doing the locks which are visible to rest of the guests.

Given posix locks are per process, one can not call posix lock API on host, otherwise bunch of basic posix locks properties are broken. For example, If two processes (A and B) in guest open the file and take locks on different sections of file, if one of the processes closes the fd, it will close fd on virtiofsd and all posix locks on file will go away. This means if process A closes the fd, then locks of process B will go away too.

Similar other problems exist too.

This patch set tries to emulate posix locks while using open file description locks provided on Linux.

Daemon provides two options (-o posix_lock, -o no_posix_lock) to enable or disable posix locking in daemon. By default it is enabled.

There are few issues though.

- GETLK() returns pid of process holding lock. As we are emulating locks using OFD, and these locks are not per process and don't return pid of process, so GETLK() in guest does not reuturn process pid.

- As of now only F_SETLK is supported and not F_SETLKW. We can't block the thread in virtiofsd for arbitrary long duration as there is only one thread serving the queue. That means unlock request will not make it to daemon and F_SETLKW will block infinitely and bring virtio-fs to a halt. This is a solvable problem though and will require significant changes in virtiofsd and kernel. Left as a TODO item for now.

---
 tools/virtiofsd/helper.c         |   3 +
 tools/virtiofsd/passthrough_ll.c | 189 +++++++++++++++++++++++++++++++
 2 files changed, 192 insertions(+)
tools/virtiofsd/helper.c +3 -0
index 93bb0713a9..781c47031c 100644
@@ -157,6 +157,9 @@ void fuse_cmdline_help(void)
            "                               allowed (default: 10)\n"
            "    -o norace                  disable racy fallback\n"
            "                               default: false\n"
+           "    -o posix_lock|no_posix_lock\n"
+           "                               enable/disable remote posix lock\n"
+           "                               default: posix_lock\n"
            "    -o readdirplus|no_readdirplus\n"
            "                               enable/disable readirplus\n"
            "                               default: readdirplus\n"
tools/virtiofsd/passthrough_ll.c +189 -0

261 lines not on this page · raw message

Signature · 1 line
2.24.1
#111 lore raw

PATCH v2 87/109 virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy()

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

vu_socket_path is NULL when --fd=FDNUM was used. Use fuse_lowlevel_is_virtio() instead.

---
 tools/virtiofsd/fuse_lowlevel.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
tools/virtiofsd/fuse_lowlevel.c +4 -3
index 6e8c30fd9b..fe332bcb90 100644
@@ -2541,12 +2541,13 @@ void fuse_session_destroy(struct fuse_session *se)
         close(se->fd);
     }
 
-    if (se->vu_socket_path) {
+    if (fuse_lowlevel_is_virtio(se)) {
         virtio_session_close(se);
-        free(se->vu_socket_path);
-        se->vu_socket_path = NULL;
     }
 
+    free(se->vu_socket_path);
+    se->vu_socket_path = NULL;
+
     free(se);
 }
 
Signature · 1 line
2.24.1
#112 lore raw

PATCH v2 88/109 virtiofsd: prevent fv_queue_thread() vs virtio_loop() races

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

We call into libvhost-user from the virtqueue handler thread and the vhost-user message processing thread without a lock. There is nothing protecting the virtqueue handler thread if the vhost-user message processing thread changes the virtqueue or memory table while it is running.

This patch introduces a read-write lock. Virtqueue handler threads are readers. The vhost-user message processing thread is a writer. This will allow concurrency for multiqueue in the future while protecting against fv_queue_thread() vs virtio_loop() races.

Note that the critical sections could be made smaller but it would be more invasive and require libvhost-user changes. Let's start simple and improve performance later, if necessary. Another option would be an RCU-style approach with lighter-weight primitives.

---
 tools/virtiofsd/fuse_virtio.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
tools/virtiofsd/fuse_virtio.c +33 -1
index fb8d6d1379..f6242f9338 100644
@@ -58,6 +58,18 @@ struct fv_VuDev {
     VuDev dev;
     struct fuse_session *se;
 
+    /*
+     * Either handle virtqueues or vhost-user protocol messages.  Don't do
+     * both at the same time since that could lead to race conditions if
+     * virtqueues or memory tables change while another thread is accessing
+     * them.
+     *
+     * The assumptions are:
+     * 1. fv_queue_thread() reads/writes to virtqueues and only reads VuDev.
+     * 2. virtio_loop() reads/writes virtqueues and VuDev.
+     */
+    pthread_rwlock_t vu_dispatch_rwlock;
+
     /*
      * The following pair of fields are only accessed in the main
      * virtio_loop
@@ -415,6 +427,8 @@ static void *fv_queue_thread(void *opaque)
              qi->qidx, qi->kick_fd);
     while (1) {
         struct pollfd pf[2];
+        int ret;
+
         pf[0].fd = qi->kick_fd;
         pf[0].events = POLLIN;
         pf[0].revents = 0;
@@ -461,6 +475,9 @@ static void *fv_queue_thread(void *opaque)
             fuse_log(FUSE_LOG_ERR, "Eventfd_read for queue: %m\n");
             break;
         }
+        /* Mutual exclusion with virtio_loop() */
+        ret = pthread_rwlock_rdlock(&qi->virtio_dev->vu_dispatch_rwlock);
+        assert(ret == 0); /* there is no possible error case */
         /* out is from guest, in is too guest */
         unsigned int in_bytes, out_bytes;
         vu_queue_get_avail_bytes(dev, q, &in_bytes, &out_bytes, ~0, ~0);
@@ -469,6 +486,7 @@ static void *fv_queue_thread(void *opaque)
                  "%s: Queue %d gave evalue: %zx available: in: %u out: %u\n",
                  __func__, qi->qidx, (size_t)evalue, in_bytes, out_bytes);
 
+
         while (1) {
             bool allocated_bufv = false;
             struct fuse_bufvec bufv;
@@ -597,6 +615,8 @@ static void *fv_queue_thread(void *opaque)
             free(elem);
             elem = NULL;
         }
+
+        pthread_rwlock_unlock(&qi->virtio_dev->vu_dispatch_rwlock);
     }
 out:
     pthread_mutex_destroy(&ch.lock);
@@ -711,6 +731,8 @@ int virtio_loop(struct fuse_session *se)
 
     while (!fuse_session_exited(se)) {
         struct pollfd pf[1];
+        bool ok;
+        int ret;
         pf[0].fd = se->vu_socketfd;
         pf[0].events = POLLIN;
         pf[0].revents = 0;
@@ -735,7 +757,15 @@ int virtio_loop(struct fuse_session *se)
         }
         assert(pf[0].revents & POLLIN);
         fuse_log(FUSE_LOG_DEBUG, "%s: Got VU event\n", __func__);
-        if (!vu_dispatch(&se->virtio_dev->dev)) {
+        /* Mutual exclusion with fv_queue_thread() */
+        ret = pthread_rwlock_wrlock(&se->virtio_dev->vu_dispatch_rwlock);
+        assert(ret == 0); /* there is no possible error case */
+
+        ok = vu_dispatch(&se->virtio_dev->dev);
+
+        pthread_rwlock_unlock(&se->virtio_dev->vu_dispatch_rwlock);
+
+        if (!ok) {
             fuse_log(FUSE_LOG_ERR, "%s: vu_dispatch failed\n", __func__);
             break;
         }
@@ -877,6 +907,7 @@ int virtio_session_mount(struct fuse_session *se)
 
     se->vu_socketfd = data_sock;
     se->virtio_dev->se = se;
+    pthread_rwlock_init(&se->virtio_dev->vu_dispatch_rwlock, NULL);
     vu_init(&se->virtio_dev->dev, 2, se->vu_socketfd, fv_panic, fv_set_watch,
             fv_remove_watch, &fv_iface);
 
@@ -892,6 +923,7 @@ void virtio_session_close(struct fuse_session *se)
     }
 
     free(se->virtio_dev->qi);
+    pthread_rwlock_destroy(&se->virtio_dev->vu_dispatch_rwlock);
     free(se->virtio_dev);
     se->virtio_dev = NULL;
 }
Signature · 1 line
2.24.1
#113 lore raw

PATCH v2 89/109 virtiofsd: make lo_release() atomic

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Hold the lock across both lo_map_get() and lo_map_remove() to prevent races between two FUSE_RELEASE requests. In this case I don't see a serious bug but it's safer to do things atomically.

---
 tools/virtiofsd/passthrough_ll.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
tools/virtiofsd/passthrough_ll.c +8 -4
index d7386d8a13..c52f7c2c32 100644
@@ -1772,14 +1772,18 @@ static void lo_release(fuse_req_t req, fuse_ino_t ino,
                        struct fuse_file_info *fi)
 {
     struct lo_data *lo = lo_data(req);
-    int fd;
+    struct lo_map_elem *elem;
+    int fd = -1;
 
     (void)ino;
 
-    fd = lo_fi_fd(req, fi);
-
     pthread_mutex_lock(&lo->mutex);
-    lo_map_remove(&lo->fd_map, fi->fh);
+    elem = lo_map_get(&lo->fd_map, fi->fh);
+    if (elem) {
+        fd = elem->fd;
+        elem = NULL;
+        lo_map_remove(&lo->fd_map, fi->fh);
+    }
     pthread_mutex_unlock(&lo->mutex);
 
     close(fd);
Signature · 1 line
2.24.1
#114 lore raw

PATCH v2 90/109 virtiofsd: prevent races with lo_dirp_put()

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Introduce lo_dirp_put() so that FUSE_RELEASEDIR does not cause use-after-free races with other threads that are accessing lo_dirp.

Also make lo_releasedir() atomic to prevent FUSE_RELEASEDIR racing with itself. This prevents double-frees.

---
 tools/virtiofsd/passthrough_ll.c | 41 +++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 6 deletions(-)
tools/virtiofsd/passthrough_ll.c +35 -6
index c52f7c2c32..e40268fce5 100644
@@ -1284,11 +1284,28 @@ static void lo_readlink(fuse_req_t req, fuse_ino_t ino)
 }
 
 struct lo_dirp {
+    gint refcount;
     DIR *dp;
     struct dirent *entry;
     off_t offset;
 };
 
+static void lo_dirp_put(struct lo_dirp **dp)
+{
+    struct lo_dirp *d = *dp;
+
+    if (!d) {
+        return;
+    }
+    *dp = NULL;
+
+    if (g_atomic_int_dec_and_test(&d->refcount)) {
+        closedir(d->dp);
+        free(d);
+    }
+}
+
+/* Call lo_dirp_put() on the return value when no longer needed */
 static struct lo_dirp *lo_dirp(fuse_req_t req, struct fuse_file_info *fi)
 {
     struct lo_data *lo = lo_data(req);
@@ -1296,6 +1313,9 @@ static struct lo_dirp *lo_dirp(fuse_req_t req, struct fuse_file_info *fi)
 
     pthread_mutex_lock(&lo->mutex);
     elem = lo_map_get(&lo->dirp_map, fi->fh);
+    if (elem) {
+        g_atomic_int_inc(&elem->dirp->refcount);
+    }
     pthread_mutex_unlock(&lo->mutex);
     if (!elem) {
         return NULL;
@@ -1331,6 +1351,7 @@ static void lo_opendir(fuse_req_t req, fuse_ino_t ino,
     d->offset = 0;
     d->entry = NULL;
 
+    g_atomic_int_set(&d->refcount, 1); /* paired with lo_releasedir() */
     pthread_mutex_lock(&lo->mutex);
     fh = lo_add_dirp_mapping(req, d);
     pthread_mutex_unlock(&lo->mutex);
@@ -1364,7 +1385,7 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
                           off_t offset, struct fuse_file_info *fi, int plus)
 {
     struct lo_data *lo = lo_data(req);
-    struct lo_dirp *d;
+    struct lo_dirp *d = NULL;
     struct lo_inode *dinode;
     char *buf = NULL;
     char *p;
@@ -1454,6 +1475,8 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
 
     err = 0;
 error:
+    lo_dirp_put(&d);
+
     /*
      * If there's an error, we can only signal it if we haven't stored
      * any entries yet - otherwise we'd end up with wrong lookup
@@ -1484,22 +1507,25 @@ static void lo_releasedir(fuse_req_t req, fuse_ino_t ino,
                           struct fuse_file_info *fi)
 {
     struct lo_data *lo = lo_data(req);
+    struct lo_map_elem *elem;
     struct lo_dirp *d;
 
     (void)ino;
 
-    d = lo_dirp(req, fi);
-    if (!d) {
+    pthread_mutex_lock(&lo->mutex);
+    elem = lo_map_get(&lo->dirp_map, fi->fh);
+    if (!elem) {
+        pthread_mutex_unlock(&lo->mutex);
         fuse_reply_err(req, EBADF);
         return;
     }
 
-    pthread_mutex_lock(&lo->mutex);
+    d = elem->dirp;
     lo_map_remove(&lo->dirp_map, fi->fh);
     pthread_mutex_unlock(&lo->mutex);
 
-    closedir(d->dp);
-    free(d);
+    lo_dirp_put(&d); /* paired with lo_opendir() */
+
     fuse_reply_err(req, 0);
 }
 
@@ -1710,6 +1736,9 @@ static void lo_fsyncdir(fuse_req_t req, fuse_ino_t ino, int datasync,
     } else {
         res = fsync(fd);
     }
+
+    lo_dirp_put(&d);
+
     fuse_reply_err(req, res == -1 ? errno : 0);
 }
 
Signature · 1 line
2.24.1
#115 lore raw

PATCH v2 91/109 virtiofsd: rename inode->refcount to inode->nlookup

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

This reference counter plays a specific role in the FUSE protocol. It's not a generic object reference counter and the FUSE kernel code calls it "nlookup".

---
 tools/virtiofsd/passthrough_ll.c | 37 +++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 12 deletions(-)
tools/virtiofsd/passthrough_ll.c +25 -12
index e40268fce5..9f37829824 100644
@@ -99,7 +99,20 @@ struct lo_inode {
     int fd;
     bool is_symlink;
     struct lo_key key;
-    uint64_t refcount; /* protected by lo->mutex */
+
+    /*
+     * This counter keeps the inode alive during the FUSE session.
+     * Incremented when the FUSE inode number is sent in a reply
+     * (FUSE_LOOKUP, FUSE_READDIRPLUS, etc).  Decremented when an inode is
+     * released by requests like FUSE_FORGET, FUSE_RMDIR, FUSE_RENAME, etc.
+     *
+     * Note that this value is untrusted because the client can manipulate
+     * it arbitrarily using FUSE_FORGET requests.
+     *
+     * Protected by lo->mutex.
+     */
+    uint64_t nlookup;
+
     fuse_ino_t fuse_ino;
     pthread_mutex_t plock_mutex;
     GHashTable *posix_locks; /* protected by lo_inode->plock_mutex */
@@ -568,7 +581,7 @@ retry:
     if (last == path) {
         p = &lo->root;
         pthread_mutex_lock(&lo->mutex);
-        p->refcount++;
+        p->nlookup++;
         pthread_mutex_unlock(&lo->mutex);
     } else {
         *last = '\0';
@@ -786,8 +799,8 @@ static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st)
     pthread_mutex_lock(&lo->mutex);
     p = g_hash_table_lookup(lo->inodes, &key);
     if (p) {
-        assert(p->refcount > 0);
-        p->refcount++;
+        assert(p->nlookup > 0);
+        p->nlookup++;
     }
     pthread_mutex_unlock(&lo->mutex);
 
@@ -855,7 +868,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         }
 
         inode->is_symlink = S_ISLNK(e->attr.st_mode);
-        inode->refcount = 1;
+        inode->nlookup = 1;
         inode->fd = newfd;
         newfd = -1;
         inode->key.ino = e->attr.st_ino;
@@ -1112,7 +1125,7 @@ static void lo_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t parent,
     }
 
     pthread_mutex_lock(&lo->mutex);
-    inode->refcount++;
+    inode->nlookup++;
     pthread_mutex_unlock(&lo->mutex);
     e.ino = inode->fuse_ino;
 
@@ -1193,9 +1206,9 @@ static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
     }
 
     pthread_mutex_lock(&lo->mutex);
-    assert(inode->refcount >= n);
-    inode->refcount -= n;
-    if (!inode->refcount) {
+    assert(inode->nlookup >= n);
+    inode->nlookup -= n;
+    if (!inode->nlookup) {
         lo_map_remove(&lo->ino_map, inode->fuse_ino);
         g_hash_table_remove(lo->inodes, &inode->key);
         if (g_hash_table_size(inode->posix_locks)) {
@@ -1216,7 +1229,7 @@ static int unref_all_inodes_cb(gpointer key, gpointer value, gpointer user_data)
     struct lo_inode *inode = value;
     struct lo_data *lo = user_data;
 
-    inode->refcount = 0;
+    inode->nlookup = 0;
     lo_map_remove(&lo->ino_map, inode->fuse_ino);
     close(inode->fd);
 
@@ -1241,7 +1254,7 @@ static void lo_forget_one(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
     }
 
     fuse_log(FUSE_LOG_DEBUG, "  forget %lli %lli -%lli\n",
-             (unsigned long long)ino, (unsigned long long)inode->refcount,
+             (unsigned long long)ino, (unsigned long long)inode->nlookup,
              (unsigned long long)nlookup);
 
     unref_inode_lolocked(lo, inode, nlookup);
@@ -2609,7 +2622,7 @@ static void setup_root(struct lo_data *lo, struct lo_inode *root)
     root->fd = fd;
     root->key.ino = stat.st_ino;
     root->key.dev = stat.st_dev;
-    root->refcount = 2;
+    root->nlookup = 2;
 }
 
 static guint lo_key_hash(gconstpointer key)
Signature · 1 line
2.24.1
#116 lore raw

PATCH v2 92/109 libvhost-user: Fix some memtable remap cases

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

If a new setmemtable command comes in once the vhost threads are running, it will remap the guests address space and the threads will now be looking in the wrong place.

Fortunately we're running this command under lock, so we can update the queue mappings so that threads will look in the new-right place.

Note: This doesn't fix things that the threads might be doing without a lock (e.g. a readv/writev!) That's for another time.

---
 contrib/libvhost-user/libvhost-user.c | 33 ++++++++++++++++++++-------
 contrib/libvhost-user/libvhost-user.h |  3 +++
 2 files changed, 28 insertions(+), 8 deletions(-)
contrib/libvhost-user/libvhost-user.c +25 -8
index 63e41062a4..b89bf18501 100644
@@ -564,6 +564,21 @@ vu_reset_device_exec(VuDev *dev, VhostUserMsg *vmsg)
     return false;
 }
 
+static bool
+map_ring(VuDev *dev, VuVirtq *vq)
+{
+    vq->vring.desc = qva_to_va(dev, vq->vra.desc_user_addr);
+    vq->vring.used = qva_to_va(dev, vq->vra.used_user_addr);
+    vq->vring.avail = qva_to_va(dev, vq->vra.avail_user_addr);
+
+    DPRINT("Setting virtq addresses:\n");
+    DPRINT("    vring_desc  at %p\n", vq->vring.desc);
+    DPRINT("    vring_used  at %p\n", vq->vring.used);
+    DPRINT("    vring_avail at %p\n", vq->vring.avail);
+
+    return !(vq->vring.desc && vq->vring.used && vq->vring.avail);
+}
+
 static bool
 vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg)
 {
@@ -767,6 +782,14 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg)
         close(vmsg->fds[i]);
     }
 
+    for (i = 0; i < dev->max_queues; i++) {
+        if (dev->vq[i].vring.desc) {
+            if (map_ring(dev, &dev->vq[i])) {
+                vu_panic(dev, "remaping queue %d during setmemtable", i);
+            }
+        }
+    }
+
     return false;
 }
 
@@ -853,18 +876,12 @@ vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg)
     DPRINT("    avail_user_addr:  0x%016" PRIx64 "\n", vra->avail_user_addr);
     DPRINT("    log_guest_addr:   0x%016" PRIx64 "\n", vra->log_guest_addr);
 
+    vq->vra = *vra;
     vq->vring.flags = vra->flags;
-    vq->vring.desc = qva_to_va(dev, vra->desc_user_addr);
-    vq->vring.used = qva_to_va(dev, vra->used_user_addr);
-    vq->vring.avail = qva_to_va(dev, vra->avail_user_addr);
     vq->vring.log_guest_addr = vra->log_guest_addr;
 
-    DPRINT("Setting virtq addresses:\n");
-    DPRINT("    vring_desc  at %p\n", vq->vring.desc);
-    DPRINT("    vring_used  at %p\n", vq->vring.used);
-    DPRINT("    vring_avail at %p\n", vq->vring.avail);
 
-    if (!(vq->vring.desc && vq->vring.used && vq->vring.avail)) {
+    if (map_ring(dev, vq)) {
         vu_panic(dev, "Invalid vring_addr message");
         return false;
     }
contrib/libvhost-user/libvhost-user.h +3 -0
index 1844b6f8d4..5cb7708559 100644
@@ -327,6 +327,9 @@ typedef struct VuVirtq {
     int err_fd;
     unsigned int enable;
     bool started;
+
+    /* Guest addresses of our ring */
+    struct vhost_vring_addr vra;
 } VuVirtq;
 
 enum VuWatchCondtion {
Signature · 1 line
2.24.1
#117 lore raw

PATCH v2 93/109 virtiofsd: add man page

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

with additions by:

---
 Makefile                       |   7 +++
 tools/virtiofsd/virtiofsd.texi | 104 +++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100644 tools/virtiofsd/virtiofsd.texi
Makefile +7 -0
index 2375a1f81c..ba7e2e5ebc 100644
@@ -353,6 +353,9 @@ DOCS+=$(MANUAL_BUILDDIR)/index.html
 ifdef CONFIG_VIRTFS
 DOCS+=fsdev/virtfs-proxy-helper.1
 endif
+ifdef CONFIG_LINUX
+DOCS+=tools/virtiofsd/virtiofsd.1
+endif
 ifdef CONFIG_TRACE_SYSTEMTAP
 DOCS+=scripts/qemu-trace-stap.1
 endif
@@ -857,6 +860,9 @@ ifdef CONFIG_VIRTFS
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
 endif
+ifdef CONFIG_LINUX
+	$(INSTALL_DATA) tools/virtiofsd/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
+endif
 
 install-datadir:
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
@@ -1065,6 +1071,7 @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
 qemu.1: qemu-option-trace.texi
 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
+tools/virtiofsd/virtiofsd.1: tools/virtiofsd/virtiofsd.texi
 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
 docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
tools/virtiofsd/virtiofsd.texi new file +104 -0

104 lines not on this page · raw message

Signature · 1 line
2.24.1
Tested-by on v2 93/109
#118 lore raw

Re: [PATCH v2 093/109] virtiofsd: add man page

Quoted 9 lines · Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

with additions by:

Quoted 149 lines
---
  Makefile                       |   7 +++
  tools/virtiofsd/virtiofsd.texi | 104 +++++++++++++++++++++++++++++++++
  2 files changed, 111 insertions(+)

create mode 100644 tools/virtiofsd/virtiofsd.texi

Makefile +7 -0
index 2375a1f81c..ba7e2e5ebc 100644
@@ -353,6 +353,9 @@ DOCS+=$(MANUAL_BUILDDIR)/index.html
  ifdef CONFIG_VIRTFS
  DOCS+=fsdev/virtfs-proxy-helper.1
  endif
+ifdef CONFIG_LINUX
+DOCS+=tools/virtiofsd/virtiofsd.1
+endif
  ifdef CONFIG_TRACE_SYSTEMTAP
  DOCS+=scripts/qemu-trace-stap.1
  endif
@@ -857,6 +860,9 @@ ifdef CONFIG_VIRTFS
  	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
  	$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
  endif
+ifdef CONFIG_LINUX
+	$(INSTALL_DATA) tools/virtiofsd/virtiofsd.1 "$(DESTDIR)$(mandir)/man1"
+endif
 
  install-datadir:
  	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)"
@@ -1065,6 +1071,7 @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
  qemu.1: qemu-option-trace.texi
  qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
  fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
+tools/virtiofsd/virtiofsd.1: tools/virtiofsd/virtiofsd.texi
  qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
  docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
  docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
tools/virtiofsd/virtiofsd.texi new file +104 -0
new file mode 100644
index 0000000000..d7a2528f7d
@@ -0,0 +1,104 @@
+@example
+@c man begin SYNOPSIS
+@command{virtiofsd} [OPTION] @option{--socket-path=}@var{path}|@option{--fd=}@var{fdnum} @option{-o source=}@var{path}
+@c man end
+@end example
+
+@c man begin DESCRIPTION
+
+Share a host directory tree with a guest through a virtio-fs device.  This
+program is a vhost-user backend that implements the virtio-fs device.  Each
+virtio-fs device instance requires its own virtiofsd process.
+
+This program is designed to work with QEMU's @code{--device vhost-user-fs-pci}
+but should work with any virtual machine monitor (VMM) that supports
+vhost-user.  See the EXAMPLES section below.
+
+This program must be run as the root user.  Upon startup the program will
+switch into a new file system namespace with the shared directory tree as its
+root.  This prevents "file system escapes" due to symlinks and other file
+system objects that might lead to files outside the shared directory.  The
+program also sandboxes itself using seccomp(2) to prevent ptrace(2) and other
+vectors that could allow an attacker to compromise the system after gaining
+control of the virtiofsd process.
+
+@c man end
+
+@c man begin OPTIONS
+@table @option
+@item -h, --help
+Print help.
+@item -V, --version
+Print version.
+@item -d, -o debug
+Enable debug output.
+@item --syslog
+Print log messages to syslog instead of stderr.
+@item -o flock|no_flock
+enable/disable flock.
+The default is @var{no_flock}.
+@item -o log_level=@var{level}
+Print only log messages matching @var{level} or more severe.  @var{level} is
+one of @code{err}, @code{warn}, @code{info}, or @code{debug}.  The default is
+@var{info}.
+@item -o norace
+Disable racy fallback.
+The default is false.
+@item -o posix_lock|no_posix_lock
+Enable/Disable remote posix lock.
+The default is @var{posix_lock}.
+@item -o readdirplus|no_readdirplus
+Enable/Disable readdirplus.
+The default is @var{readdirplus}
+@item -o source=@var{path}
+Share host directory tree located at @var{path}.  This option is required.
+@item -o timeout=<number>
+I/O timeout (second).
+The default depends on cache= option.
+@item -o writeback|no_writeback
+Enable/Disable writeback cache. The cache alows the FUSE client
+to buffer and merge write requests.
+The default is @var{no_writeback}.
+@item -o xattr|no_xattr
+Enable/Disable Extended attributes (xattr) of the files and directories.
+The default is @var{no_xattr}.
+@item --socket-path=@var{path}, -o vhost_user_socket=@var{path}
+Listen on vhost-user UNIX domain socket at @var{path}.
+@item --fd=@var{fdnum}
+Accept connections from vhost-user UNIX domain socket file descriptor @var{fdnum}.  The file descriptor must already be listening for connections.
+@item --thread-pool-size=@var{num}
+Restrict the number of worker threads per request queue to @var{num}.  The default is 64.
+@item --cache=@code{none}|@code{auto}|@code{always}
+Select the desired trade-off between coherency and performance.  @code{none}
+forbids the FUSE client from caching to achieve best coherency at the cost of
+performance.  @code{auto} acts similar to NFS with a 1 second metadata cache
+timeout.  @code{always} sets a long cache lifetime at the expense of coherency.
+@end table
+@c man end
+
+@c man begin EXAMPLES
+Export @code{/var/lib/fs/vm001/} on vhost-user UNIX domain socket @code{/var/run/vm001-vhost-fs.sock}:
+
+@example
+host# virtiofsd --socket-path=/var/run/vm001-vhost-fs.sock -o source=/var/lib/fs/vm001
+host# qemu-system-x86_64 \
+    -chardev socket,id=char0,path=/var/run/vm001-vhost-fs.sock \
+    -device vhost-user-fs-pci,chardev=char0,tag=myfs \
+    -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \
+    -numa node,memdev=mem \
+    ...
+guest# mount -t virtio_fs myfs /mnt
+@end example
+@c man end
+
+@ignore
+@setfilename virtiofsd
+@settitle QEMU virtio-fs shared file system daemon
+
+@c man begin COPYRIGHT
+Copyright (C) 2019-2020 Red Hat, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+@c man end
+@end ignore
#119 lore raw

PATCH v2 94/109 virtiofsd: passthrough_ll: fix refcounting on remove/rename

In reply to Dr. David Alan Gilbert (git)

From: Miklos Szeredi <[email protected]>

---
 tools/virtiofsd/passthrough_ll.c | 50 +++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)
tools/virtiofsd/passthrough_ll.c +49 -1
index 9f37829824..0dc3011919 100644
@@ -1140,17 +1140,42 @@ out_err:
     fuse_reply_err(req, saverr);
 }
 
+static struct lo_inode *lookup_name(fuse_req_t req, fuse_ino_t parent,
+                                    const char *name)
+{
+    int res;
+    struct stat attr;
+
+    res = fstatat(lo_fd(req, parent), name, &attr,
+                  AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW);
+    if (res == -1) {
+        return NULL;
+    }
+
+    return lo_find(lo_data(req), &attr);
+}
+
 static void lo_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name)
 {
     int res;
+    struct lo_inode *inode;
+    struct lo_data *lo = lo_data(req);
+
     if (!is_safe_path_component(name)) {
         fuse_reply_err(req, EINVAL);
         return;
     }
 
+    inode = lookup_name(req, parent, name);
+    if (!inode) {
+        fuse_reply_err(req, EIO);
+        return;
+    }
+
     res = unlinkat(lo_fd(req, parent), name, AT_REMOVEDIR);
 
     fuse_reply_err(req, res == -1 ? errno : 0);
+    unref_inode_lolocked(lo, inode, 1);
 }
 
 static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
@@ -1158,12 +1183,23 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
                       unsigned int flags)
 {
     int res;
+    struct lo_inode *oldinode;
+    struct lo_inode *newinode;
+    struct lo_data *lo = lo_data(req);
 
     if (!is_safe_path_component(name) || !is_safe_path_component(newname)) {
         fuse_reply_err(req, EINVAL);
         return;
     }
 
+    oldinode = lookup_name(req, parent, name);
+    newinode = lookup_name(req, newparent, newname);
+
+    if (!oldinode) {
+        fuse_reply_err(req, EIO);
+        goto out;
+    }
+
     if (flags) {
 #ifndef SYS_renameat2
         fuse_reply_err(req, EINVAL);
@@ -1176,26 +1212,38 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
             fuse_reply_err(req, res == -1 ? errno : 0);
         }
 #endif
-        return;
+        goto out;
     }
 
     res = renameat(lo_fd(req, parent), name, lo_fd(req, newparent), newname);
 
     fuse_reply_err(req, res == -1 ? errno : 0);
+out:
+    unref_inode_lolocked(lo, oldinode, 1);
+    unref_inode_lolocked(lo, newinode, 1);
 }
 
 static void lo_unlink(fuse_req_t req, fuse_ino_t parent, const char *name)
 {
     int res;
+    struct lo_inode *inode;
+    struct lo_data *lo = lo_data(req);
 
     if (!is_safe_path_component(name)) {
         fuse_reply_err(req, EINVAL);
         return;
     }
 
+    inode = lookup_name(req, parent, name);
+    if (!inode) {
+        fuse_reply_err(req, EIO);
+        return;
+    }
+
     res = unlinkat(lo_fd(req, parent), name, 0);
 
     fuse_reply_err(req, res == -1 ? errno : 0);
+    unref_inode_lolocked(lo, inode, 1);
 }
 
 static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
Signature · 1 line
2.24.1
#120 lore raw

PATCH v2 95/109 virtiofsd: introduce inode refcount to prevent use-after-free

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

If thread A is using an inode it must not be deleted by thread B when processing a FUSE_FORGET request.

The FUSE protocol itself already has a counter called nlookup that is used in FUSE_FORGET messages. We cannot trust this counter since the untrusted client can manipulate it via FUSE_FORGET messages.

Introduce a new refcount to keep inodes alive for the required lifespan. lo_inode_put() must be called to release a reference. FUSE's nlookup counter holds exactly one reference so that the inode stays alive as long as the client still wants to remember it.

Note that the lo_inode->is_symlink field is moved to avoid creating a hole in the struct due to struct field alignment.

---
 tools/virtiofsd/passthrough_ll.c | 169 ++++++++++++++++++++++++++-----
 1 file changed, 146 insertions(+), 23 deletions(-)
tools/virtiofsd/passthrough_ll.c +146 -23
index 0dc3011919..820172308f 100644
@@ -97,7 +97,13 @@ struct lo_key {
 
 struct lo_inode {
     int fd;
-    bool is_symlink;
+
+    /*
+     * Atomic reference count for this object.  The nlookup field holds a
+     * reference and release it when nlookup reaches 0.
+     */
+    gint refcount;
+
     struct lo_key key;
 
     /*
@@ -116,6 +122,8 @@ struct lo_inode {
     fuse_ino_t fuse_ino;
     pthread_mutex_t plock_mutex;
     GHashTable *posix_locks; /* protected by lo_inode->plock_mutex */
+
+    bool is_symlink;
 };
 
 struct lo_cred {
@@ -471,6 +479,23 @@ static ssize_t lo_add_inode_mapping(fuse_req_t req, struct lo_inode *inode)
     return elem - lo_data(req)->ino_map.elems;
 }
 
+static void lo_inode_put(struct lo_data *lo, struct lo_inode **inodep)
+{
+    struct lo_inode *inode = *inodep;
+
+    if (!inode) {
+        return;
+    }
+
+    *inodep = NULL;
+
+    if (g_atomic_int_dec_and_test(&inode->refcount)) {
+        close(inode->fd);
+        free(inode);
+    }
+}
+
+/* Caller must release refcount using lo_inode_put() */
 static struct lo_inode *lo_inode(fuse_req_t req, fuse_ino_t ino)
 {
     struct lo_data *lo = lo_data(req);
@@ -478,6 +503,9 @@ static struct lo_inode *lo_inode(fuse_req_t req, fuse_ino_t ino)
 
     pthread_mutex_lock(&lo->mutex);
     elem = lo_map_get(&lo->ino_map, ino);
+    if (elem) {
+        g_atomic_int_inc(&elem->inode->refcount);
+    }
     pthread_mutex_unlock(&lo->mutex);
 
     if (!elem) {
@@ -487,10 +515,23 @@ static struct lo_inode *lo_inode(fuse_req_t req, fuse_ino_t ino)
     return elem->inode;
 }
 
+/*
+ * TODO Remove this helper and force callers to hold an inode refcount until
+ * they are done with the fd.  This will be done in a later patch to make
+ * review easier.
+ */
 static int lo_fd(fuse_req_t req, fuse_ino_t ino)
 {
     struct lo_inode *inode = lo_inode(req, ino);
-    return inode ? inode->fd : -1;
+    int fd;
+
+    if (!inode) {
+        return -1;
+    }
+
+    fd = inode->fd;
+    lo_inode_put(lo_data(req), &inode);
+    return fd;
 }
 
 static void lo_init(void *userdata, struct fuse_conn_info *conn)
@@ -545,6 +586,10 @@ static void lo_getattr(fuse_req_t req, fuse_ino_t ino,
     fuse_reply_attr(req, &buf, lo->timeout);
 }
 
+/*
+ * Increments parent->nlookup and caller must release refcount using
+ * lo_inode_put(&parent).
+ */
 static int lo_parent_and_name(struct lo_data *lo, struct lo_inode *inode,
                               char path[PATH_MAX], struct lo_inode **parent)
 {
@@ -582,6 +627,7 @@ retry:
         p = &lo->root;
         pthread_mutex_lock(&lo->mutex);
         p->nlookup++;
+        g_atomic_int_inc(&p->refcount);
         pthread_mutex_unlock(&lo->mutex);
     } else {
         *last = '\0';
@@ -625,6 +671,7 @@ retry:
 
 fail_unref:
     unref_inode_lolocked(lo, p, 1);
+    lo_inode_put(lo, &p);
 fail:
     if (retries) {
         retries--;
@@ -663,6 +710,7 @@ fallback:
     if (res != -1) {
         res = utimensat(parent->fd, path, tv, AT_SYMLINK_NOFOLLOW);
         unref_inode_lolocked(lo, parent, 1);
+        lo_inode_put(lo, &parent);
     }
 
     return res;
@@ -780,11 +828,13 @@ static void lo_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
             goto out_err;
         }
     }
+    lo_inode_put(lo, &inode);
 
     return lo_getattr(req, ino, fi);
 
 out_err:
     saverr = errno;
+    lo_inode_put(lo, &inode);
     fuse_reply_err(req, saverr);
 }
 
@@ -801,6 +851,7 @@ static struct lo_inode *lo_find(struct lo_data *lo, struct stat *st)
     if (p) {
         assert(p->nlookup > 0);
         p->nlookup++;
+        g_atomic_int_inc(&p->refcount);
     }
     pthread_mutex_unlock(&lo->mutex);
 
@@ -820,6 +871,10 @@ static void posix_locks_value_destroy(gpointer data)
     free(plock);
 }
 
+/*
+ * Increments nlookup and caller must release refcount using
+ * lo_inode_put(&parent).
+ */
 static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
                         struct fuse_entry_param *e)
 {
@@ -827,7 +882,8 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
     int res;
     int saverr;
     struct lo_data *lo = lo_data(req);
-    struct lo_inode *inode, *dir = lo_inode(req, parent);
+    struct lo_inode *inode = NULL;
+    struct lo_inode *dir = lo_inode(req, parent);
 
     /*
      * name_to_handle_at() and open_by_handle_at() can reach here with fuse
@@ -868,6 +924,13 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         }
 
         inode->is_symlink = S_ISLNK(e->attr.st_mode);
+
+        /*
+         * One for the caller and one for nlookup (released in
+         * unref_inode_lolocked())
+         */
+        g_atomic_int_set(&inode->refcount, 2);
+
         inode->nlookup = 1;
         inode->fd = newfd;
         newfd = -1;
@@ -883,6 +946,8 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
         pthread_mutex_unlock(&lo->mutex);
     }
     e->ino = inode->fuse_ino;
+    lo_inode_put(lo, &inode);
+    lo_inode_put(lo, &dir);
 
     fuse_log(FUSE_LOG_DEBUG, "  %lli/%s -> %lli\n", (unsigned long long)parent,
              name, (unsigned long long)e->ino);
@@ -894,6 +959,8 @@ out_err:
     if (newfd != -1) {
         close(newfd);
     }
+    lo_inode_put(lo, &inode);
+    lo_inode_put(lo, &dir);
     return saverr;
 }
 
@@ -991,6 +1058,7 @@ static void lo_mknod_symlink(fuse_req_t req, fuse_ino_t parent,
 {
     int res;
     int saverr;
+    struct lo_data *lo = lo_data(req);
     struct lo_inode *dir;
     struct fuse_entry_param e;
     struct lo_cred old = {};
@@ -1032,9 +1100,11 @@ static void lo_mknod_symlink(fuse_req_t req, fuse_ino_t parent,
              name, (unsigned long long)e.ino);
 
     fuse_reply_entry(req, &e);
+    lo_inode_put(lo, &dir);
     return;
 
 out:
+    lo_inode_put(lo, &dir);
     fuse_reply_err(req, saverr);
 }
 
@@ -1085,6 +1155,7 @@ fallback:
     if (res != -1) {
         res = linkat(parent->fd, path, dfd, name, 0);
         unref_inode_lolocked(lo, parent, 1);
+        lo_inode_put(lo, &parent);
     }
 
     return res;
@@ -1095,6 +1166,7 @@ static void lo_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t parent,
 {
     int res;
     struct lo_data *lo = lo_data(req);
+    struct lo_inode *parent_inode;
     struct lo_inode *inode;
     struct fuse_entry_param e;
     int saverr;
@@ -1104,17 +1176,18 @@ static void lo_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t parent,
         return;
     }
 
+    parent_inode = lo_inode(req, parent);
     inode = lo_inode(req, ino);
-    if (!inode) {
-        fuse_reply_err(req, EBADF);
-        return;
+    if (!parent_inode || !inode) {
+        errno = EBADF;
+        goto out_err;
     }
 
     memset(&e, 0, sizeof(struct fuse_entry_param));
     e.attr_timeout = lo->timeout;
     e.entry_timeout = lo->timeout;
 
-    res = linkat_empty_nofollow(lo, inode, lo_fd(req, parent), name);
+    res = linkat_empty_nofollow(lo, inode, parent_inode->fd, name);
     if (res == -1) {
         goto out_err;
     }
@@ -1133,13 +1206,18 @@ static void lo_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t parent,
              name, (unsigned long long)e.ino);
 
     fuse_reply_entry(req, &e);
+    lo_inode_put(lo, &parent_inode);
+    lo_inode_put(lo, &inode);
     return;
 
 out_err:
     saverr = errno;
+    lo_inode_put(lo, &parent_inode);
+    lo_inode_put(lo, &inode);
     fuse_reply_err(req, saverr);
 }
 
+/* Increments nlookup and caller must release refcount using lo_inode_put() */
 static struct lo_inode *lookup_name(fuse_req_t req, fuse_ino_t parent,
                                     const char *name)
 {
@@ -1176,6 +1254,7 @@ static void lo_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name)
 
     fuse_reply_err(req, res == -1 ? errno : 0);
     unref_inode_lolocked(lo, inode, 1);
+    lo_inode_put(lo, &inode);
 }
 
 static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
@@ -1183,8 +1262,10 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
                       unsigned int flags)
 {
     int res;
-    struct lo_inode *oldinode;
-    struct lo_inode *newinode;
+    struct lo_inode *parent_inode;
+    struct lo_inode *newparent_inode;
+    struct lo_inode *oldinode = NULL;
+    struct lo_inode *newinode = NULL;
     struct lo_data *lo = lo_data(req);
 
     if (!is_safe_path_component(name) || !is_safe_path_component(newname)) {
@@ -1192,6 +1273,13 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
         return;
     }
 
+    parent_inode = lo_inode(req, parent);
+    newparent_inode = lo_inode(req, newparent);
+    if (!parent_inode || !newparent_inode) {
+        fuse_reply_err(req, EBADF);
+        goto out;
+    }
+
     oldinode = lookup_name(req, parent, name);
     newinode = lookup_name(req, newparent, newname);
 
@@ -1204,8 +1292,8 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
 #ifndef SYS_renameat2
         fuse_reply_err(req, EINVAL);
 #else
-        res = syscall(SYS_renameat2, lo_fd(req, parent), name,
-                       lo_fd(req, newparent), newname, flags);
+        res = syscall(SYS_renameat2, parent_inode->fd, name,
+                        newparent_inode->fd, newname, flags);
         if (res == -1 && errno == ENOSYS) {
             fuse_reply_err(req, EINVAL);
         } else {
@@ -1215,12 +1303,16 @@ static void lo_rename(fuse_req_t req, fuse_ino_t parent, const char *name,
         goto out;
     }
 
-    res = renameat(lo_fd(req, parent), name, lo_fd(req, newparent), newname);
+    res = renameat(parent_inode->fd, name, newparent_inode->fd, newname);
 
     fuse_reply_err(req, res == -1 ? errno : 0);
 out:
     unref_inode_lolocked(lo, oldinode, 1);
     unref_inode_lolocked(lo, newinode, 1);
+    lo_inode_put(lo, &oldinode);
+    lo_inode_put(lo, &newinode);
+    lo_inode_put(lo, &parent_inode);
+    lo_inode_put(lo, &newparent_inode);
 }
 
 static void lo_unlink(fuse_req_t req, fuse_ino_t parent, const char *name)
@@ -1244,6 +1336,7 @@ static void lo_unlink(fuse_req_t req, fuse_ino_t parent, const char *name)
 
     fuse_reply_err(req, res == -1 ? errno : 0);
     unref_inode_lolocked(lo, inode, 1);
+    lo_inode_put(lo, &inode);
 }
 
 static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
@@ -1265,8 +1358,9 @@ static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
         g_hash_table_destroy(inode->posix_locks);
         pthread_mutex_destroy(&inode->plock_mutex);
         pthread_mutex_unlock(&lo->mutex);
-        close(inode->fd);
-        free(inode);
+
+        /* Drop our refcount from lo_do_lookup() */
+        lo_inode_put(lo, &inode);
     } else {
         pthread_mutex_unlock(&lo->mutex);
     }
@@ -1280,6 +1374,7 @@ static int unref_all_inodes_cb(gpointer key, gpointer value, gpointer user_data)
     inode->nlookup = 0;
     lo_map_remove(&lo->ino_map, inode->fuse_ino);
     close(inode->fd);
+    lo_inode_put(lo, &inode); /* Drop our refcount from lo_do_lookup() */
 
     return TRUE;
 }
@@ -1306,6 +1401,7 @@ static void lo_forget_one(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
              (unsigned long long)nlookup);
 
     unref_inode_lolocked(lo, inode, nlookup);
+    lo_inode_put(lo, &inode);
 }
 
 static void lo_forget(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
@@ -1537,6 +1633,7 @@ static void lo_do_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
     err = 0;
 error:
     lo_dirp_put(&d);
+    lo_inode_put(lo, &dinode);
 
     /*
      * If there's an error, we can only signal it if we haven't stored
@@ -1595,6 +1692,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
 {
     int fd;
     struct lo_data *lo = lo_data(req);
+    struct lo_inode *parent_inode;
     struct fuse_entry_param e;
     int err;
     struct lo_cred old = {};
@@ -1607,12 +1705,18 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
         return;
     }
 
+    parent_inode = lo_inode(req, parent);
+    if (!parent_inode) {
+        fuse_reply_err(req, EBADF);
+        return;
+    }
+
     err = lo_change_cred(req, &old);
     if (err) {
         goto out;
     }
 
-    fd = openat(lo_fd(req, parent), name, (fi->flags | O_CREAT) & ~O_NOFOLLOW,
+    fd = openat(parent_inode->fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW,
                 mode);
     err = fd == -1 ? errno : 0;
     lo_restore_cred(&old);
@@ -1625,8 +1729,8 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
         pthread_mutex_unlock(&lo->mutex);
         if (fh == -1) {
             close(fd);
-            fuse_reply_err(req, ENOMEM);
-            return;
+            err = ENOMEM;
+            goto out;
         }
 
         fi->fh = fh;
@@ -1639,6 +1743,8 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
     }
 
 out:
+    lo_inode_put(lo, &parent_inode);
+
     if (err) {
         fuse_reply_err(req, err);
     } else {
@@ -1712,16 +1818,18 @@ static void lo_getlk(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
     plock =
         lookup_create_plock_ctx(lo, inode, fi->lock_owner, lock->l_pid, &ret);
     if (!plock) {
-        pthread_mutex_unlock(&inode->plock_mutex);
-        fuse_reply_err(req, ret);
-        return;
+        saverr = ret;
+        goto out;
     }
 
     ret = fcntl(plock->fd, F_OFD_GETLK, lock);
     if (ret == -1) {
         saverr = errno;
     }
+
+out:
     pthread_mutex_unlock(&inode->plock_mutex);
+    lo_inode_put(lo, &inode);
 
     if (saverr) {
         fuse_reply_err(req, saverr);
@@ -1761,9 +1869,8 @@ static void lo_setlk(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
         lookup_create_plock_ctx(lo, inode, fi->lock_owner, lock->l_pid, &ret);
 
     if (!plock) {
-        pthread_mutex_unlock(&inode->plock_mutex);
-        fuse_reply_err(req, ret);
-        return;
+        saverr = ret;
+        goto out;
     }
 
     /* TODO: Is it alright to modify flock? */
@@ -1772,7 +1879,11 @@ static void lo_setlk(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
     if (ret == -1) {
         saverr = errno;
     }
+
+out:
     pthread_mutex_unlock(&inode->plock_mutex);
+    lo_inode_put(lo, &inode);
+
     fuse_reply_err(req, saverr);
 }
 
@@ -1898,6 +2009,7 @@ static void lo_flush(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
     pthread_mutex_unlock(&inode->plock_mutex);
 
     res = close(dup(lo_fi_fd(req, fi)));
+    lo_inode_put(lo_data(req), &inode);
     fuse_reply_err(req, res == -1 ? errno : 0);
 }
 
@@ -2115,11 +2227,14 @@ out_free:
     if (fd >= 0) {
         close(fd);
     }
+
+    lo_inode_put(lo, &inode);
     return;
 
 out_err:
     saverr = errno;
 out:
+    lo_inode_put(lo, &inode);
     fuse_reply_err(req, saverr);
     goto out_free;
 }
@@ -2190,11 +2305,14 @@ out_free:
     if (fd >= 0) {
         close(fd);
     }
+
+    lo_inode_put(lo, &inode);
     return;
 
 out_err:
     saverr = errno;
 out:
+    lo_inode_put(lo, &inode);
     fuse_reply_err(req, saverr);
     goto out_free;
 }
@@ -2243,6 +2361,8 @@ out:
     if (fd >= 0) {
         close(fd);
     }
+
+    lo_inode_put(lo, &inode);
     fuse_reply_err(req, saverr);
 }
 
@@ -2289,6 +2409,8 @@ out:
     if (fd >= 0) {
         close(fd);
     }
+
+    lo_inode_put(lo, &inode);
     fuse_reply_err(req, saverr);
 }
 
@@ -2671,6 +2793,7 @@ static void setup_root(struct lo_data *lo, struct lo_inode *root)
     root->key.ino = stat.st_ino;
     root->key.dev = stat.st_dev;
     root->nlookup = 2;
+    g_atomic_int_set(&root->refcount, 2);
 }
 
 static guint lo_key_hash(gconstpointer key)
Signature · 1 line
2.24.1
#121 lore raw

PATCH v2 96/109 virtiofsd: do not always set FUSE_FLOCK_LOCKS

In reply to Dr. David Alan Gilbert (git)

From: Peng Tao <[email protected]>

Right now we always enable it regardless of given commandlines. Fix it by setting the flag relying on the lo->flock bit.

---
 tools/virtiofsd/passthrough_ll.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
tools/virtiofsd/passthrough_ll.c +8 -3
index 820172308f..4c3a48325f 100644
@@ -546,9 +546,14 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating writeback\n");
         conn->want |= FUSE_CAP_WRITEBACK_CACHE;
     }
-    if (lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
-        fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
-        conn->want |= FUSE_CAP_FLOCK_LOCKS;
+    if (conn->capable & FUSE_CAP_FLOCK_LOCKS) {
+        if (lo->flock) {
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
+            conn->want |= FUSE_CAP_FLOCK_LOCKS;
+        } else {
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling flock locks\n");
+            conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
+        }
     }
 
     if (conn->capable & FUSE_CAP_POSIX_LOCKS) {
Signature · 1 line
2.24.1
#122 lore raw

PATCH v2 97/109 virtiofsd: convert more fprintf and perror to use fuse log infra

In reply to Dr. David Alan Gilbert (git)

From: Eryu Guan <[email protected]>

---
 tools/virtiofsd/fuse_signals.c | 7 +++++--
 tools/virtiofsd/helper.c       | 9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)
tools/virtiofsd/fuse_signals.c +5 -2
index 10a6f88088..5364cbe984 100644
@@ -11,6 +11,7 @@
 #include "fuse_i.h"
 #include "fuse_lowlevel.h"
 
+#include <errno.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -46,13 +47,15 @@ static int set_one_signal_handler(int sig, void (*handler)(int), int remove)
     sa.sa_flags = 0;
 
     if (sigaction(sig, NULL, &old_sa) == -1) {
-        perror("fuse: cannot get old signal handler");
+        fuse_log(FUSE_LOG_ERR, "fuse: cannot get old signal handler: %s\n",
+                 strerror(errno));
         return -1;
     }
 
     if (old_sa.sa_handler == (remove ? handler : SIG_DFL) &&
         sigaction(sig, &sa, NULL) == -1) {
-        perror("fuse: cannot set signal handler");
+        fuse_log(FUSE_LOG_ERR, "fuse: cannot set signal handler: %s\n",
+                 strerror(errno));
         return -1;
     }
     return 0;
tools/virtiofsd/helper.c +6 -3
index 781c47031c..a19959926c 100644
@@ -208,7 +208,8 @@ int fuse_daemonize(int foreground)
         char completed;
 
         if (pipe(waiter)) {
-            perror("fuse_daemonize: pipe");
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: pipe: %s\n",
+                     strerror(errno));
             return -1;
         }
 
@@ -218,7 +219,8 @@ int fuse_daemonize(int foreground)
          */
         switch (fork()) {
         case -1:
-            perror("fuse_daemonize: fork");
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: fork: %s\n",
+                     strerror(errno));
             return -1;
         case 0:
             break;
@@ -228,7 +230,8 @@ int fuse_daemonize(int foreground)
         }
 
         if (setsid() == -1) {
-            perror("fuse_daemonize: setsid");
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: setsid: %s\n",
+                     strerror(errno));
             return -1;
         }
 
Signature · 1 line
2.24.1
Reviewed-by on v2 97/109
#123 lore raw

Re: [PATCH v2 097/109] virtiofsd: convert more fprintf and perror to use fuse log infra

Quoted 66 lines · Dr. David Alan Gilbert (git)

From: Eryu Guan <[email protected]>

---
  tools/virtiofsd/fuse_signals.c | 7 +++++--
  tools/virtiofsd/helper.c       | 9 ++++++---
  2 files changed, 11 insertions(+), 5 deletions(-)
tools/virtiofsd/fuse_signals.c +5 -2
index 10a6f88088..5364cbe984 100644
@@ -11,6 +11,7 @@
  #include "fuse_i.h"
  #include "fuse_lowlevel.h"
 
+#include <errno.h>
  #include <signal.h>
  #include <stdio.h>
  #include <stdlib.h>
@@ -46,13 +47,15 @@ static int set_one_signal_handler(int sig, void (*handler)(int), int remove)
      sa.sa_flags = 0;
 
      if (sigaction(sig, NULL, &old_sa) == -1) {
-        perror("fuse: cannot get old signal handler");
+        fuse_log(FUSE_LOG_ERR, "fuse: cannot get old signal handler: %s\n",
+                 strerror(errno));
          return -1;
      }
 
      if (old_sa.sa_handler == (remove ? handler : SIG_DFL) &&
          sigaction(sig, &sa, NULL) == -1) {
-        perror("fuse: cannot set signal handler");
+        fuse_log(FUSE_LOG_ERR, "fuse: cannot set signal handler: %s\n",
+                 strerror(errno));
          return -1;
      }
      return 0;
tools/virtiofsd/helper.c +4 -2
index 781c47031c..a19959926c 100644
@@ -208,7 +208,8 @@ int fuse_daemonize(int foreground)
          char completed;
 
          if (pipe(waiter)) {
-            perror("fuse_daemonize: pipe");
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: pipe: %s\n",
+                     strerror(errno));
              return -1;
          }
 
@@ -218,7 +219,8 @@ int fuse_daemonize(int foreground)
           */
          switch (fork()) {
          case -1:
-            perror("fuse_daemonize: fork");
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: fork: %s\n",
+                     strerror(errno));
              return -1;
          case 0:
              break;

tools/virtiofsd/helper.c int fuse_daemonize(int foreground) · line 237

Quoted 9 lines
tools/virtiofsd/helper.c +2 -1
@@ -228,7 +230,8 @@ int fuse_daemonize(int foreground)
          }
 
          if (setsid() == -1) {
-            perror("fuse_daemonize: setsid");
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: setsid: %s\n",
+                     strerror(errno));
              return -1;
          }
 
#124 lore raw

PATCH v2 98/109 virtiofsd: Reset O_DIRECT flag during file open

In reply to Dr. David Alan Gilbert (git)

From: Vivek Goyal <[email protected]>

If an application wants to do direct IO and opens a file with O_DIRECT in guest, that does not necessarily mean that we need to bypass page cache on host as well. So reset this flag on host.

If somebody needs to bypass page cache on host as well (and it is safe to do so), we can add a knob in daemon later to control this behavior.

I check virtio-9p and they do reset O_DIRECT flag.

---
 tools/virtiofsd/passthrough_ll.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
tools/virtiofsd/passthrough_ll.c +14 -0
index 4c3a48325f..cadfa676ca 100644
@@ -1721,6 +1721,13 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
         goto out;
     }
 
+    /*
+     * O_DIRECT in guest should not necessarily mean bypassing page
+     * cache on host as well. If somebody needs that behavior, it
+     * probably should be a configuration knob in daemon.
+     */
+    fi->flags &= ~O_DIRECT;
+
     fd = openat(parent_inode->fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW,
                 mode);
     err = fd == -1 ? errno : 0;
@@ -1950,6 +1957,13 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
         fi->flags &= ~O_APPEND;
     }
 
+    /*
+     * O_DIRECT in guest should not necessarily mean bypassing page
+     * cache on host as well. If somebody needs that behavior, it
+     * probably should be a configuration knob in daemon.
+     */
+    fi->flags &= ~O_DIRECT;
+
     sprintf(buf, "%i", lo_fd(req, ino));
     fd = openat(lo->proc_self_fd, buf, fi->flags & ~O_NOFOLLOW);
     if (fd == -1) {
Signature · 1 line
2.24.1
#125 lore raw

PATCH v2 99/109 virtiofsd: Fix data corruption with O_APPEND write in writeback mode

In reply to Dr. David Alan Gilbert (git)

From: Misono Tomohiro <[email protected]>

When writeback mode is enabled (-o writeback), O_APPEND handling is done in kernel. Therefore virtiofsd clears O_APPEND flag when open. Otherwise O_APPEND flag takes precedence over pwrite() and write data may corrupt.

Currently clearing O_APPEND flag is done in lo_open(), but we also need the same operation in lo_create(). So, factor out the flag update operation in lo_open() to update_open_flags() and call it in both lo_open() and lo_create().

This fixes the failure of xfstest generic/069 in writeback mode (which tests O_APPEND write data integrity).

---
 tools/virtiofsd/passthrough_ll.c | 66 ++++++++++++++++----------------
 1 file changed, 33 insertions(+), 33 deletions(-)
tools/virtiofsd/passthrough_ll.c +33 -33
index cadfa676ca..4482138904 100644
@@ -1692,6 +1692,37 @@ static void lo_releasedir(fuse_req_t req, fuse_ino_t ino,
     fuse_reply_err(req, 0);
 }
 
+static void update_open_flags(int writeback, struct fuse_file_info *fi)
+{
+    /*
+     * With writeback cache, kernel may send read requests even
+     * when userspace opened write-only
+     */
+    if (writeback && (fi->flags & O_ACCMODE) == O_WRONLY) {
+        fi->flags &= ~O_ACCMODE;
+        fi->flags |= O_RDWR;
+    }
+
+    /*
+     * With writeback cache, O_APPEND is handled by the kernel.
+     * This breaks atomicity (since the file may change in the
+     * underlying filesystem, so that the kernel's idea of the
+     * end of the file isn't accurate anymore). In this example,
+     * we just accept that. A more rigorous filesystem may want
+     * to return an error here
+     */
+    if (writeback && (fi->flags & O_APPEND)) {
+        fi->flags &= ~O_APPEND;
+    }
+
+    /*
+     * O_DIRECT in guest should not necessarily mean bypassing page
+     * cache on host as well. If somebody needs that behavior, it
+     * probably should be a configuration knob in daemon.
+     */
+    fi->flags &= ~O_DIRECT;
+}
+
 static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
                       mode_t mode, struct fuse_file_info *fi)
 {
@@ -1721,12 +1752,7 @@ static void lo_create(fuse_req_t req, fuse_ino_t parent, const char *name,
         goto out;
     }
 
-    /*
-     * O_DIRECT in guest should not necessarily mean bypassing page
-     * cache on host as well. If somebody needs that behavior, it
-     * probably should be a configuration knob in daemon.
-     */
-    fi->flags &= ~O_DIRECT;
+    update_open_flags(lo->writeback, fi);
 
     fd = openat(parent_inode->fd, name, (fi->flags | O_CREAT) & ~O_NOFOLLOW,
                 mode);
@@ -1936,33 +1962,7 @@ static void lo_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi)
     fuse_log(FUSE_LOG_DEBUG, "lo_open(ino=%" PRIu64 ", flags=%d)\n", ino,
              fi->flags);
 
-    /*
-     * With writeback cache, kernel may send read requests even
-     * when userspace opened write-only
-     */
-    if (lo->writeback && (fi->flags & O_ACCMODE) == O_WRONLY) {
-        fi->flags &= ~O_ACCMODE;
-        fi->flags |= O_RDWR;
-    }
-
-    /*
-     * With writeback cache, O_APPEND is handled by the kernel.
-     * This breaks atomicity (since the file may change in the
-     * underlying filesystem, so that the kernel's idea of the
-     * end of the file isn't accurate anymore). In this example,
-     * we just accept that. A more rigorous filesystem may want
-     * to return an error here
-     */
-    if (lo->writeback && (fi->flags & O_APPEND)) {
-        fi->flags &= ~O_APPEND;
-    }
-
-    /*
-     * O_DIRECT in guest should not necessarily mean bypassing page
-     * cache on host as well. If somebody needs that behavior, it
-     * probably should be a configuration knob in daemon.
-     */
-    fi->flags &= ~O_DIRECT;
+    update_open_flags(lo->writeback, fi);
 
     sprintf(buf, "%i", lo_fd(req, ino));
     fd = openat(lo->proc_self_fd, buf, fi->flags & ~O_NOFOLLOW);
Signature · 1 line
2.24.1
#126 lore raw

PATCH v2 100/109 virtiofsd: add definition of fuse_buf_writev()

In reply to Dr. David Alan Gilbert (git)

From: piaojun <[email protected]>

Define fuse_buf_writev() which use pwritev and writev to improve io bandwidth. Especially, the src bufs with 0 size should be skipped as their mems are not *block_size* aligned which will cause writev failed in direct io mode.

---
 tools/virtiofsd/buffer.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
tools/virtiofsd/buffer.c +38 -0
index 918e0f41e0..70980550d2 100644
@@ -13,6 +13,7 @@
 #include "fuse_lowlevel.h"
 #include <assert.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -32,6 +33,43 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv)
     return size;
 }
 
+__attribute__((unused))
+static ssize_t fuse_buf_writev(struct fuse_buf *out_buf,
+                               struct fuse_bufvec *in_buf)
+{
+    ssize_t res, i, j;
+    size_t iovcnt = in_buf->count;
+    struct iovec *iov;
+    int fd = out_buf->fd;
+
+    iov = calloc(iovcnt, sizeof(struct iovec));
+    if (!iov) {
+        return -ENOMEM;
+    }
+
+    for (i = 0, j = 0; i < iovcnt; i++) {
+        /* Skip the buf with 0 size */
+        if (in_buf->buf[i].size) {
+            iov[j].iov_base = in_buf->buf[i].mem;
+            iov[j].iov_len = in_buf->buf[i].size;
+            j++;
+        }
+    }
+
+    if (out_buf->flags & FUSE_BUF_FD_SEEK) {
+        res = pwritev(fd, iov, iovcnt, out_buf->pos);
+    } else {
+        res = writev(fd, iov, iovcnt);
+    }
+
+    if (res == -1) {
+        res = -errno;
+    }
+
+    free(iov);
+    return res;
+}
+
 static size_t min_size(size_t s1, size_t s2)
 {
     return s1 < s2 ? s1 : s2;
Signature · 1 line
2.24.1
#127 lore raw

PATCH v2 101/109 virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better performance

In reply to Dr. David Alan Gilbert (git)

From: piaojun <[email protected]>

fuse_buf_writev() only handles the normal write in which src is buffer and dest is fd. Specially if src buffer represents guest physical address that can't be mapped by the daemon process, IO must be bounced back to the VMM to do it by fuse_buf_copy().

---
 tools/virtiofsd/buffer.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
tools/virtiofsd/buffer.c +18 -2
index 70980550d2..b75f871680 100644
@@ -33,7 +33,6 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv)
     return size;
 }
 
-__attribute__((unused))
 static ssize_t fuse_buf_writev(struct fuse_buf *out_buf,
                                struct fuse_bufvec *in_buf)
 {
@@ -262,12 +261,29 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
 ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
                       enum fuse_buf_copy_flags flags)
 {
-    size_t copied = 0;
+    size_t copied = 0, i;
 
     if (dstv == srcv) {
         return fuse_buf_size(dstv);
     }
 
+    /*
+     * use writev to improve bandwidth when all the
+     * src buffers already mapped by the daemon
+     * process
+     */
+    for (i = 0; i < srcv->count; i++) {
+        if (srcv->buf[i].flags & FUSE_BUF_IS_FD) {
+            break;
+        }
+    }
+    if ((i == srcv->count) && (dstv->count == 1) &&
+        (dstv->idx == 0) &&
+        (dstv->buf[0].flags & FUSE_BUF_IS_FD)) {
+        dstv->buf[0].pos += dstv->off;
+        return fuse_buf_writev(&dstv->buf[0], srcv);
+    }
+
     for (;;) {
         const struct fuse_buf *src = fuse_bufvec_current(srcv);
         const struct fuse_buf *dst = fuse_bufvec_current(dstv);
Signature · 1 line
2.24.1
#128 lore raw

PATCH v2 102/109 virtiofsd: process requests in a thread pool

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Introduce a thread pool so that fv_queue_thread() just pops VuVirtqElements and hands them to the thread pool. For the time being only one worker thread is allowed since passthrough_ll.c is not thread-safe yet. Future patches will lift this restriction so that multiple FUSE requests can be processed in parallel.

The main new concept is struct FVRequest, which contains both VuVirtqElement and struct fuse_chan. We now have fv_VuDev for a device, fv_QueueInfo for a virtqueue, and FVRequest for a request. Some of fv_QueueInfo's fields are moved into FVRequest because they are per-request. The name FVRequest conforms to QEMU coding style and I expect the struct fv_* types will be renamed in a future refactoring.

This patch series is not optimal. fbuf reuse is dropped so each request does malloc(se->bufsize), but there is no clean and cheap way to keep this with a thread pool. The vq_lock mutex is held for longer than necessary, especially during the eventfd_write() syscall. Performance can be improved in the future.

prctl(2) had to be added to the seccomp whitelist because glib invokes it.

---
 tools/virtiofsd/fuse_virtio.c | 359 +++++++++++++++++++---------------
 1 file changed, 201 insertions(+), 158 deletions(-)
tools/virtiofsd/fuse_virtio.c +201 -158
index f6242f9338..0dcf2ef57a 100644
@@ -22,6 +22,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <glib.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -37,17 +38,28 @@
 struct fv_VuDev;
 struct fv_QueueInfo {
     pthread_t thread;
+    /*
+     * This lock protects the VuVirtq preventing races between
+     * fv_queue_thread() and fv_queue_worker().
+     */
+    pthread_mutex_t vq_lock;
+
     struct fv_VuDev *virtio_dev;
 
     /* Our queue index, corresponds to array position */
     int qidx;
     int kick_fd;
     int kill_fd; /* For killing the thread */
+};
 
-    /* The element for the command currently being processed */
-    VuVirtqElement *qe;
+/* A FUSE request */
+typedef struct {
+    VuVirtqElement elem;
+    struct fuse_chan ch;
+
+    /* Used to complete requests that involve no reply */
     bool reply_sent;
-};
+} FVRequest;
 
 /*
  * We pass the dev element into libvhost-user
@@ -191,8 +203,11 @@ static void copy_iov(struct iovec *src_iov, int src_count,
 int virtio_send_msg(struct fuse_session *se, struct fuse_chan *ch,
                     struct iovec *iov, int count)
 {
-    VuVirtqElement *elem;
-    VuVirtq *q;
+    FVRequest *req = container_of(ch, FVRequest, ch);
+    struct fv_QueueInfo *qi = ch->qi;
+    VuDev *dev = &se->virtio_dev->dev;
+    VuVirtq *q = vu_get_queue(dev, qi->qidx);
+    VuVirtqElement *elem = &req->elem;
     int ret = 0;
 
     assert(count >= 1);
@@ -205,11 +220,7 @@ int virtio_send_msg(struct fuse_session *se, struct fuse_chan *ch,
 
     /* unique == 0 is notification, which we don't support */
     assert(out->unique);
-    /* For virtio we always have ch */
-    assert(ch);
-    assert(!ch->qi->reply_sent);
-    elem = ch->qi->qe;
-    q = &ch->qi->virtio_dev->dev.vq[ch->qi->qidx];
+    assert(!req->reply_sent);
 
     /* The 'in' part of the elem is to qemu */
     unsigned int in_num = elem->in_num;
@@ -236,9 +247,15 @@ int virtio_send_msg(struct fuse_session *se, struct fuse_chan *ch,
     }
 
     copy_iov(iov, count, in_sg, in_num, tosend_len);
-    vu_queue_push(&se->virtio_dev->dev, q, elem, tosend_len);
-    vu_queue_notify(&se->virtio_dev->dev, q);
-    ch->qi->reply_sent = true;
+
+    pthread_rwlock_rdlock(&qi->virtio_dev->vu_dispatch_rwlock);
+    pthread_mutex_lock(&qi->vq_lock);
+    vu_queue_push(dev, q, elem, tosend_len);
+    vu_queue_notify(dev, q);
+    pthread_mutex_unlock(&qi->vq_lock);
+    pthread_rwlock_unlock(&qi->virtio_dev->vu_dispatch_rwlock);
+
+    req->reply_sent = true;
 
 err:
     return ret;
@@ -254,9 +271,12 @@ int virtio_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
                          struct iovec *iov, int count, struct fuse_bufvec *buf,
                          size_t len)
 {
+    FVRequest *req = container_of(ch, FVRequest, ch);
+    struct fv_QueueInfo *qi = ch->qi;
+    VuDev *dev = &se->virtio_dev->dev;
+    VuVirtq *q = vu_get_queue(dev, qi->qidx);
+    VuVirtqElement *elem = &req->elem;
     int ret = 0;
-    VuVirtqElement *elem;
-    VuVirtq *q;
 
     assert(count >= 1);
     assert(iov[0].iov_len >= sizeof(struct fuse_out_header));
@@ -275,11 +295,7 @@ int virtio_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
     /* unique == 0 is notification which we don't support */
     assert(out->unique);
 
-    /* For virtio we always have ch */
-    assert(ch);
-    assert(!ch->qi->reply_sent);
-    elem = ch->qi->qe;
-    q = &ch->qi->virtio_dev->dev.vq[ch->qi->qidx];
+    assert(!req->reply_sent);
 
     /* The 'in' part of the elem is to qemu */
     unsigned int in_num = elem->in_num;
@@ -395,33 +411,175 @@ int virtio_send_data_iov(struct fuse_session *se, struct fuse_chan *ch,
 
     ret = 0;
 
-    vu_queue_push(&se->virtio_dev->dev, q, elem, tosend_len);
-    vu_queue_notify(&se->virtio_dev->dev, q);
+    pthread_rwlock_rdlock(&qi->virtio_dev->vu_dispatch_rwlock);
+    pthread_mutex_lock(&qi->vq_lock);
+    vu_queue_push(dev, q, elem, tosend_len);
+    vu_queue_notify(dev, q);
+    pthread_mutex_unlock(&qi->vq_lock);
+    pthread_rwlock_unlock(&qi->virtio_dev->vu_dispatch_rwlock);
 
 err:
     if (ret == 0) {
-        ch->qi->reply_sent = true;
+        req->reply_sent = true;
     }
 
     return ret;
 }
 
+/* Process one FVRequest in a thread pool */
+static void fv_queue_worker(gpointer data, gpointer user_data)
+{
+    struct fv_QueueInfo *qi = user_data;
+    struct fuse_session *se = qi->virtio_dev->se;
+    struct VuDev *dev = &qi->virtio_dev->dev;
+    FVRequest *req = data;
+    VuVirtqElement *elem = &req->elem;
+    struct fuse_buf fbuf = {};
+    bool allocated_bufv = false;
+    struct fuse_bufvec bufv;
+    struct fuse_bufvec *pbufv;
+
+    assert(se->bufsize > sizeof(struct fuse_in_header));
+
+    /*
+     * An element contains one request and the space to send our response
+     * They're spread over multiple descriptors in a scatter/gather set
+     * and we can't trust the guest to keep them still; so copy in/out.
+     */
+    fbuf.mem = malloc(se->bufsize);
+    assert(fbuf.mem);
+
+    fuse_mutex_init(&req->ch.lock);
+    req->ch.fd = -1;
+    req->ch.qi = qi;
+
+    /* The 'out' part of the elem is from qemu */
+    unsigned int out_num = elem->out_num;
+    struct iovec *out_sg = elem->out_sg;
+    size_t out_len = iov_size(out_sg, out_num);
+    fuse_log(FUSE_LOG_DEBUG,
+             "%s: elem %d: with %d out desc of length %zd\n",
+             __func__, elem->index, out_num, out_len);
+
+    /*
+     * The elem should contain a 'fuse_in_header' (in to fuse)
+     * plus the data based on the len in the header.
+     */
+    if (out_len < sizeof(struct fuse_in_header)) {
+        fuse_log(FUSE_LOG_ERR, "%s: elem %d too short for in_header\n",
+                 __func__, elem->index);
+        assert(0); /* TODO */
+    }
+    if (out_len > se->bufsize) {
+        fuse_log(FUSE_LOG_ERR, "%s: elem %d too large for buffer\n", __func__,
+                 elem->index);
+        assert(0); /* TODO */
+    }
+    /* Copy just the first element and look at it */
+    copy_from_iov(&fbuf, 1, out_sg);
+
+    pbufv = NULL; /* Compiler thinks an unitialised path */
+    if (out_num > 2 &&
+        out_sg[0].iov_len == sizeof(struct fuse_in_header) &&
+        ((struct fuse_in_header *)fbuf.mem)->opcode == FUSE_WRITE &&
+        out_sg[1].iov_len == sizeof(struct fuse_write_in)) {
+        /*
+         * For a write we don't actually need to copy the
+         * data, we can just do it straight out of guest memory
+         * but we must still copy the headers in case the guest
+         * was nasty and changed them while we were using them.
+         */
+        fuse_log(FUSE_LOG_DEBUG, "%s: Write special case\n", __func__);
+
+        /* copy the fuse_write_in header afte rthe fuse_in_header */
+        fbuf.mem += out_sg->iov_len;
+        copy_from_iov(&fbuf, 1, out_sg + 1);
+        fbuf.mem -= out_sg->iov_len;
+        fbuf.size = out_sg[0].iov_len + out_sg[1].iov_len;
+
+        /* Allocate the bufv, with space for the rest of the iov */
+        pbufv = malloc(sizeof(struct fuse_bufvec) +
+                       sizeof(struct fuse_buf) * (out_num - 2));
+        if (!pbufv) {
+            fuse_log(FUSE_LOG_ERR, "%s: pbufv malloc failed\n",
+                    __func__);
+            goto out;
+        }
+
+        allocated_bufv = true;
+        pbufv->count = 1;
+        pbufv->buf[0] = fbuf;
+
+        size_t iovindex, pbufvindex;
+        iovindex = 2; /* 2 headers, separate iovs */
+        pbufvindex = 1; /* 2 headers, 1 fusebuf */
+
+        for (; iovindex < out_num; iovindex++, pbufvindex++) {
+            pbufv->count++;
+            pbufv->buf[pbufvindex].pos = ~0; /* Dummy */
+            pbufv->buf[pbufvindex].flags = 0;
+            pbufv->buf[pbufvindex].mem = out_sg[iovindex].iov_base;
+            pbufv->buf[pbufvindex].size = out_sg[iovindex].iov_len;
+        }
+    } else {
+        /* Normal (non fast write) path */
+
+        /* Copy the rest of the buffer */
+        fbuf.mem += out_sg->iov_len;
+        copy_from_iov(&fbuf, out_num - 1, out_sg + 1);
+        fbuf.mem -= out_sg->iov_len;
+        fbuf.size = out_len;
+
+        /* TODO! Endianness of header */
+
+        /* TODO: Add checks for fuse_session_exited */
+        bufv.buf[0] = fbuf;
+        bufv.count = 1;
+        pbufv = &bufv;
+    }
+    pbufv->idx = 0;
+    pbufv->off = 0;
+    fuse_session_process_buf_int(se, pbufv, &req->ch);
+
+out:
+    if (allocated_bufv) {
+        free(pbufv);
+    }
+
+    /* If the request has no reply, still recycle the virtqueue element */
+    if (!req->reply_sent) {
+        struct VuVirtq *q = vu_get_queue(dev, qi->qidx);
+
+        fuse_log(FUSE_LOG_DEBUG, "%s: elem %d no reply sent\n", __func__,
+                 elem->index);
+
+        pthread_rwlock_rdlock(&qi->virtio_dev->vu_dispatch_rwlock);
+        pthread_mutex_lock(&qi->vq_lock);
+        vu_queue_push(dev, q, elem, 0);
+        vu_queue_notify(dev, q);
+        pthread_mutex_unlock(&qi->vq_lock);
+        pthread_rwlock_unlock(&qi->virtio_dev->vu_dispatch_rwlock);
+    }
+
+    pthread_mutex_destroy(&req->ch.lock);
+    free(fbuf.mem);
+    free(req);
+}
+
 /* Thread function for individual queues, created when a queue is 'started' */
 static void *fv_queue_thread(void *opaque)
 {
     struct fv_QueueInfo *qi = opaque;
     struct VuDev *dev = &qi->virtio_dev->dev;
     struct VuVirtq *q = vu_get_queue(dev, qi->qidx);
-    struct fuse_session *se = qi->virtio_dev->se;
-    struct fuse_chan ch;
-    struct fuse_buf fbuf;
+    GThreadPool *pool;
 
-    fbuf.mem = NULL;
-    fbuf.flags = 0;
-
-    fuse_mutex_init(&ch.lock);
-    ch.fd = (int)0xdaff0d111;
-    ch.qi = qi;
+    pool = g_thread_pool_new(fv_queue_worker, qi, 1 /* TODO max_threads */,
+                             TRUE, NULL);
+    if (!pool) {
+        fuse_log(FUSE_LOG_ERR, "%s: g_thread_pool_new failed\n", __func__);
+        return NULL;
+    }
 
     fuse_log(FUSE_LOG_INFO, "%s: Start for queue %d kick_fd %d\n", __func__,
              qi->qidx, qi->kick_fd);
@@ -478,6 +636,7 @@ static void *fv_queue_thread(void *opaque)
         /* Mutual exclusion with virtio_loop() */
         ret = pthread_rwlock_rdlock(&qi->virtio_dev->vu_dispatch_rwlock);
         assert(ret == 0); /* there is no possible error case */
+        pthread_mutex_lock(&qi->vq_lock);
         /* out is from guest, in is too guest */
         unsigned int in_bytes, out_bytes;
         vu_queue_get_avail_bytes(dev, q, &in_bytes, &out_bytes, ~0, ~0);
@@ -486,141 +645,22 @@ static void *fv_queue_thread(void *opaque)
                  "%s: Queue %d gave evalue: %zx available: in: %u out: %u\n",
                  __func__, qi->qidx, (size_t)evalue, in_bytes, out_bytes);
 
-
         while (1) {
-            bool allocated_bufv = false;
-            struct fuse_bufvec bufv;
-            struct fuse_bufvec *pbufv;
-
-            /*
-             * An element contains one request and the space to send our
-             * response They're spread over multiple descriptors in a
-             * scatter/gather set and we can't trust the guest to keep them
-             * still; so copy in/out.
-             */
-            VuVirtqElement *elem = vu_queue_pop(dev, q, sizeof(VuVirtqElement));
-            if (!elem) {
+            FVRequest *req = vu_queue_pop(dev, q, sizeof(FVRequest));
+            if (!req) {
                 break;
             }
 
-            qi->qe = elem;
-            qi->reply_sent = false;
+            req->reply_sent = false;
 
-            if (!fbuf.mem) {
-                fbuf.mem = malloc(se->bufsize);
-                assert(fbuf.mem);
-                assert(se->bufsize > sizeof(struct fuse_in_header));
-            }
-            /* The 'out' part of the elem is from qemu */
-            unsigned int out_num = elem->out_num;
-            struct iovec *out_sg = elem->out_sg;
-            size_t out_len = iov_size(out_sg, out_num);
-            fuse_log(FUSE_LOG_DEBUG,
-                     "%s: elem %d: with %d out desc of length %zd\n", __func__,
-                     elem->index, out_num, out_len);
-
-            /*
-             * The elem should contain a 'fuse_in_header' (in to fuse)
-             * plus the data based on the len in the header.
-             */
-            if (out_len < sizeof(struct fuse_in_header)) {
-                fuse_log(FUSE_LOG_ERR, "%s: elem %d too short for in_header\n",
-                         __func__, elem->index);
-                assert(0); /* TODO */
-            }
-            if (out_len > se->bufsize) {
-                fuse_log(FUSE_LOG_ERR, "%s: elem %d too large for buffer\n",
-                         __func__, elem->index);
-                assert(0); /* TODO */
-            }
-            /* Copy just the first element and look at it */
-            copy_from_iov(&fbuf, 1, out_sg);
-
-            if (out_num > 2 &&
-                out_sg[0].iov_len == sizeof(struct fuse_in_header) &&
-                ((struct fuse_in_header *)fbuf.mem)->opcode == FUSE_WRITE &&
-                out_sg[1].iov_len == sizeof(struct fuse_write_in)) {
-                /*
-                 * For a write we don't actually need to copy the
-                 * data, we can just do it straight out of guest memory
-                 * but we must still copy the headers in case the guest
-                 * was nasty and changed them while we were using them.
-                 */
-                fuse_log(FUSE_LOG_DEBUG, "%s: Write special case\n", __func__);
-
-                /* copy the fuse_write_in header after the fuse_in_header */
-                fbuf.mem += out_sg->iov_len;
-                copy_from_iov(&fbuf, 1, out_sg + 1);
-                fbuf.mem -= out_sg->iov_len;
-                fbuf.size = out_sg[0].iov_len + out_sg[1].iov_len;
-
-                /* Allocate the bufv, with space for the rest of the iov */
-                allocated_bufv = true;
-                pbufv = malloc(sizeof(struct fuse_bufvec) +
-                               sizeof(struct fuse_buf) * (out_num - 2));
-                if (!pbufv) {
-                    vu_queue_unpop(dev, q, elem, 0);
-                    free(elem);
-                    fuse_log(FUSE_LOG_ERR, "%s: pbufv malloc failed\n",
-                             __func__);
-                    goto out;
-                }
-
-                pbufv->count = 1;
-                pbufv->buf[0] = fbuf;
-
-                size_t iovindex, pbufvindex;
-                iovindex = 2; /* 2 headers, separate iovs */
-                pbufvindex = 1; /* 2 headers, 1 fusebuf */
-
-                for (; iovindex < out_num; iovindex++, pbufvindex++) {
-                    pbufv->count++;
-                    pbufv->buf[pbufvindex].pos = ~0; /* Dummy */
-                    pbufv->buf[pbufvindex].flags = 0;
-                    pbufv->buf[pbufvindex].mem = out_sg[iovindex].iov_base;
-                    pbufv->buf[pbufvindex].size = out_sg[iovindex].iov_len;
-                }
-            } else {
-                /* Normal (non fast write) path */
-
-                /* Copy the rest of the buffer */
-                fbuf.mem += out_sg->iov_len;
-                copy_from_iov(&fbuf, out_num - 1, out_sg + 1);
-                fbuf.mem -= out_sg->iov_len;
-                fbuf.size = out_len;
-
-                /* TODO! Endianness of header */
-
-                /* TODO: Add checks for fuse_session_exited */
-                bufv.buf[0] = fbuf;
-                bufv.count = 1;
-                pbufv = &bufv;
-            }
-            pbufv->idx = 0;
-            pbufv->off = 0;
-            fuse_session_process_buf_int(se, pbufv, &ch);
-
-            if (allocated_bufv) {
-                free(pbufv);
-            }
-
-            if (!qi->reply_sent) {
-                fuse_log(FUSE_LOG_DEBUG, "%s: elem %d no reply sent\n",
-                         __func__, elem->index);
-                /* I think we've still got to recycle the element */
-                vu_queue_push(dev, q, elem, 0);
-                vu_queue_notify(dev, q);
-            }
-            qi->qe = NULL;
-            free(elem);
-            elem = NULL;
+            g_thread_pool_push(pool, req, NULL);
         }
 
+        pthread_mutex_unlock(&qi->vq_lock);
         pthread_rwlock_unlock(&qi->virtio_dev->vu_dispatch_rwlock);
     }
-out:
-    pthread_mutex_destroy(&ch.lock);
-    free(fbuf.mem);
+
+    g_thread_pool_free(pool, FALSE, TRUE);
 
     return NULL;
 }
@@ -643,6 +683,7 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx)
         fuse_log(FUSE_LOG_ERR, "%s: Failed to join thread idx %d err %d\n",
                  __func__, qidx, ret);
     }
+    pthread_mutex_destroy(&ourqi->vq_lock);
     close(ourqi->kill_fd);
     ourqi->kick_fd = -1;
     free(vud->qi[qidx]);
@@ -696,6 +737,8 @@ static void fv_queue_set_started(VuDev *dev, int qidx, bool started)
 
         ourqi->kill_fd = eventfd(0, EFD_CLOEXEC | EFD_SEMAPHORE);
         assert(ourqi->kill_fd != -1);
+        pthread_mutex_init(&ourqi->vq_lock, NULL);
+
         if (pthread_create(&ourqi->thread, NULL, fv_queue_thread, ourqi)) {
             fuse_log(FUSE_LOG_ERR, "%s: Failed to create thread for queue %d\n",
                      __func__, qidx);
Signature · 1 line
2.24.1
#129 lore raw

PATCH v2 103/109 virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

When running with multiple threads it can be tricky to handle FUSE_INIT/FUSE_DESTROY in parallel with other request types or in parallel with themselves. Serialize FUSE_INIT and FUSE_DESTROY so that malicious clients cannot trigger race conditions.

---
 tools/virtiofsd/fuse_i.h        |  1 +
 tools/virtiofsd/fuse_lowlevel.c | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
tools/virtiofsd/fuse_i.h +1 -0
index a20854f1c4..1447d86866 100644
@@ -61,6 +61,7 @@ struct fuse_session {
     struct fuse_req list;
     struct fuse_req interrupts;
     pthread_mutex_t lock;
+    pthread_rwlock_t init_rwlock;
     int got_destroy;
     int broken_splice_nonblock;
     uint64_t notify_ctr;
tools/virtiofsd/fuse_lowlevel.c +18 -0
index fe332bcb90..8ae45d9c58 100644
@@ -2430,6 +2430,19 @@ void fuse_session_process_buf_int(struct fuse_session *se,
     req->ctx.pid = in->pid;
     req->ch = ch;
 
+    /*
+     * INIT and DESTROY requests are serialized, all other request types
+     * run in parallel.  This prevents races between FUSE_INIT and ordinary
+     * requests, FUSE_INIT and FUSE_INIT, FUSE_INIT and FUSE_DESTROY, and
+     * FUSE_DESTROY and FUSE_DESTROY.
+     */
+    if (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT ||
+        in->opcode == FUSE_DESTROY) {
+        pthread_rwlock_wrlock(&se->init_rwlock);
+    } else {
+        pthread_rwlock_rdlock(&se->init_rwlock);
+    }
+
     err = EIO;
     if (!se->got_init) {
         enum fuse_opcode expected;
@@ -2487,10 +2500,13 @@ void fuse_session_process_buf_int(struct fuse_session *se,
     } else {
         fuse_ll_ops[in->opcode].func(req, in->nodeid, &iter);
     }
+
+    pthread_rwlock_unlock(&se->init_rwlock);
     return;
 
 reply_err:
     fuse_reply_err(req, err);
+    pthread_rwlock_unlock(&se->init_rwlock);
 }
 
 #define LL_OPTION(n, o, v)                     \
@@ -2535,6 +2551,7 @@ void fuse_session_destroy(struct fuse_session *se)
             se->op.destroy(se->userdata);
         }
     }
+    pthread_rwlock_destroy(&se->init_rwlock);
     pthread_mutex_destroy(&se->lock);
     free(se->cuse_data);
     if (se->fd != -1) {
@@ -2628,6 +2645,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
     list_init_req(&se->list);
     list_init_req(&se->interrupts);
     fuse_mutex_init(&se->lock);
+    pthread_rwlock_init(&se->init_rwlock, NULL);
 
     memcpy(&se->op, op, op_size);
     se->owner = getuid();
Signature · 1 line
2.24.1
#130 lore raw

PATCH v2 104/109 virtiofsd: fix lo_destroy() resource leaks

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Now that lo_destroy() is serialized we can call unref_inode() so that all inode resources are freed.

---
 tools/virtiofsd/passthrough_ll.c | 41 ++++++++++++++++----------------
 1 file changed, 20 insertions(+), 21 deletions(-)
tools/virtiofsd/passthrough_ll.c +20 -21
index 4482138904..4c656b4a60 100644
@@ -1371,26 +1371,6 @@ static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
     }
 }
 
-static int unref_all_inodes_cb(gpointer key, gpointer value, gpointer user_data)
-{
-    struct lo_inode *inode = value;
-    struct lo_data *lo = user_data;
-
-    inode->nlookup = 0;
-    lo_map_remove(&lo->ino_map, inode->fuse_ino);
-    close(inode->fd);
-    lo_inode_put(lo, &inode); /* Drop our refcount from lo_do_lookup() */
-
-    return TRUE;
-}
-
-static void unref_all_inodes(struct lo_data *lo)
-{
-    pthread_mutex_lock(&lo->mutex);
-    g_hash_table_foreach_remove(lo->inodes, unref_all_inodes_cb, lo);
-    pthread_mutex_unlock(&lo->mutex);
-}
-
 static void lo_forget_one(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
 {
     struct lo_data *lo = lo_data(req);
@@ -2477,7 +2457,26 @@ static void lo_lseek(fuse_req_t req, fuse_ino_t ino, off_t off, int whence,
 static void lo_destroy(void *userdata)
 {
     struct lo_data *lo = (struct lo_data *)userdata;
-    unref_all_inodes(lo);
+
+    /*
+     * Normally lo->mutex must be taken when traversing lo->inodes but
+     * lo_destroy() is a serialized request so no races are possible here.
+     *
+     * In addition, we cannot acquire lo->mutex since unref_inode() takes it
+     * too and this would result in a recursive lock.
+     */
+    while (true) {
+        GHashTableIter iter;
+        gpointer key, value;
+
+        g_hash_table_iter_init(&iter, lo->inodes);
+        if (!g_hash_table_iter_next(&iter, &key, &value)) {
+            break;
+        }
+
+        struct lo_inode *inode = value;
+        unref_inode_lolocked(lo, inode, inode->nlookup);
+    }
 }
 
 static struct fuse_lowlevel_ops lo_oper = {
Signature · 1 line
2.24.1
#131 lore raw

PATCH v2 105/109 virtiofsd: add --thread-pool-size=NUM option

In reply to Dr. David Alan Gilbert (git)

From: Stefan Hajnoczi <[email protected]>

Add an option to control the size of the thread pool. Requests are now processed in parallel by default.

---
 tools/virtiofsd/fuse_i.h        | 1 +
 tools/virtiofsd/fuse_lowlevel.c | 7 ++++++-
 tools/virtiofsd/fuse_virtio.c   | 5 +++--
 3 files changed, 10 insertions(+), 3 deletions(-)
tools/virtiofsd/fuse_i.h +1 -0
index 1447d86866..4e47e5880d 100644
@@ -72,6 +72,7 @@ struct fuse_session {
     int   vu_listen_fd;
     int   vu_socketfd;
     struct fv_VuDev *virtio_dev;
+    int thread_pool_size;
 };
 
 struct fuse_chan {
tools/virtiofsd/fuse_lowlevel.c +6 -1
index 8ae45d9c58..2ce3e739fd 100644
@@ -27,6 +27,7 @@
 #include <sys/file.h>
 #include <unistd.h>
 
+#define THREAD_POOL_SIZE 64
 
 #define OFFSET_MAX 0x7fffffffffffffffLL
 
@@ -2521,6 +2522,7 @@ static const struct fuse_opt fuse_ll_opts[] = {
     LL_OPTION("allow_root", deny_others, 1),
     LL_OPTION("--socket-path=%s", vu_socket_path, 0),
     LL_OPTION("--fd=%d", vu_listen_fd, 0),
+    LL_OPTION("--thread-pool-size=%d", thread_pool_size, 0),
     FUSE_OPT_END
 };
 
@@ -2541,7 +2543,9 @@ void fuse_lowlevel_help(void)
         "    -o allow_root              allow access by root\n"
         "    --socket-path=PATH         path for the vhost-user socket\n"
         "    --fd=FDNUM                 fd number of vhost-user socket\n"
-        "    -o auto_unmount            auto unmount on process termination\n");
+        "    -o auto_unmount            auto unmount on process termination\n"
+        "    --thread-pool-size=NUM     thread pool size limit (default %d)\n",
+        THREAD_POOL_SIZE);
 }
 
 void fuse_session_destroy(struct fuse_session *se)
@@ -2595,6 +2599,7 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
     }
     se->fd = -1;
     se->vu_listen_fd = -1;
+    se->thread_pool_size = THREAD_POOL_SIZE;
     se->conn.max_write = UINT_MAX;
     se->conn.max_readahead = UINT_MAX;
 
tools/virtiofsd/fuse_virtio.c +3 -2
index 0dcf2ef57a..9f6582343c 100644
@@ -572,10 +572,11 @@ static void *fv_queue_thread(void *opaque)
     struct fv_QueueInfo *qi = opaque;
     struct VuDev *dev = &qi->virtio_dev->dev;
     struct VuVirtq *q = vu_get_queue(dev, qi->qidx);
+    struct fuse_session *se = qi->virtio_dev->se;
     GThreadPool *pool;
 
-    pool = g_thread_pool_new(fv_queue_worker, qi, 1 /* TODO max_threads */,
-                             TRUE, NULL);
+    pool = g_thread_pool_new(fv_queue_worker, qi, se->thread_pool_size, TRUE,
+                             NULL);
     if (!pool) {
         fuse_log(FUSE_LOG_ERR, "%s: g_thread_pool_new failed\n", __func__);
         return NULL;
Signature · 1 line
2.24.1
#132 lore raw

PATCH v2 106/109 virtiofsd: Convert lo_destroy to take the lo->mutex lock itself

In reply to Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

lo_destroy was relying on some implicit knowledge of the locking; we can avoid this if we create an unref_inode that doesn't take the lock and then grab it for the whole of the lo_destroy.

---
 tools/virtiofsd/passthrough_ll.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
tools/virtiofsd/passthrough_ll.c +17 -14
index 4c656b4a60..3c450c15b4 100644
@@ -1344,14 +1344,13 @@ static void lo_unlink(fuse_req_t req, fuse_ino_t parent, const char *name)
     lo_inode_put(lo, &inode);
 }
 
-static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
-                                 uint64_t n)
+/* To be called with lo->mutex held */
+static void unref_inode(struct lo_data *lo, struct lo_inode *inode, uint64_t n)
 {
     if (!inode) {
         return;
     }
 
-    pthread_mutex_lock(&lo->mutex);
     assert(inode->nlookup >= n);
     inode->nlookup -= n;
     if (!inode->nlookup) {
@@ -1362,15 +1361,24 @@ static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
         }
         g_hash_table_destroy(inode->posix_locks);
         pthread_mutex_destroy(&inode->plock_mutex);
-        pthread_mutex_unlock(&lo->mutex);
 
         /* Drop our refcount from lo_do_lookup() */
         lo_inode_put(lo, &inode);
-    } else {
-        pthread_mutex_unlock(&lo->mutex);
     }
 }
 
+static void unref_inode_lolocked(struct lo_data *lo, struct lo_inode *inode,
+                                 uint64_t n)
+{
+    if (!inode) {
+        return;
+    }
+
+    pthread_mutex_lock(&lo->mutex);
+    unref_inode(lo, inode, n);
+    pthread_mutex_unlock(&lo->mutex);
+}
+
 static void lo_forget_one(fuse_req_t req, fuse_ino_t ino, uint64_t nlookup)
 {
     struct lo_data *lo = lo_data(req);
@@ -2458,13 +2466,7 @@ static void lo_destroy(void *userdata)
 {
     struct lo_data *lo = (struct lo_data *)userdata;
 
-    /*
-     * Normally lo->mutex must be taken when traversing lo->inodes but
-     * lo_destroy() is a serialized request so no races are possible here.
-     *
-     * In addition, we cannot acquire lo->mutex since unref_inode() takes it
-     * too and this would result in a recursive lock.
-     */
+    pthread_mutex_lock(&lo->mutex);
     while (true) {
         GHashTableIter iter;
         gpointer key, value;
@@ -2475,8 +2477,9 @@ static void lo_destroy(void *userdata)
         }
 
         struct lo_inode *inode = value;
-        unref_inode_lolocked(lo, inode, inode->nlookup);
+        unref_inode(lo, inode, inode->nlookup);
     }
+    pthread_mutex_unlock(&lo->mutex);
 }
 
 static struct fuse_lowlevel_ops lo_oper = {
Signature · 1 line
2.24.1
#133 lore raw

PATCH v2 107/109 virtiofsd/passthrough_ll: Pass errno to fuse_reply_err()

In reply to Dr. David Alan Gilbert (git)

From: Xiao Yang <[email protected]>

lo_copy_file_range() passes -errno to fuse_reply_err() and then fuse_reply_err() changes it to errno again, so that subsequent fuse_send_reply_iov_nofree() catches the wrong errno.(i.e. reports "fuse: bad error value: ...").

Make fuse_send_reply_iov_nofree() accept the correct -errno by passing errno directly in lo_copy_file_range().

dgilbert: Sent upstream and now Merged as aa1185e153f774f1df65

---
 tools/virtiofsd/passthrough_ll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/virtiofsd/passthrough_ll.c +1 -1
index 3c450c15b4..0666a8709d 100644
@@ -2441,7 +2441,7 @@ static void lo_copy_file_range(fuse_req_t req, fuse_ino_t ino_in, off_t off_in,
 
     res = copy_file_range(in_fd, &off_in, out_fd, &off_out, len, flags);
     if (res < 0) {
-        fuse_reply_err(req, -errno);
+        fuse_reply_err(req, errno);
     } else {
         fuse_reply_write(req, res);
     }
Signature · 1 line
2.24.1
#134 lore raw

PATCH v2 108/109 virtiofsd: stop all queue threads on exit in virtio_loop()

In reply to Dr. David Alan Gilbert (git)

From: Eryu Guan <[email protected]>

On guest graceful shutdown, virtiofsd receives VHOST_USER_GET_VRING_BASE request from VMM and shuts down virtqueues by calling fv_set_started(), which joins fv_queue_thread() threads. So when virtio_loop() returns, there should be no thread is still accessing data in fuse session and/or virtio dev.

But on abnormal exit, e.g. guest got killed for whatever reason, vhost-user socket is closed and virtio_loop() breaks out the main loop and returns to main(). But it's possible fv_queue_worker()s are still working and accessing fuse session and virtio dev, which results in crash or use-after-free.

Fix it by stopping fv_queue_thread()s before virtio_loop() returns, to make sure there's no-one could access fuse session and virtio dev.

---
 tools/virtiofsd/fuse_virtio.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
tools/virtiofsd/fuse_virtio.c +12 -0
index 9f6582343c..aca28aafc1 100644
@@ -815,6 +815,18 @@ int virtio_loop(struct fuse_session *se)
         }
     }
 
+    /*
+     * Make sure all fv_queue_thread()s quit on exit, as we're about to
+     * free virtio dev and fuse session, no one should access them anymore.
+     */
+    for (int i = 0; i < se->virtio_dev->nqueues; i++) {
+        if (!se->virtio_dev->qi[i])
+            continue;
+
+        fuse_log(FUSE_LOG_INFO, "%s: Stopping queue %d thread\n", __func__, i);
+        fv_queue_cleanup_thread(se->virtio_dev, i);
+    }
+
     fuse_log(FUSE_LOG_INFO, "%s: Exit\n", __func__);
 
     return 0;
Signature · 1 line
2.24.1
#135 lore raw

PATCH v2 109/109 virtiofsd: add some options to the help message

In reply to Dr. David Alan Gilbert (git)

From: Masayoshi Mizuma <[email protected]>

Add following options to the help message:
- cache
- flock|no_flock
- norace
- posix_lock|no_posix_lock
- readdirplus|no_readdirplus
- timeout
- writeback|no_writeback
- xattr|no_xattr

dgilbert: Split cache, norace, posix_lock, readdirplus off
into our own earlier patches that added the options

---
 tools/virtiofsd/helper.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
tools/virtiofsd/helper.c +9 -1
index a19959926c..8f00737b1a 100644
@@ -149,6 +149,8 @@ void fuse_cmdline_help(void)
            "    -o cache=<mode>            cache mode. could be one of \"auto, "
            "always, none\"\n"
            "                               default: auto\n"
+           "    -o flock|no_flock          enable/disable flock\n"
+           "                               default: no_flock\n"
            "    -o log_level=<level>       log level, default to \"info\"\n"
            "                               level could be one of \"debug, "
            "info, warn, err\"\n"
@@ -163,7 +165,13 @@ void fuse_cmdline_help(void)
            "    -o readdirplus|no_readdirplus\n"
            "                               enable/disable readirplus\n"
            "                               default: readdirplus\n"
-          );
+           "    -o timeout=<number>        I/O timeout (second)\n"
+           "                               default: depends on cache= option.\n"
+           "    -o writeback|no_writeback  enable/disable writeback cache\n"
+           "                               default: no_writeback\n"
+           "    -o xattr|no_xattr          enable/disable xattr\n"
+           "                               default: no_xattr\n"
+           );
 }
 
 static int fuse_helper_opt_proc(void *data, const char *arg, int key,
Signature · 1 line
2.24.1
#136 lore raw

Re: [PATCH v2 109/109] virtiofsd: add some options to the help message

Quoted 12 lines

From: Masayoshi Mizuma <[email protected]>

Add following options to the help message:
- cache
- flock|no_flock
- norace
- posix_lock|no_posix_lock
- readdirplus|no_readdirplus
- timeout
- writeback|no_writeback
- xattr|no_xattr

Quoted 6 lines

dgilbert: Split cache, norace, posix_lock, readdirplus off
into our own earlier patches that added the options

Hello,

I think we also need to remove unused options from help message as well. Could you please review following patch and add or fold to this patch if it is ok.

Thanks,
Misono

=====
[PATCH] virtiofsd: Remove unused options

Following options came from libfuse but not used in virtiofs:
- allow_other (always set to 1 in guest kernel)
- auto_unmount
- -s (singlethread)

Let's remove unused options from help in order not to confuse users.

---
 tools/virtiofsd/fuse_lowlevel.c | 12 +++---------
 tools/virtiofsd/fuse_lowlevel.h |  1 -
 tools/virtiofsd/helper.c        |  2 --
 3 files changed, 3 insertions(+), 12 deletions(-)
tools/virtiofsd/fuse_lowlevel.c +3 -9
index 2ce3e739fd..00554c6aa7 100644
@@ -2539,11 +2539,9 @@ void fuse_lowlevel_help(void)
      * potentially of interest to an end-user
      */
     printf(
-        "    -o allow_other             allow access by all users\n"
         "    -o allow_root              allow access by root\n"
         "    --socket-path=PATH         path for the vhost-user socket\n"
         "    --fd=FDNUM                 fd number of vhost-user socket\n"
-        "    -o auto_unmount            auto unmount on process termination\n"
         "    --thread-pool-size=NUM     thread pool size limit (default %d)\n",
         THREAD_POOL_SIZE);
 }
@@ -2612,14 +2610,10 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
          * Allowing access only by root is done by instructing
          * kernel to allow access by everyone, and then restricting
          * access to root and mountpoint owner in libfuse.
+         *
+         * Note: allow_other is set to 1 in guest kernel for virtiofs
+         * so nothing needs to be done here
          */
-        /*
-         * We may be adding the option a second time, but
-         * that doesn't hurt.
-         */
-        if (fuse_opt_add_arg(args, "-oallow_other") == -1) {
-            goto out2;
-        }
     }
     if (args->argc == 1 && args->argv[0][0] == '-') {
         fuse_log(FUSE_LOG_ERR,
tools/virtiofsd/fuse_lowlevel.h +0 -1
index 3a7213f42f..aa5f62c846 100644
@@ -1820,7 +1820,6 @@ void fuse_cmdline_help(void);
  */
 
 struct fuse_cmdline_opts {
-    int singlethread;
     int foreground;
     int debug;
     int nodefault_subtype;
tools/virtiofsd/helper.c +0 -2
index 8f00737b1a..9dd4199800 100644
@@ -47,7 +47,6 @@ static const struct fuse_opt fuse_helper_opts[] = {
     FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP),
     FUSE_HELPER_OPT("-f", foreground),
     FUSE_HELPER_OPT_VALUE("--daemonize", foreground, 0),
-    FUSE_HELPER_OPT("-s", singlethread),
     FUSE_HELPER_OPT("fsname=", nodefault_subtype),
     FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP),
     FUSE_HELPER_OPT("subtype=", nodefault_subtype),
@@ -145,7 +144,6 @@ void fuse_cmdline_help(void)
            "    --syslog                   log to syslog (default stderr)\n"
            "    -f                         foreground operation\n"
            "    --daemonize                run in background\n"
-           "    -s                         disable multi-threaded operation\n"
            "    -o cache=<mode>            cache mode. could be one of \"auto, "
            "always, none\"\n"
            "                               default: auto\n"
Signature · 1 line
2.21.1
#137 lore raw

Re: [PATCH v2 109/109] virtiofsd: add some options to the help message

Quoted 19 lines · * Misono Tomohiro ([email protected]) wrote:
Quoted 12 lines

From: Masayoshi Mizuma <[email protected]>

Add following options to the help message:
- cache
- flock|no_flock
- norace
- posix_lock|no_posix_lock
- readdirplus|no_readdirplus
- timeout
- writeback|no_writeback
- xattr|no_xattr

Quoted 6 lines

dgilbert: Split cache, norace, posix_lock, readdirplus off
into our own earlier patches that added the options

Quoted 8 lines

Hello,

I think we also need to remove unused options from help message as well. Could you please review following patch and add or fold to this patch if it is ok.

Thanks,
Misono

Thanks, I've merged that into the 'Trim down imported files'

Quoted 39 lines

=====
[PATCH] virtiofsd: Remove unused options

Following options came from libfuse but not used in virtiofs:
- allow_other (always set to 1 in guest kernel)
- auto_unmount
- -s (singlethread)

Let's remove unused options from help in order not to confuse users.

---
 tools/virtiofsd/fuse_lowlevel.c | 12 +++---------
 tools/virtiofsd/fuse_lowlevel.h |  1 -
 tools/virtiofsd/helper.c        |  2 --
 3 files changed, 3 insertions(+), 12 deletions(-)
tools/virtiofsd/fuse_lowlevel.c +2 -2
index 2ce3e739fd..00554c6aa7 100644
@@ -2539,11 +2539,9 @@ void fuse_lowlevel_help(void)
      * potentially of interest to an end-user
      */
     printf(
-        "    -o allow_other             allow access by all users\n"
         "    -o allow_root              allow access by root\n"
         "    --socket-path=PATH         path for the vhost-user socket\n"
         "    --fd=FDNUM                 fd number of vhost-user socket\n"
-        "    -o auto_unmount            auto unmount on process termination\n"
         "    --thread-pool-size=NUM     thread pool size limit (default %d)\n",
         THREAD_POOL_SIZE);
 }
@@ -2612,14 +2610,10 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
          * Allowing access only by root is done by instructing
          * kernel to allow access by everyone, and then restricting
          * access to root and mountpoint owner in libfuse.
+         *
+         * Note: allow_other is set to 1 in guest kernel for virtiofs

tools/virtiofsd/fuse_lowlevel.c struct fuse_session *fuse_session_new(struct fuse_args *args, · line 2617

Quoted 10 lines
tools/virtiofsd/fuse_lowlevel.c +1 -7
+         * so nothing needs to be done here
          */
-        /*
-         * We may be adding the option a second time, but
-         * that doesn't hurt.
-         */
-        if (fuse_opt_add_arg(args, "-oallow_other") == -1) {
-            goto out2;
-        }
     }

I took out the surrounding 'if' as well because there was nothing left except for the comment.

Dave

Quoted 37 lines
tools/virtiofsd/fuse_lowlevel.c +0 -0
     if (args->argc == 1 && args->argv[0][0] == '-') {
         fuse_log(FUSE_LOG_ERR,
tools/virtiofsd/fuse_lowlevel.h +0 -1
index 3a7213f42f..aa5f62c846 100644
@@ -1820,7 +1820,6 @@ void fuse_cmdline_help(void);
  */
 
 struct fuse_cmdline_opts {
-    int singlethread;
     int foreground;
     int debug;
     int nodefault_subtype;
tools/virtiofsd/helper.c +0 -2
index 8f00737b1a..9dd4199800 100644
@@ -47,7 +47,6 @@ static const struct fuse_opt fuse_helper_opts[] = {
     FUSE_OPT_KEY("debug", FUSE_OPT_KEY_KEEP),
     FUSE_HELPER_OPT("-f", foreground),
     FUSE_HELPER_OPT_VALUE("--daemonize", foreground, 0),
-    FUSE_HELPER_OPT("-s", singlethread),
     FUSE_HELPER_OPT("fsname=", nodefault_subtype),
     FUSE_OPT_KEY("fsname=", FUSE_OPT_KEY_KEEP),
     FUSE_HELPER_OPT("subtype=", nodefault_subtype),
@@ -145,7 +144,6 @@ void fuse_cmdline_help(void)
            "    --syslog                   log to syslog (default stderr)\n"
            "    -f                         foreground operation\n"
            "    --daemonize                run in background\n"
-           "    -s                         disable multi-threaded operation\n"
            "    -o cache=<mode>            cache mode. could be one of \"auto, "
            "always, none\"\n"
            "                               default: auto\n"
Signature · 1 line
2.21.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#138 lore raw
In reply to Dr. David Alan Gilbert (git)
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH v2 000/109] virtiofs daemon [all]

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Switched to a new branch 'test'
a8772f4 virtiofsd: add some options to the help message
5de75ca virtiofsd: stop all queue threads on exit in virtio_loop() e408daa virtiofsd/passthrough_ll: Pass errno to fuse_reply_err()
666dfff virtiofsd: Convert lo_destroy to take the lo->mutex lock itself 685e049 virtiofsd: add --thread-pool-size=NUM option
ed1bf33 virtiofsd: fix lo_destroy() resource leaks
d5f6038 virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races
68b4996 virtiofsd: process requests in a thread pool
3efc97a virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better performance ac87055 virtiofsd: add definition of fuse_buf_writev()
5bcecff virtiofsd: Fix data corruption with O_APPEND write in writeback mode 85c9154 virtiofsd: Reset O_DIRECT flag during file open
0a73f29 virtiofsd: convert more fprintf and perror to use fuse log infra 5089e4a virtiofsd: do not always set FUSE_FLOCK_LOCKS
8e1ba8b virtiofsd: introduce inode refcount to prevent use-after-free ae82e36 virtiofsd: passthrough_ll: fix refcounting on remove/rename b341c29 virtiofsd: add man page
e186f1f libvhost-user: Fix some memtable remap cases
c8bf890 virtiofsd: rename inode->refcount to inode->nlookup
26f3777 virtiofsd: prevent races with lo_dirp_put()
a5dcf06 virtiofsd: make lo_release() atomic
0cc4d67 virtiofsd: prevent fv_queue_thread() vs virtio_loop() races 2e3eb7d virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy() c428a7b virtiofsd: Support remote posix locks
9f0856c Virtiofsd: fix memory leak on fuse queueinfo
961aacb virtiofsd: fix incorrect error handling in lo_do_lookup
cdf841a virtiofsd: enable PARALLEL_DIROPS during INIT
467dd68 virtiofsd: Prevent multiply running with same vhost_user_socket 96437e7 virtiofsd: add helper for lo_data cleanup
e684d3f virtiofsd: fix memory leak on lo.source
df9ab38 virtiofsd: cleanup allocated resource in se
508c6fe virtiofsd: fix error handling in main()
63d578f virtiofsd: support nanosecond resolution for file timestamp 7159d81 virtiofsd: Clean up inodes on destroy
a1dc539 virtiofsd: passthrough_ll: use hashtable
4d18c7e virtiofsd: passthrough_ll: clean up cache related options
d8eb059 virtiofsd: extract root inode init into setup_root()
cec9647 virtiofsd: fail when parent inode isn't known in lo_do_lookup() 6fe9f19 virtiofsd: rename unref_inode() to unref_inode_lolocked()
c4b3f6a virtiofsd: passthrough_ll: control readdirplus
7c9cf1f virtiofsd: passthrough_ll: disable readdirplus on cache=never 53b30be virtiofsd: passthrough_ll: add renameat2 support
11361bd contrib/libvhost-user: Protect slave fd with mutex
e3cc2ba vhost-user: Print unexpected slave message types
11020ae virtiofsd: Kill threads when queues are stopped
eb8bcda virtiofsd: Handle hard reboot
e50f35d virtiofsd: Handle reinit
a67a31a virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level 3d89fb4 virtiofsd: Add ID to the log with FUSE_LOG_DEBUG level
a81ca7e virtiofsd: print log only when priority is high enough
edd9719 virtiofsd: add --syslog command-line option
efe201e virtiofsd: add security guide document
2dad7b2 docs: Add docs/tools
9f1fa14 virtiofsd: fix libfuse information leaks
c0baae4 virtiofsd: set maximum RLIMIT_NOFILE limit
76446bf virtiofsd: Drop CAP_FSETID if client asked for it
ab43896 virtiofsd: cap-ng helpers
2671d8d virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV
40c8f88 virtiofsd: add seccomp whitelist
ae376f2 virtiofsd: move to a new pid namespace
c16b4a4 virtiofsd: move to an empty network namespace
7c4d13b virtiofsd: sandbox mount namespace
339f772 virtiofsd: use /proc/self/fd/ O_PATH file descriptor
1ef2f81 virtiofsd: prevent ".." escape in lo_do_readdir()
c99dc2e virtiofsd: prevent ".." escape in lo_do_lookup()
50f4f13 virtiofsd: check input buffer size in fuse_lowlevel.c ops
6876dc5 virtiofsd: validate input buffer sizes in do_write_buf()
4387aa0 virtiofsd: add fuse_mbuf_iter API
cc2fbb4 virtiofsd: Pass write iov's all the way through
43ecbf3 virtiofsd: Plumb fuse_bufvec through to do_write_buf
ccdf460 virtiofsd: validate path components
3091d61 virtiofsd: passthrough_ll: add fallback for racy ops
1503ea8 virtiofsd: passthrough_ll: add fd_map to hide file descriptors 8636126 virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers 644fc3d virtiofsd: passthrough_ll: add ino_map to hide lo_inode pointers 939a8c1 virtiofsd: passthrough_ll: add lo_map for ino/fh indirection c28971c virtiofsd: passthrough_ll: create new files in caller's context 3057356 virtiofs: Add maintainers entry
ccd0ea7 virtiofsd: add --print-capabilities option
45b7e05 virtiofsd: add vhost-user.json file
765bef1 virtiofsd: make -f (foreground) the default
4786066 virtiofsd: add --fd=FDNUM fd passing option
4cc4b1f virtiofsd: Fast path for virtio read
218ed21 virtiofsd: Add Makefile wiring for virtiofsd contrib
8d3af2f virtiofsd: Keep track of replies
f3879c2 virtiofsd: Send replies to messages
3539f64 virtiofsd: Start reading commands from queue
fab13e3 virtiofsd: Poll kick_fd for queue
ab5fc4d virtiofsd: Start queue threads
ae01056 virtiofsd: get/set features callbacks
9aede91 virtiofsd: Add main virtio loop
87ea47a virtiofsd: Start wiring up vhost-user
9c3144f virtiofsd: Open vhost connection instead of mounting
1571a3e virtiofsd: add -o source=PATH to help output
e35e623 virtiofsd: Add options for virtio
6c2c400 virtiofsd: Make fsync work even if only inode is passed in 5df6fea vitriofsd/passthrough_ll: fix fallocate() ifdefs
574d6f0 virtiofsd: Trim out compatibility code
739dd58 virtiofsd: Fix common header and define for QEMU builds
5d45435 virtiofsd: Fix fuse_daemonize ignored return values
e2d7a5a virtiofsd: remove unused notify reply support
cd8ab81 virtiofsd: remove mountpoint dummy argument
16be3a4 virtiofsd: Format imported files to qemu style
6f5a056 virtiofsd: Trim down imported files
3967519 virtiofsd: Add passthrough_ll
00022bc virtiofsd: Add fuse_lowlevel.c
f4d42e2 virtiofsd: Add auxiliary .c's
6244fcd virtiofsd: Pull in kernel's fuse.h
485fb8a virtiofsd: Pull in upstream headers

=== OUTPUT BEGIN ===
1/109 Checking commit 485fb8a6ae57 (virtiofsd: Pull in upstream headers)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #15:
new file mode 100644

WARNING: Block comments use * on subsequent lines
#21: FILE: tools/virtiofsd/fuse.h:2:
+/*
+ FUSE: Filesystem in Userspace

WARNING: Block comments use a leading /* on a separate line #31: FILE: tools/virtiofsd/fuse.h:12:
+/** @file

WARNING: architecture specific defines should be avoided #47: FILE: tools/virtiofsd/fuse.h:28:
+#ifdef __cplusplus

WARNING: Block comments use a leading /* on a separate line #51: FILE: tools/virtiofsd/fuse.h:32:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#52: FILE: tools/virtiofsd/fuse.h:33:
+ * Basic FUSE API^I^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #53: FILE: tools/virtiofsd/fuse.h:34:
+ * ----------------------------------------------------------- */

ERROR: code indent should never use tabs
#62: FILE: tools/virtiofsd/fuse.h:43:
+^I/**$

ERROR: code indent should never use tabs
#63: FILE: tools/virtiofsd/fuse.h:44:
+^I * "Plus" mode.$

ERROR: code indent should never use tabs
#64: FILE: tools/virtiofsd/fuse.h:45:
+^I *$

ERROR: code indent should never use tabs
#65: FILE: tools/virtiofsd/fuse.h:46:
+^I * The kernel wants to prefill the inode cache during readdir. The$

ERROR: code indent should never use tabs
#66: FILE: tools/virtiofsd/fuse.h:47:
+^I * filesystem may honour this by filling in the attributes and setting$

ERROR: code indent should never use tabs
#67: FILE: tools/virtiofsd/fuse.h:48:
+^I * FUSE_FILL_DIR_FLAGS for the filler function. The filesystem may also$

ERROR: code indent should never use tabs
#68: FILE: tools/virtiofsd/fuse.h:49:
+^I * just ignore this flag completely.$

ERROR: code indent should never use tabs
#69: FILE: tools/virtiofsd/fuse.h:50:
+^I */$

ERROR: code indent should never use tabs
#70: FILE: tools/virtiofsd/fuse.h:51:
+^IFUSE_READDIR_PLUS = (1 << 0),$

ERROR: code indent should never use tabs
#74: FILE: tools/virtiofsd/fuse.h:55:
+^I/**$

ERROR: code indent should never use tabs
#75: FILE: tools/virtiofsd/fuse.h:56:
+^I * "Plus" mode: all file attributes are valid$

ERROR: code indent should never use tabs
#76: FILE: tools/virtiofsd/fuse.h:57:
+^I *$

ERROR: code indent should never use tabs
#77: FILE: tools/virtiofsd/fuse.h:58:
+^I * The attributes are used by the kernel to prefill the inode cache$

ERROR: code indent should never use tabs
#78: FILE: tools/virtiofsd/fuse.h:59:
+^I * during a readdir.$

ERROR: code indent should never use tabs
#79: FILE: tools/virtiofsd/fuse.h:60:
+^I *$

ERROR: code indent should never use tabs
#80: FILE: tools/virtiofsd/fuse.h:61:
+^I * It is okay to set FUSE_FILL_DIR_PLUS if FUSE_READDIR_PLUS is not set$

ERROR: code indent should never use tabs
#81: FILE: tools/virtiofsd/fuse.h:62:
+^I * and vice versa.$

ERROR: code indent should never use tabs
#82: FILE: tools/virtiofsd/fuse.h:63:
+^I */$

ERROR: code indent should never use tabs
#83: FILE: tools/virtiofsd/fuse.h:64:
+^IFUSE_FILL_DIR_PLUS = (1 << 1),$

WARNING: Block comments use a leading /* on a separate line #86: FILE: tools/virtiofsd/fuse.h:67:
+/** Function to add an entry in a readdir() operation

ERROR: trailing whitespace
#93: FILE: tools/virtiofsd/fuse.h:74:
+ * $

ERROR: code indent should never use tabs
#102: FILE: tools/virtiofsd/fuse.h:83:
+^I^I^I^Iconst struct stat *stbuf, off_t off,$

ERROR: code indent should never use tabs
#103: FILE: tools/virtiofsd/fuse.h:84:
+^I^I^I^Ienum fuse_fill_dir_flags flags);$

ERROR: code indent should never use tabs
#113: FILE: tools/virtiofsd/fuse.h:94:
+^I/**$

ERROR: code indent should never use tabs
#114: FILE: tools/virtiofsd/fuse.h:95:
+^I * If set_gid is non-zero, the st_gid attribute of each file$

ERROR: code indent should never use tabs
#115: FILE: tools/virtiofsd/fuse.h:96:
+^I * is overwritten with the value of gid.$

ERROR: code indent should never use tabs
#116: FILE: tools/virtiofsd/fuse.h:97:
+^I */$

ERROR: code indent should never use tabs
#117: FILE: tools/virtiofsd/fuse.h:98:
+^Iint set_gid;$

ERROR: code indent should never use tabs
#118: FILE: tools/virtiofsd/fuse.h:99:
+^Iunsigned int gid;$

ERROR: code indent should never use tabs
#120: FILE: tools/virtiofsd/fuse.h:101:
+^I/**$

ERROR: code indent should never use tabs
#121: FILE: tools/virtiofsd/fuse.h:102:
+^I * If set_uid is non-zero, the st_uid attribute of each file$

ERROR: code indent should never use tabs
#122: FILE: tools/virtiofsd/fuse.h:103:
+^I * is overwritten with the value of uid.$

ERROR: code indent should never use tabs
#123: FILE: tools/virtiofsd/fuse.h:104:
+^I */$

ERROR: code indent should never use tabs
#124: FILE: tools/virtiofsd/fuse.h:105:
+^Iint set_uid;$

ERROR: code indent should never use tabs
#125: FILE: tools/virtiofsd/fuse.h:106:
+^Iunsigned int uid;$

ERROR: code indent should never use tabs
#127: FILE: tools/virtiofsd/fuse.h:108:
+^I/**$

ERROR: code indent should never use tabs
#128: FILE: tools/virtiofsd/fuse.h:109:
+^I * If set_mode is non-zero, the any permissions bits set in$

ERROR: code indent should never use tabs
#129: FILE: tools/virtiofsd/fuse.h:110:
+^I * umask are unset in the st_mode attribute of each file.$

ERROR: code indent should never use tabs
#130: FILE: tools/virtiofsd/fuse.h:111:
+^I */$

ERROR: code indent should never use tabs
#131: FILE: tools/virtiofsd/fuse.h:112:
+^Iint set_mode;$

ERROR: code indent should never use tabs
#132: FILE: tools/virtiofsd/fuse.h:113:
+^Iunsigned int umask;$

ERROR: code indent should never use tabs
#134: FILE: tools/virtiofsd/fuse.h:115:
+^I/**$

ERROR: code indent should never use tabs
#135: FILE: tools/virtiofsd/fuse.h:116:
+^I * The timeout in seconds for which name lookups will be$

ERROR: code indent should never use tabs
#136: FILE: tools/virtiofsd/fuse.h:117:
+^I * cached.$

ERROR: code indent should never use tabs
#137: FILE: tools/virtiofsd/fuse.h:118:
+^I */$

ERROR: code indent should never use tabs
#138: FILE: tools/virtiofsd/fuse.h:119:
+^Idouble entry_timeout;$

ERROR: code indent should never use tabs
#140: FILE: tools/virtiofsd/fuse.h:121:
+^I/**$

ERROR: code indent should never use tabs
#141: FILE: tools/virtiofsd/fuse.h:122:
+^I * The timeout in seconds for which a negative lookup will be$

ERROR: code indent should never use tabs
#142: FILE: tools/virtiofsd/fuse.h:123:
+^I * cached. This means, that if file did not exist (lookup$

ERROR: code indent should never use tabs
#143: FILE: tools/virtiofsd/fuse.h:124:
+^I * retuned ENOENT), the lookup will only be redone after the$

ERROR: code indent should never use tabs
#144: FILE: tools/virtiofsd/fuse.h:125:
+^I * timeout, and the file/directory will be assumed to not$

ERROR: code indent should never use tabs
#145: FILE: tools/virtiofsd/fuse.h:126:
+^I * exist until then. A value of zero means that negative$

ERROR: code indent should never use tabs
#146: FILE: tools/virtiofsd/fuse.h:127:
+^I * lookups are not cached.$

ERROR: code indent should never use tabs
#147: FILE: tools/virtiofsd/fuse.h:128:
+^I */$

ERROR: code indent should never use tabs
#148: FILE: tools/virtiofsd/fuse.h:129:
+^Idouble negative_timeout;$

ERROR: code indent should never use tabs
#150: FILE: tools/virtiofsd/fuse.h:131:
+^I/**$

ERROR: code indent should never use tabs
#151: FILE: tools/virtiofsd/fuse.h:132:
+^I * The timeout in seconds for which file/directory attributes$

ERROR: code indent should never use tabs
#152: FILE: tools/virtiofsd/fuse.h:133:
+^I * (as returned by e.g. the getattr handler) are cached.$

ERROR: code indent should never use tabs
#153: FILE: tools/virtiofsd/fuse.h:134:
+^I */$

ERROR: code indent should never use tabs
#154: FILE: tools/virtiofsd/fuse.h:135:
+^Idouble attr_timeout;$

ERROR: code indent should never use tabs
#156: FILE: tools/virtiofsd/fuse.h:137:
+^I/**$

ERROR: code indent should never use tabs
#157: FILE: tools/virtiofsd/fuse.h:138:
+^I * Allow requests to be interrupted$

ERROR: code indent should never use tabs
#158: FILE: tools/virtiofsd/fuse.h:139:
+^I */$

ERROR: code indent should never use tabs
#159: FILE: tools/virtiofsd/fuse.h:140:
+^Iint intr;$

ERROR: code indent should never use tabs
#161: FILE: tools/virtiofsd/fuse.h:142:
+^I/**$

ERROR: code indent should never use tabs
#162: FILE: tools/virtiofsd/fuse.h:143:
+^I * Specify which signal number to send to the filesystem when$

ERROR: code indent should never use tabs
#163: FILE: tools/virtiofsd/fuse.h:144:
+^I * a request is interrupted. The default is hardcoded to$

ERROR: code indent should never use tabs
#164: FILE: tools/virtiofsd/fuse.h:145:
+^I * USR1.$

ERROR: code indent should never use tabs
#165: FILE: tools/virtiofsd/fuse.h:146:
+^I */$

ERROR: code indent should never use tabs
#166: FILE: tools/virtiofsd/fuse.h:147:
+^Iint intr_signal;$

ERROR: code indent should never use tabs
#168: FILE: tools/virtiofsd/fuse.h:149:
+^I/**$

ERROR: code indent should never use tabs
#169: FILE: tools/virtiofsd/fuse.h:150:
+^I * Normally, FUSE assigns inodes to paths only for as long as$

ERROR: code indent should never use tabs
#170: FILE: tools/virtiofsd/fuse.h:151:
+^I * the kernel is aware of them. With this option inodes are$

ERROR: code indent should never use tabs
#171: FILE: tools/virtiofsd/fuse.h:152:
+^I * instead remembered for at least this many seconds. This$

ERROR: code indent should never use tabs
#172: FILE: tools/virtiofsd/fuse.h:153:
+^I * will require more memory, but may be necessary when using$

ERROR: code indent should never use tabs #173: FILE: tools/virtiofsd/fuse.h:154:
+^I * applications that make use of inode numbers.$

ERROR: code indent should never use tabs
#174: FILE: tools/virtiofsd/fuse.h:155:
+^I *$

ERROR: code indent should never use tabs
#175: FILE: tools/virtiofsd/fuse.h:156:
+^I * A number of -1 means that inodes will be remembered for the$

ERROR: code indent should never use tabs #176: FILE: tools/virtiofsd/fuse.h:157:
+^I * entire life-time of the file-system process.$

ERROR: code indent should never use tabs
#177: FILE: tools/virtiofsd/fuse.h:158:
+^I */$

ERROR: code indent should never use tabs
#178: FILE: tools/virtiofsd/fuse.h:159:
+^Iint remember;$

ERROR: code indent should never use tabs
#180: FILE: tools/virtiofsd/fuse.h:161:
+^I/**$

ERROR: code indent should never use tabs
#181: FILE: tools/virtiofsd/fuse.h:162:
+^I * The default behavior is that if an open file is deleted,$

ERROR: code indent should never use tabs
#182: FILE: tools/virtiofsd/fuse.h:163:
+^I * the file is renamed to a hidden file (.fuse_hiddenXXX), and$

ERROR: code indent should never use tabs
#183: FILE: tools/virtiofsd/fuse.h:164:
+^I * only removed when the file is finally released. This$

ERROR: code indent should never use tabs
#184: FILE: tools/virtiofsd/fuse.h:165:
+^I * relieves the filesystem implementation of having to deal$

ERROR: code indent should never use tabs
#185: FILE: tools/virtiofsd/fuse.h:166:
+^I * with this problem. This option disables the hiding$

ERROR: code indent should never use tabs
#186: FILE: tools/virtiofsd/fuse.h:167:
+^I * behavior, and files are removed immediately in an unlink$

ERROR: code indent should never use tabs
#187: FILE: tools/virtiofsd/fuse.h:168:
+^I * operation (or in a rename operation which overwrites an$

ERROR: code indent should never use tabs
#188: FILE: tools/virtiofsd/fuse.h:169:
+^I * existing file).$

ERROR: code indent should never use tabs
#189: FILE: tools/virtiofsd/fuse.h:170:
+^I *$

ERROR: code indent should never use tabs
#190: FILE: tools/virtiofsd/fuse.h:171:
+^I * It is recommended that you not use the hard_remove$

ERROR: code indent should never use tabs
#191: FILE: tools/virtiofsd/fuse.h:172:
+^I * option. When hard_remove is set, the following libc$

ERROR: code indent should never use tabs
#192: FILE: tools/virtiofsd/fuse.h:173:
+^I * functions fail on unlinked files (returning errno of$

ERROR: code indent should never use tabs
#193: FILE: tools/virtiofsd/fuse.h:174:
+^I * ENOENT): read(2), write(2), fsync(2), close(2), f*xattr(2),$

ERROR: code indent should never use tabs #194: FILE: tools/virtiofsd/fuse.h:175:
+^I * ftruncate(2), fstat(2), fchmod(2), fchown(2)$

ERROR: code indent should never use tabs
#195: FILE: tools/virtiofsd/fuse.h:176:
+^I */$

ERROR: code indent should never use tabs
#196: FILE: tools/virtiofsd/fuse.h:177:
+^Iint hard_remove;$

ERROR: code indent should never use tabs
#198: FILE: tools/virtiofsd/fuse.h:179:
+^I/**$

ERROR: code indent should never use tabs
#199: FILE: tools/virtiofsd/fuse.h:180:
+^I * Honor the st_ino field in the functions getattr() and$

ERROR: code indent should never use tabs
#200: FILE: tools/virtiofsd/fuse.h:181:
+^I * fill_dir(). This value is used to fill in the st_ino field$

ERROR: code indent should never use tabs
#201: FILE: tools/virtiofsd/fuse.h:182:
+^I * in the stat(2), lstat(2), fstat(2) functions and the d_ino$

ERROR: code indent should never use tabs
#202: FILE: tools/virtiofsd/fuse.h:183:
+^I * field in the readdir(2) function. The filesystem does not$

ERROR: code indent should never use tabs
#203: FILE: tools/virtiofsd/fuse.h:184:
+^I * have to guarantee uniqueness, however some applications$

ERROR: code indent should never use tabs
#204: FILE: tools/virtiofsd/fuse.h:185:
+^I * rely on this value being unique for the whole filesystem.$

ERROR: code indent should never use tabs
#205: FILE: tools/virtiofsd/fuse.h:186:
+^I *$

ERROR: trailing whitespace
#206: FILE: tools/virtiofsd/fuse.h:187:
+^I * Note that this does *not* affect the inode that libfuse $

ERROR: code indent should never use tabs
#206: FILE: tools/virtiofsd/fuse.h:187:
+^I * Note that this does *not* affect the inode that libfuse $

ERROR: code indent should never use tabs
#207: FILE: tools/virtiofsd/fuse.h:188:
+^I * and the kernel use internally (also called the "nodeid").$

ERROR: code indent should never use tabs
#208: FILE: tools/virtiofsd/fuse.h:189:
+^I */$

ERROR: code indent should never use tabs
#209: FILE: tools/virtiofsd/fuse.h:190:
+^Iint use_ino;$

ERROR: code indent should never use tabs
#211: FILE: tools/virtiofsd/fuse.h:192:
+^I/**$

ERROR: code indent should never use tabs
#212: FILE: tools/virtiofsd/fuse.h:193:
+^I * If use_ino option is not given, still try to fill in the$

ERROR: code indent should never use tabs
#213: FILE: tools/virtiofsd/fuse.h:194:
+^I * d_ino field in readdir(2). If the name was previously$

ERROR: code indent should never use tabs
#214: FILE: tools/virtiofsd/fuse.h:195:
+^I * looked up, and is still in the cache, the inode number$

ERROR: code indent should never use tabs
#215: FILE: tools/virtiofsd/fuse.h:196:
+^I * found there will be used. Otherwise it will be set to -1.$

ERROR: code indent should never use tabs
#216: FILE: tools/virtiofsd/fuse.h:197:
+^I * If use_ino option is given, this option is ignored.$

ERROR: code indent should never use tabs
#217: FILE: tools/virtiofsd/fuse.h:198:
+^I */$

ERROR: code indent should never use tabs
#218: FILE: tools/virtiofsd/fuse.h:199:
+^Iint readdir_ino;$

ERROR: code indent should never use tabs
#220: FILE: tools/virtiofsd/fuse.h:201:
+^I/**$

ERROR: code indent should never use tabs
#221: FILE: tools/virtiofsd/fuse.h:202:
+^I * This option disables the use of page cache (file content cache)$

ERROR: code indent should never use tabs
#222: FILE: tools/virtiofsd/fuse.h:203:
+^I * in the kernel for this filesystem. This has several affects:$

ERROR: code indent should never use tabs
#223: FILE: tools/virtiofsd/fuse.h:204:
+^I *$

ERROR: code indent should never use tabs
#224: FILE: tools/virtiofsd/fuse.h:205:
+^I * 1. Each read(2) or write(2) system call will initiate one$

ERROR: code indent should never use tabs
#225: FILE: tools/virtiofsd/fuse.h:206:
+^I * or more read or write operations, data will not be$

ERROR: code indent should never use tabs
#226: FILE: tools/virtiofsd/fuse.h:207:
+^I * cached in the kernel.$

ERROR: code indent should never use tabs
#227: FILE: tools/virtiofsd/fuse.h:208:
+^I *$

ERROR: code indent should never use tabs
#228: FILE: tools/virtiofsd/fuse.h:209:
+^I * 2. The return value of the read() and write() system calls$

ERROR: code indent should never use tabs
#229: FILE: tools/virtiofsd/fuse.h:210:
+^I * will correspond to the return values of the read and$

ERROR: code indent should never use tabs
#230: FILE: tools/virtiofsd/fuse.h:211:
+^I * write operations. This is useful for example if the$

ERROR: code indent should never use tabs
#231: FILE: tools/virtiofsd/fuse.h:212:
+^I * file size is not known in advance (before reading it).$

ERROR: code indent should never use tabs
#232: FILE: tools/virtiofsd/fuse.h:213:
+^I *$

ERROR: code indent should never use tabs
#233: FILE: tools/virtiofsd/fuse.h:214:
+^I * Internally, enabling this option causes fuse to set the$

ERROR: code indent should never use tabs
#234: FILE: tools/virtiofsd/fuse.h:215:
+^I * direct_io field of struct fuse_file_info - overwriting$

ERROR: code indent should never use tabs
#235: FILE: tools/virtiofsd/fuse.h:216:
+^I * any value that was put there by the file system.$

ERROR: code indent should never use tabs
#236: FILE: tools/virtiofsd/fuse.h:217:
+^I */$

ERROR: code indent should never use tabs
#237: FILE: tools/virtiofsd/fuse.h:218:
+^Iint direct_io;$

ERROR: code indent should never use tabs
#239: FILE: tools/virtiofsd/fuse.h:220:
+^I/**$

ERROR: code indent should never use tabs
#240: FILE: tools/virtiofsd/fuse.h:221:
+^I * This option disables flushing the cache of the file$

ERROR: code indent should never use tabs
#241: FILE: tools/virtiofsd/fuse.h:222:
+^I * contents on every open(2). This should only be enabled on$

ERROR: code indent should never use tabs
#242: FILE: tools/virtiofsd/fuse.h:223:
+^I * filesystems where the file data is never changed$

ERROR: code indent should never use tabs
#243: FILE: tools/virtiofsd/fuse.h:224:
+^I * externally (not through the mounted FUSE filesystem). Thus$

ERROR: code indent should never use tabs
#244: FILE: tools/virtiofsd/fuse.h:225:
+^I * it is not suitable for network filesystems and other$

ERROR: code indent should never use tabs
#245: FILE: tools/virtiofsd/fuse.h:226:
+^I * intermediate filesystems.$

ERROR: code indent should never use tabs
#246: FILE: tools/virtiofsd/fuse.h:227:
+^I *$

ERROR: code indent should never use tabs
#247: FILE: tools/virtiofsd/fuse.h:228:
+^I * NOTE: if this option is not specified (and neither$

ERROR: code indent should never use tabs
#248: FILE: tools/virtiofsd/fuse.h:229:
+^I * direct_io) data is still cached after the open(2), so a$

ERROR: code indent should never use tabs
#249: FILE: tools/virtiofsd/fuse.h:230:
+^I * read(2) system call will not always initiate a read$

ERROR: code indent should never use tabs
#250: FILE: tools/virtiofsd/fuse.h:231:
+^I * operation.$

ERROR: code indent should never use tabs
#251: FILE: tools/virtiofsd/fuse.h:232:
+^I *$

ERROR: code indent should never use tabs
#252: FILE: tools/virtiofsd/fuse.h:233:
+^I * Internally, enabling this option causes fuse to set the$

ERROR: code indent should never use tabs
#253: FILE: tools/virtiofsd/fuse.h:234:
+^I * keep_cache field of struct fuse_file_info - overwriting$

ERROR: code indent should never use tabs
#254: FILE: tools/virtiofsd/fuse.h:235:
+^I * any value that was put there by the file system.$

ERROR: code indent should never use tabs
#255: FILE: tools/virtiofsd/fuse.h:236:
+^I */$

ERROR: code indent should never use tabs
#256: FILE: tools/virtiofsd/fuse.h:237:
+^Iint kernel_cache;$

ERROR: code indent should never use tabs
#258: FILE: tools/virtiofsd/fuse.h:239:
+^I/**$

ERROR: code indent should never use tabs
#259: FILE: tools/virtiofsd/fuse.h:240:
+^I * This option is an alternative to kernel_cache. Instead of$

ERROR: code indent should never use tabs
#260: FILE: tools/virtiofsd/fuse.h:241:
+^I * unconditionally keeping cached data, the cached data is$

ERROR: code indent should never use tabs
#261: FILE: tools/virtiofsd/fuse.h:242:
+^I * invalidated on open(2) if if the modification time or the$

ERROR: code indent should never use tabs
#262: FILE: tools/virtiofsd/fuse.h:243:
+^I * size of the file has changed since it was last opened.$

ERROR: code indent should never use tabs
#263: FILE: tools/virtiofsd/fuse.h:244:
+^I */$

ERROR: code indent should never use tabs
#264: FILE: tools/virtiofsd/fuse.h:245:
+^Iint auto_cache;$

ERROR: code indent should never use tabs
#266: FILE: tools/virtiofsd/fuse.h:247:
+^I/**$

ERROR: code indent should never use tabs
#267: FILE: tools/virtiofsd/fuse.h:248:
+^I * The timeout in seconds for which file attributes are cached$

ERROR: code indent should never use tabs
#268: FILE: tools/virtiofsd/fuse.h:249:
+^I * for the purpose of checking if auto_cache should flush the$

ERROR: code indent should never use tabs
#269: FILE: tools/virtiofsd/fuse.h:250:
+^I * file data on open.$

ERROR: code indent should never use tabs
#270: FILE: tools/virtiofsd/fuse.h:251:
+^I */$

ERROR: code indent should never use tabs
#271: FILE: tools/virtiofsd/fuse.h:252:
+^Iint ac_attr_timeout_set;$

ERROR: code indent should never use tabs
#272: FILE: tools/virtiofsd/fuse.h:253:
+^Idouble ac_attr_timeout;$

ERROR: code indent should never use tabs
#274: FILE: tools/virtiofsd/fuse.h:255:
+^I/**$

ERROR: code indent should never use tabs
#275: FILE: tools/virtiofsd/fuse.h:256:
+^I * If this option is given the file-system handlers for the$

ERROR: code indent should never use tabs
#276: FILE: tools/virtiofsd/fuse.h:257:
+^I * following operations will not receive path information:$

ERROR: code indent should never use tabs
#277: FILE: tools/virtiofsd/fuse.h:258:
+^I * read, write, flush, release, fsync, readdir, releasedir,$

ERROR: code indent should never use tabs
#278: FILE: tools/virtiofsd/fuse.h:259:
+^I * fsyncdir, lock, ioctl and poll.$

ERROR: code indent should never use tabs
#279: FILE: tools/virtiofsd/fuse.h:260:
+^I *$

ERROR: code indent should never use tabs
#280: FILE: tools/virtiofsd/fuse.h:261:
+^I * For the truncate, getattr, chmod, chown and utimens$

ERROR: code indent should never use tabs
#281: FILE: tools/virtiofsd/fuse.h:262:
+^I * operations the path will be provided only if the struct$

ERROR: code indent should never use tabs
#282: FILE: tools/virtiofsd/fuse.h:263:
+^I * fuse_file_info argument is NULL.$

ERROR: code indent should never use tabs
#283: FILE: tools/virtiofsd/fuse.h:264:
+^I */$

ERROR: code indent should never use tabs
#284: FILE: tools/virtiofsd/fuse.h:265:
+^Iint nullpath_ok;$

ERROR: code indent should never use tabs
#286: FILE: tools/virtiofsd/fuse.h:267:
+^I/**$

ERROR: code indent should never use tabs
#287: FILE: tools/virtiofsd/fuse.h:268:
+^I * The remaining options are used by libfuse internally and$

ERROR: code indent should never use tabs
#288: FILE: tools/virtiofsd/fuse.h:269:
+^I * should not be touched.$

ERROR: code indent should never use tabs
#289: FILE: tools/virtiofsd/fuse.h:270:
+^I */$

ERROR: code indent should never use tabs
#290: FILE: tools/virtiofsd/fuse.h:271:
+^Iint show_help;$

ERROR: code indent should never use tabs
#291: FILE: tools/virtiofsd/fuse.h:272:
+^Ichar *modules;$

ERROR: code indent should never use tabs
#292: FILE: tools/virtiofsd/fuse.h:273:
+^Iint debug;$

ERROR: code indent should never use tabs
#319: FILE: tools/virtiofsd/fuse.h:300:
+^I/** Get file attributes.$

WARNING: Block comments use a leading /* on a separate line #319: FILE: tools/virtiofsd/fuse.h:300:
+ /** Get file attributes.

ERROR: code indent should never use tabs
#320: FILE: tools/virtiofsd/fuse.h:301:
+^I *$

ERROR: code indent should never use tabs
#321: FILE: tools/virtiofsd/fuse.h:302:
+^I * Similar to stat(). The 'st_dev' and 'st_blksize' fields are$

ERROR: code indent should never use tabs
#322: FILE: tools/virtiofsd/fuse.h:303:
+^I * ignored. The 'st_ino' field is ignored except if the 'use_ino'$

ERROR: code indent should never use tabs
#323: FILE: tools/virtiofsd/fuse.h:304:
+^I * mount option is given. In that case it is passed to userspace,$

ERROR: code indent should never use tabs
#324: FILE: tools/virtiofsd/fuse.h:305:
+^I * but libfuse and the kernel will still assign a different$

ERROR: code indent should never use tabs #325: FILE: tools/virtiofsd/fuse.h:306:
+^I * inode for internal use (called the "nodeid").$

ERROR: code indent should never use tabs
#326: FILE: tools/virtiofsd/fuse.h:307:
+^I *$

ERROR: code indent should never use tabs
#327: FILE: tools/virtiofsd/fuse.h:308:
+^I * fi will always be NULL if the file is not currently open, but$

ERROR: code indent should never use tabs
#328: FILE: tools/virtiofsd/fuse.h:309:
+^I * may also be NULL if the file is open.$

ERROR: code indent should never use tabs
#329: FILE: tools/virtiofsd/fuse.h:310:
+^I */$

ERROR: code indent should never use tabs
#330: FILE: tools/virtiofsd/fuse.h:311:
+^Iint (*getattr) (const char *, struct stat *, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#332: FILE: tools/virtiofsd/fuse.h:313:
+^I/** Read the target of a symbolic link$

WARNING: Block comments use a leading /* on a separate line #332: FILE: tools/virtiofsd/fuse.h:313:
+ /** Read the target of a symbolic link

ERROR: code indent should never use tabs
#333: FILE: tools/virtiofsd/fuse.h:314:
+^I *$

ERROR: code indent should never use tabs
#334: FILE: tools/virtiofsd/fuse.h:315:
+^I * The buffer should be filled with a null terminated string. The$

ERROR: code indent should never use tabs
#335: FILE: tools/virtiofsd/fuse.h:316:
+^I * buffer size argument includes the space for the terminating$

ERROR: code indent should never use tabs
#336: FILE: tools/virtiofsd/fuse.h:317:
+^I * null character.^IIf the linkname is too long to fit in the$

ERROR: code indent should never use tabs
#337: FILE: tools/virtiofsd/fuse.h:318:
+^I * buffer, it should be truncated.^IThe return value should be 0$

ERROR: code indent should never use tabs
#338: FILE: tools/virtiofsd/fuse.h:319:
+^I * for success.$

ERROR: code indent should never use tabs
#339: FILE: tools/virtiofsd/fuse.h:320:
+^I */$

ERROR: code indent should never use tabs #340: FILE: tools/virtiofsd/fuse.h:321:
+^Iint (*readlink) (const char *, char *, size_t);$

ERROR: code indent should never use tabs
#342: FILE: tools/virtiofsd/fuse.h:323:
+^I/** Create a file node$

WARNING: Block comments use a leading /* on a separate line #342: FILE: tools/virtiofsd/fuse.h:323:
+ /** Create a file node

ERROR: code indent should never use tabs
#343: FILE: tools/virtiofsd/fuse.h:324:
+^I *$

ERROR: code indent should never use tabs
#344: FILE: tools/virtiofsd/fuse.h:325:
+^I * This is called for creation of all non-directory, non-symlink$

ERROR: code indent should never use tabs
#345: FILE: tools/virtiofsd/fuse.h:326:
+^I * nodes. If the filesystem defines a create() method, then for$

ERROR: code indent should never use tabs
#346: FILE: tools/virtiofsd/fuse.h:327:
+^I * regular files that will be called instead.$

ERROR: code indent should never use tabs
#347: FILE: tools/virtiofsd/fuse.h:328:
+^I */$

ERROR: code indent should never use tabs
#348: FILE: tools/virtiofsd/fuse.h:329:
+^Iint (*mknod) (const char *, mode_t, dev_t);$

ERROR: code indent should never use tabs
#350: FILE: tools/virtiofsd/fuse.h:331:
+^I/** Create a directory$

WARNING: Block comments use a leading /* on a separate line #350: FILE: tools/virtiofsd/fuse.h:331:
+ /** Create a directory

ERROR: code indent should never use tabs
#351: FILE: tools/virtiofsd/fuse.h:332:
+^I *$

ERROR: code indent should never use tabs
#352: FILE: tools/virtiofsd/fuse.h:333:
+^I * Note that the mode argument may not have the type specification$

ERROR: code indent should never use tabs
#353: FILE: tools/virtiofsd/fuse.h:334:
+^I * bits set, i.e. S_ISDIR(mode) can be false. To obtain the$

ERROR: code indent should never use tabs #354: FILE: tools/virtiofsd/fuse.h:335:
+^I * correct directory type bits use mode|S_IFDIR$

ERROR: code indent should never use tabs
#355: FILE: tools/virtiofsd/fuse.h:336:
+^I * */$

WARNING: Block comments use a trailing */ on a separate line #355: FILE: tools/virtiofsd/fuse.h:336:
+ * */

ERROR: code indent should never use tabs
#356: FILE: tools/virtiofsd/fuse.h:337:
+^Iint (*mkdir) (const char *, mode_t);$

ERROR: code indent should never use tabs
#358: FILE: tools/virtiofsd/fuse.h:339:
+^I/** Remove a file */$

ERROR: code indent should never use tabs
#359: FILE: tools/virtiofsd/fuse.h:340:
+^Iint (*unlink) (const char *);$

ERROR: code indent should never use tabs
#361: FILE: tools/virtiofsd/fuse.h:342:
+^I/** Remove a directory */$

ERROR: code indent should never use tabs
#362: FILE: tools/virtiofsd/fuse.h:343:
+^Iint (*rmdir) (const char *);$

ERROR: code indent should never use tabs
#364: FILE: tools/virtiofsd/fuse.h:345:
+^I/** Create a symbolic link */$

ERROR: code indent should never use tabs
#365: FILE: tools/virtiofsd/fuse.h:346:
+^Iint (*symlink) (const char *, const char *);$

ERROR: code indent should never use tabs
#367: FILE: tools/virtiofsd/fuse.h:348:
+^I/** Rename a file$

WARNING: Block comments use a leading /* on a separate line #367: FILE: tools/virtiofsd/fuse.h:348:
+ /** Rename a file

ERROR: code indent should never use tabs
#368: FILE: tools/virtiofsd/fuse.h:349:
+^I *$

ERROR: code indent should never use tabs
#369: FILE: tools/virtiofsd/fuse.h:350:
+^I * *flags* may be RENAME_EXCHANGE or RENAME_NOREPLACE. If$

ERROR: code indent should never use tabs
#370: FILE: tools/virtiofsd/fuse.h:351:
+^I * RENAME_NOREPLACE is specified, the filesystem must not$

ERROR: code indent should never use tabs
#371: FILE: tools/virtiofsd/fuse.h:352:
+^I * overwrite *newname* if it exists and return an error$

ERROR: code indent should never use tabs
#372: FILE: tools/virtiofsd/fuse.h:353:
+^I * instead. If RENAME_EXCHANGE is specified, the filesystem$

ERROR: code indent should never use tabs
#373: FILE: tools/virtiofsd/fuse.h:354:
+^I * must atomically exchange the two files, i.e. both must$

ERROR: code indent should never use tabs
#374: FILE: tools/virtiofsd/fuse.h:355:
+^I * exist and neither may be deleted.$

ERROR: code indent should never use tabs
#375: FILE: tools/virtiofsd/fuse.h:356:
+^I */$

ERROR: code indent should never use tabs
#376: FILE: tools/virtiofsd/fuse.h:357:
+^Iint (*rename) (const char *, const char *, unsigned int flags);$

ERROR: code indent should never use tabs
#378: FILE: tools/virtiofsd/fuse.h:359:
+^I/** Create a hard link to a file */$

ERROR: code indent should never use tabs
#379: FILE: tools/virtiofsd/fuse.h:360:
+^Iint (*link) (const char *, const char *);$

ERROR: code indent should never use tabs
#381: FILE: tools/virtiofsd/fuse.h:362:
+^I/** Change the permission bits of a file$

WARNING: Block comments use a leading /* on a separate line #381: FILE: tools/virtiofsd/fuse.h:362:
+ /** Change the permission bits of a file

ERROR: code indent should never use tabs
#382: FILE: tools/virtiofsd/fuse.h:363:
+^I *$

ERROR: code indent should never use tabs
#383: FILE: tools/virtiofsd/fuse.h:364:
+^I * fi will always be NULL if the file is not currenlty open, but$

ERROR: code indent should never use tabs
#384: FILE: tools/virtiofsd/fuse.h:365:
+^I * may also be NULL if the file is open.$

ERROR: code indent should never use tabs
#385: FILE: tools/virtiofsd/fuse.h:366:
+^I */$

ERROR: code indent should never use tabs
#386: FILE: tools/virtiofsd/fuse.h:367:
+^Iint (*chmod) (const char *, mode_t, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#388: FILE: tools/virtiofsd/fuse.h:369:
+^I/** Change the owner and group of a file$

WARNING: Block comments use a leading /* on a separate line #388: FILE: tools/virtiofsd/fuse.h:369:
+ /** Change the owner and group of a file

ERROR: code indent should never use tabs
#389: FILE: tools/virtiofsd/fuse.h:370:
+^I *$

ERROR: code indent should never use tabs
#390: FILE: tools/virtiofsd/fuse.h:371:
+^I * fi will always be NULL if the file is not currenlty open, but$

ERROR: code indent should never use tabs
#391: FILE: tools/virtiofsd/fuse.h:372:
+^I * may also be NULL if the file is open.$

ERROR: code indent should never use tabs
#392: FILE: tools/virtiofsd/fuse.h:373:
+^I *$

ERROR: code indent should never use tabs
#393: FILE: tools/virtiofsd/fuse.h:374:
+^I * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is$

ERROR: code indent should never use tabs #394: FILE: tools/virtiofsd/fuse.h:375:
+^I * expected to reset the setuid and setgid bits.$

ERROR: code indent should never use tabs
#395: FILE: tools/virtiofsd/fuse.h:376:
+^I */$

ERROR: code indent should never use tabs
#396: FILE: tools/virtiofsd/fuse.h:377:
+^Iint (*chown) (const char *, uid_t, gid_t, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#398: FILE: tools/virtiofsd/fuse.h:379:
+^I/** Change the size of a file$

WARNING: Block comments use a leading /* on a separate line #398: FILE: tools/virtiofsd/fuse.h:379:
+ /** Change the size of a file

ERROR: code indent should never use tabs
#399: FILE: tools/virtiofsd/fuse.h:380:
+^I *$

ERROR: code indent should never use tabs
#400: FILE: tools/virtiofsd/fuse.h:381:
+^I * fi will always be NULL if the file is not currenlty open, but$

ERROR: code indent should never use tabs
#401: FILE: tools/virtiofsd/fuse.h:382:
+^I * may also be NULL if the file is open.$

ERROR: code indent should never use tabs
#402: FILE: tools/virtiofsd/fuse.h:383:
+^I *$

ERROR: code indent should never use tabs
#403: FILE: tools/virtiofsd/fuse.h:384:
+^I * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is$

ERROR: code indent should never use tabs #404: FILE: tools/virtiofsd/fuse.h:385:
+^I * expected to reset the setuid and setgid bits.$

ERROR: code indent should never use tabs
#405: FILE: tools/virtiofsd/fuse.h:386:
+^I */$

ERROR: code indent should never use tabs
#406: FILE: tools/virtiofsd/fuse.h:387:
+^Iint (*truncate) (const char *, off_t, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#408: FILE: tools/virtiofsd/fuse.h:389:
+^I/** Open a file$

WARNING: Block comments use a leading /* on a separate line #408: FILE: tools/virtiofsd/fuse.h:389:
+ /** Open a file

ERROR: code indent should never use tabs
#409: FILE: tools/virtiofsd/fuse.h:390:
+^I *$

ERROR: code indent should never use tabs
#410: FILE: tools/virtiofsd/fuse.h:391:
+^I * Open flags are available in fi->flags. The following rules$

ERROR: code indent should never use tabs
#411: FILE: tools/virtiofsd/fuse.h:392:
+^I * apply.$

ERROR: code indent should never use tabs
#412: FILE: tools/virtiofsd/fuse.h:393:
+^I *$

ERROR: code indent should never use tabs
#413: FILE: tools/virtiofsd/fuse.h:394:
+^I * - Creation (O_CREAT, O_EXCL, O_NOCTTY) flags will be$

ERROR: code indent should never use tabs
#414: FILE: tools/virtiofsd/fuse.h:395:
+^I * filtered out / handled by the kernel.$

ERROR: code indent should never use tabs
#415: FILE: tools/virtiofsd/fuse.h:396:
+^I *$

ERROR: code indent should never use tabs
#416: FILE: tools/virtiofsd/fuse.h:397:
+^I * - Access modes (O_RDONLY, O_WRONLY, O_RDWR, O_EXEC, O_SEARCH)$

ERROR: code indent should never use tabs
#417: FILE: tools/virtiofsd/fuse.h:398:
+^I * should be used by the filesystem to check if the operation is$

ERROR: code indent should never use tabs
#418: FILE: tools/virtiofsd/fuse.h:399:
+^I * permitted. If the ``-o default_permissions`` mount option is$

ERROR: code indent should never use tabs
#419: FILE: tools/virtiofsd/fuse.h:400:
+^I * given, this check is already done by the kernel before calling$

ERROR: code indent should never use tabs
#420: FILE: tools/virtiofsd/fuse.h:401:
+^I * open() and may thus be omitted by the filesystem.$

ERROR: code indent should never use tabs
#421: FILE: tools/virtiofsd/fuse.h:402:
+^I *$

ERROR: code indent should never use tabs
#422: FILE: tools/virtiofsd/fuse.h:403:
+^I * - When writeback caching is enabled, the kernel may send$

ERROR: code indent should never use tabs
#423: FILE: tools/virtiofsd/fuse.h:404:
+^I * read requests even for files opened with O_WRONLY. The$

ERROR: code indent should never use tabs
#424: FILE: tools/virtiofsd/fuse.h:405:
+^I * filesystem should be prepared to handle this.$

ERROR: code indent should never use tabs
#425: FILE: tools/virtiofsd/fuse.h:406:
+^I *$

ERROR: code indent should never use tabs
#426: FILE: tools/virtiofsd/fuse.h:407:
+^I * - When writeback caching is disabled, the filesystem is$

ERROR: code indent should never use tabs
#427: FILE: tools/virtiofsd/fuse.h:408:
+^I * expected to properly handle the O_APPEND flag and ensure$

ERROR: code indent should never use tabs
#428: FILE: tools/virtiofsd/fuse.h:409:
+^I * that each write is appending to the end of the file.$

ERROR: trailing whitespace
#429: FILE: tools/virtiofsd/fuse.h:410:
+^I * $

ERROR: code indent should never use tabs
#429: FILE: tools/virtiofsd/fuse.h:410:
+^I * $

ERROR: code indent should never use tabs
#431: FILE: tools/virtiofsd/fuse.h:412:
+^I * handle O_APPEND. However, unless all changes to the file$

ERROR: code indent should never use tabs
#432: FILE: tools/virtiofsd/fuse.h:413:
+^I * come through the kernel this will not work reliably. The$

ERROR: code indent should never use tabs
#433: FILE: tools/virtiofsd/fuse.h:414:
+^I * filesystem should thus either ignore the O_APPEND flag$

ERROR: code indent should never use tabs
#434: FILE: tools/virtiofsd/fuse.h:415:
+^I * (and let the kernel handle it), or return an error$

ERROR: code indent should never use tabs
#435: FILE: tools/virtiofsd/fuse.h:416:
+^I * (indicating that reliably O_APPEND is not available).$

ERROR: code indent should never use tabs
#436: FILE: tools/virtiofsd/fuse.h:417:
+^I *$

ERROR: code indent should never use tabs
#437: FILE: tools/virtiofsd/fuse.h:418:
+^I * Filesystem may store an arbitrary file handle (pointer,$

ERROR: code indent should never use tabs
#438: FILE: tools/virtiofsd/fuse.h:419:
+^I * index, etc) in fi->fh, and use this in other all other file$

ERROR: code indent should never use tabs
#439: FILE: tools/virtiofsd/fuse.h:420:
+^I * operations (read, write, flush, release, fsync).$

ERROR: code indent should never use tabs
#440: FILE: tools/virtiofsd/fuse.h:421:
+^I *$

ERROR: code indent should never use tabs
#441: FILE: tools/virtiofsd/fuse.h:422:
+^I * Filesystem may also implement stateless file I/O and not store$

ERROR: code indent should never use tabs
#442: FILE: tools/virtiofsd/fuse.h:423:
+^I * anything in fi->fh.$

ERROR: code indent should never use tabs
#443: FILE: tools/virtiofsd/fuse.h:424:
+^I *$

ERROR: code indent should never use tabs
#444: FILE: tools/virtiofsd/fuse.h:425:
+^I * There are also some flags (direct_io, keep_cache) which the$

ERROR: code indent should never use tabs
#445: FILE: tools/virtiofsd/fuse.h:426:
+^I * filesystem may set in fi, to change the way the file is opened.$

ERROR: code indent should never use tabs
#446: FILE: tools/virtiofsd/fuse.h:427:
+^I * See fuse_file_info structure in <fuse_common.h> for more details.$

ERROR: code indent should never use tabs
#447: FILE: tools/virtiofsd/fuse.h:428:
+^I *$

ERROR: code indent should never use tabs
#448: FILE: tools/virtiofsd/fuse.h:429:
+^I * If this request is answered with an error code of ENOSYS$

ERROR: code indent should never use tabs
#449: FILE: tools/virtiofsd/fuse.h:430:
+^I * and FUSE_CAP_NO_OPEN_SUPPORT is set in$

ERROR: code indent should never use tabs
#450: FILE: tools/virtiofsd/fuse.h:431:
+^I * fuse_conn_info.capable, this is treated as success and$

ERROR: code indent should never use tabs
#451: FILE: tools/virtiofsd/fuse.h:432:
+^I * future calls to open will also succeed without being send$

ERROR: code indent should never use tabs
#452: FILE: tools/virtiofsd/fuse.h:433:
+^I * to the filesystem process.$

ERROR: code indent should never use tabs
#453: FILE: tools/virtiofsd/fuse.h:434:
+^I *$

ERROR: code indent should never use tabs
#454: FILE: tools/virtiofsd/fuse.h:435:
+^I */$

ERROR: code indent should never use tabs
#455: FILE: tools/virtiofsd/fuse.h:436:
+^Iint (*open) (const char *, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#457: FILE: tools/virtiofsd/fuse.h:438:
+^I/** Read data from an open file$

WARNING: Block comments use a leading /* on a separate line #457: FILE: tools/virtiofsd/fuse.h:438:
+ /** Read data from an open file

ERROR: code indent should never use tabs
#458: FILE: tools/virtiofsd/fuse.h:439:
+^I *$

ERROR: code indent should never use tabs
#459: FILE: tools/virtiofsd/fuse.h:440:
+^I * Read should return exactly the number of bytes requested except$

ERROR: code indent should never use tabs
#460: FILE: tools/virtiofsd/fuse.h:441:
+^I * on EOF or error, otherwise the rest of the data will be$

ERROR: code indent should never use tabs
#461: FILE: tools/virtiofsd/fuse.h:442:
+^I * substituted with zeroes.^I An exception to this is when the$

ERROR: code indent should never use tabs
#462: FILE: tools/virtiofsd/fuse.h:443:
+^I * 'direct_io' mount option is specified, in which case the return$

ERROR: code indent should never use tabs
#463: FILE: tools/virtiofsd/fuse.h:444:
+^I * value of the read system call will reflect the return value of$

ERROR: code indent should never use tabs
#464: FILE: tools/virtiofsd/fuse.h:445:
+^I * this operation.$

ERROR: code indent should never use tabs
#465: FILE: tools/virtiofsd/fuse.h:446:
+^I */$

ERROR: code indent should never use tabs #466: FILE: tools/virtiofsd/fuse.h:447:
+^Iint (*read) (const char *, char *, size_t, off_t,$

ERROR: code indent should never use tabs
#467: FILE: tools/virtiofsd/fuse.h:448:
+^I^I struct fuse_file_info *);$

ERROR: code indent should never use tabs
#469: FILE: tools/virtiofsd/fuse.h:450:
+^I/** Write data to an open file$

WARNING: Block comments use a leading /* on a separate line #469: FILE: tools/virtiofsd/fuse.h:450:
+ /** Write data to an open file

ERROR: code indent should never use tabs
#470: FILE: tools/virtiofsd/fuse.h:451:
+^I *$

ERROR: code indent should never use tabs
#471: FILE: tools/virtiofsd/fuse.h:452:
+^I * Write should return exactly the number of bytes requested$

ERROR: code indent should never use tabs
#472: FILE: tools/virtiofsd/fuse.h:453:
+^I * except on error.^I An exception to this is when the 'direct_io'$

ERROR: code indent should never use tabs #473: FILE: tools/virtiofsd/fuse.h:454:
+^I * mount option is specified (see read operation).$

ERROR: code indent should never use tabs
#474: FILE: tools/virtiofsd/fuse.h:455:
+^I *$

ERROR: code indent should never use tabs
#475: FILE: tools/virtiofsd/fuse.h:456:
+^I * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is$

ERROR: code indent should never use tabs #476: FILE: tools/virtiofsd/fuse.h:457:
+^I * expected to reset the setuid and setgid bits.$

ERROR: code indent should never use tabs
#477: FILE: tools/virtiofsd/fuse.h:458:
+^I */$

ERROR: code indent should never use tabs
#478: FILE: tools/virtiofsd/fuse.h:459:
+^Iint (*write) (const char *, const char *, size_t, off_t,$

ERROR: code indent should never use tabs
#479: FILE: tools/virtiofsd/fuse.h:460:
+^I^I struct fuse_file_info *);$

ERROR: code indent should never use tabs
#481: FILE: tools/virtiofsd/fuse.h:462:
+^I/** Get file system statistics$

WARNING: Block comments use a leading /* on a separate line #481: FILE: tools/virtiofsd/fuse.h:462:
+ /** Get file system statistics

ERROR: code indent should never use tabs
#482: FILE: tools/virtiofsd/fuse.h:463:
+^I *$

ERROR: code indent should never use tabs
#483: FILE: tools/virtiofsd/fuse.h:464:
+^I * The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored$

ERROR: code indent should never use tabs
#484: FILE: tools/virtiofsd/fuse.h:465:
+^I */$

ERROR: code indent should never use tabs #485: FILE: tools/virtiofsd/fuse.h:466:
+^Iint (*statfs) (const char *, struct statvfs *);$

ERROR: code indent should never use tabs
#487: FILE: tools/virtiofsd/fuse.h:468:
+^I/** Possibly flush cached data$

WARNING: Block comments use a leading /* on a separate line #487: FILE: tools/virtiofsd/fuse.h:468:
+ /** Possibly flush cached data

ERROR: code indent should never use tabs
#488: FILE: tools/virtiofsd/fuse.h:469:
+^I *$

ERROR: code indent should never use tabs
#489: FILE: tools/virtiofsd/fuse.h:470:
+^I * BIG NOTE: This is not equivalent to fsync(). It's not a$

ERROR: code indent should never use tabs
#490: FILE: tools/virtiofsd/fuse.h:471:
+^I * request to sync dirty data.$

ERROR: code indent should never use tabs
#491: FILE: tools/virtiofsd/fuse.h:472:
+^I *$

ERROR: code indent should never use tabs
#492: FILE: tools/virtiofsd/fuse.h:473:
+^I * Flush is called on each close() of a file descriptor, as opposed to$

ERROR: code indent should never use tabs
#493: FILE: tools/virtiofsd/fuse.h:474:
+^I * release which is called on the close of the last file descriptor for$

ERROR: trailing whitespace
#494: FILE: tools/virtiofsd/fuse.h:475:
+^I * a file. Under Linux, errors returned by flush() will be passed to $

ERROR: code indent should never use tabs
#494: FILE: tools/virtiofsd/fuse.h:475:
+^I * a file. Under Linux, errors returned by flush() will be passed to $

ERROR: code indent should never use tabs
#495: FILE: tools/virtiofsd/fuse.h:476:
+^I * userspace as errors from close(), so flush() is a good place to write$

ERROR: trailing whitespace
#496: FILE: tools/virtiofsd/fuse.h:477:
+^I * back any cached dirty data. However, many applications ignore errors $

ERROR: code indent should never use tabs
#496: FILE: tools/virtiofsd/fuse.h:477:
+^I * back any cached dirty data. However, many applications ignore errors $

WARNING: line over 80 characters
#497: FILE: tools/virtiofsd/fuse.h:478:
+ * on close(), and on non-Linux systems, close() may succeed even if flush()

ERROR: code indent should never use tabs
#497: FILE: tools/virtiofsd/fuse.h:478:
+^I * on close(), and on non-Linux systems, close() may succeed even if flush()$

ERROR: code indent should never use tabs
#498: FILE: tools/virtiofsd/fuse.h:479:
+^I * returns an error. For these reasons, filesystems should not assume$

ERROR: code indent should never use tabs
#499: FILE: tools/virtiofsd/fuse.h:480:
+^I * that errors returned by flush will ever be noticed or even$

ERROR: code indent should never use tabs
#500: FILE: tools/virtiofsd/fuse.h:481:
+^I * delivered.$

ERROR: code indent should never use tabs
#501: FILE: tools/virtiofsd/fuse.h:482:
+^I *$

ERROR: code indent should never use tabs
#502: FILE: tools/virtiofsd/fuse.h:483:
+^I * NOTE: The flush() method may be called more than once for each$

ERROR: code indent should never use tabs
#503: FILE: tools/virtiofsd/fuse.h:484:
+^I * open(). This happens if more than one file descriptor refers to an$

ERROR: code indent should never use tabs
#504: FILE: tools/virtiofsd/fuse.h:485:
+^I * open file handle, e.g. due to dup(), dup2() or fork() calls. It is$

ERROR: code indent should never use tabs
#505: FILE: tools/virtiofsd/fuse.h:486:
+^I * not possible to determine if a flush is final, so each flush should$

ERROR: code indent should never use tabs
#506: FILE: tools/virtiofsd/fuse.h:487:
+^I * be treated equally. Multiple write-flush sequences are relatively$

ERROR: code indent should never use tabs
#507: FILE: tools/virtiofsd/fuse.h:488:
+^I * rare, so this shouldn't be a problem.$

ERROR: code indent should never use tabs
#508: FILE: tools/virtiofsd/fuse.h:489:
+^I *$

ERROR: code indent should never use tabs
#509: FILE: tools/virtiofsd/fuse.h:490:
+^I * Filesystems shouldn't assume that flush will be called at any$

ERROR: code indent should never use tabs
#510: FILE: tools/virtiofsd/fuse.h:491:
+^I * particular point. It may be called more times than expected, or not$

ERROR: code indent should never use tabs
#511: FILE: tools/virtiofsd/fuse.h:492:
+^I * at all.$

ERROR: code indent should never use tabs
#512: FILE: tools/virtiofsd/fuse.h:493:
+^I *$

WARNING: line over 80 characters
#513: FILE: tools/virtiofsd/fuse.h:494:
+ * [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html

ERROR: code indent should never use tabs
#513: FILE: tools/virtiofsd/fuse.h:494:
+^I * [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html$

ERROR: code indent should never use tabs
#514: FILE: tools/virtiofsd/fuse.h:495:
+^I */$

ERROR: code indent should never use tabs
#515: FILE: tools/virtiofsd/fuse.h:496:
+^Iint (*flush) (const char *, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#517: FILE: tools/virtiofsd/fuse.h:498:
+^I/** Release an open file$

WARNING: Block comments use a leading /* on a separate line #517: FILE: tools/virtiofsd/fuse.h:498:
+ /** Release an open file

ERROR: code indent should never use tabs
#518: FILE: tools/virtiofsd/fuse.h:499:
+^I *$

ERROR: code indent should never use tabs
#519: FILE: tools/virtiofsd/fuse.h:500:
+^I * Release is called when there are no more references to an open$

ERROR: code indent should never use tabs
#520: FILE: tools/virtiofsd/fuse.h:501:
+^I * file: all file descriptors are closed and all memory mappings$

ERROR: code indent should never use tabs
#521: FILE: tools/virtiofsd/fuse.h:502:
+^I * are unmapped.$

ERROR: code indent should never use tabs
#522: FILE: tools/virtiofsd/fuse.h:503:
+^I *$

ERROR: code indent should never use tabs
#523: FILE: tools/virtiofsd/fuse.h:504:
+^I * For every open() call there will be exactly one release() call$

ERROR: code indent should never use tabs
#524: FILE: tools/virtiofsd/fuse.h:505:
+^I * with the same flags and file handle. It is possible to$

ERROR: code indent should never use tabs
#525: FILE: tools/virtiofsd/fuse.h:506:
+^I * have a file opened more than once, in which case only the last$

ERROR: code indent should never use tabs
#526: FILE: tools/virtiofsd/fuse.h:507:
+^I * release will mean, that no more reads/writes will happen on the$

ERROR: code indent should never use tabs #527: FILE: tools/virtiofsd/fuse.h:508:
+^I * file. The return value of release is ignored.$

ERROR: code indent should never use tabs
#528: FILE: tools/virtiofsd/fuse.h:509:
+^I */$

ERROR: code indent should never use tabs
#529: FILE: tools/virtiofsd/fuse.h:510:
+^Iint (*release) (const char *, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#531: FILE: tools/virtiofsd/fuse.h:512:
+^I/** Synchronize file contents$

WARNING: Block comments use a leading /* on a separate line #531: FILE: tools/virtiofsd/fuse.h:512:
+ /** Synchronize file contents

ERROR: code indent should never use tabs
#532: FILE: tools/virtiofsd/fuse.h:513:
+^I *$

ERROR: code indent should never use tabs
#533: FILE: tools/virtiofsd/fuse.h:514:
+^I * If the datasync parameter is non-zero, then only the user data$

ERROR: code indent should never use tabs
#534: FILE: tools/virtiofsd/fuse.h:515:
+^I * should be flushed, not the meta data.$

ERROR: code indent should never use tabs
#535: FILE: tools/virtiofsd/fuse.h:516:
+^I */$

ERROR: code indent should never use tabs
#536: FILE: tools/virtiofsd/fuse.h:517:
+^Iint (*fsync) (const char *, int, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#538: FILE: tools/virtiofsd/fuse.h:519:
+^I/** Set extended attributes */$

ERROR: code indent should never use tabs
#539: FILE: tools/virtiofsd/fuse.h:520:
+^Iint (*setxattr) (const char *, const char *, const char *, size_t, int);$

ERROR: code indent should never use tabs
#541: FILE: tools/virtiofsd/fuse.h:522:
+^I/** Get extended attributes */$

ERROR: code indent should never use tabs
#542: FILE: tools/virtiofsd/fuse.h:523:
+^Iint (*getxattr) (const char *, const char *, char *, size_t);$

ERROR: code indent should never use tabs
#544: FILE: tools/virtiofsd/fuse.h:525:
+^I/** List extended attributes */$

ERROR: code indent should never use tabs #545: FILE: tools/virtiofsd/fuse.h:526:
+^Iint (*listxattr) (const char *, char *, size_t);$

ERROR: code indent should never use tabs
#547: FILE: tools/virtiofsd/fuse.h:528:
+^I/** Remove extended attributes */$

ERROR: code indent should never use tabs #548: FILE: tools/virtiofsd/fuse.h:529:
+^Iint (*removexattr) (const char *, const char *);$

ERROR: code indent should never use tabs
#550: FILE: tools/virtiofsd/fuse.h:531:
+^I/** Open directory$

WARNING: Block comments use a leading /* on a separate line #550: FILE: tools/virtiofsd/fuse.h:531:
+ /** Open directory

ERROR: code indent should never use tabs
#551: FILE: tools/virtiofsd/fuse.h:532:
+^I *$

ERROR: code indent should never use tabs
#552: FILE: tools/virtiofsd/fuse.h:533:
+^I * Unless the 'default_permissions' mount option is given,$

ERROR: code indent should never use tabs
#553: FILE: tools/virtiofsd/fuse.h:534:
+^I * this method should check if opendir is permitted for this$

ERROR: code indent should never use tabs
#554: FILE: tools/virtiofsd/fuse.h:535:
+^I * directory. Optionally opendir may also return an arbitrary$

ERROR: code indent should never use tabs
#555: FILE: tools/virtiofsd/fuse.h:536:
+^I * filehandle in the fuse_file_info structure, which will be$

ERROR: code indent should never use tabs #556: FILE: tools/virtiofsd/fuse.h:537:
+^I * passed to readdir, releasedir and fsyncdir.$

ERROR: code indent should never use tabs
#557: FILE: tools/virtiofsd/fuse.h:538:
+^I */$

ERROR: code indent should never use tabs
#558: FILE: tools/virtiofsd/fuse.h:539:
+^Iint (*opendir) (const char *, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#560: FILE: tools/virtiofsd/fuse.h:541:
+^I/** Read directory$

WARNING: Block comments use a leading /* on a separate line #560: FILE: tools/virtiofsd/fuse.h:541:
+ /** Read directory

ERROR: code indent should never use tabs
#561: FILE: tools/virtiofsd/fuse.h:542:
+^I *$

ERROR: code indent should never use tabs
#562: FILE: tools/virtiofsd/fuse.h:543:
+^I * The filesystem may choose between two modes of operation:$

ERROR: code indent should never use tabs
#563: FILE: tools/virtiofsd/fuse.h:544:
+^I *$

ERROR: code indent should never use tabs
#564: FILE: tools/virtiofsd/fuse.h:545:
+^I * 1) The readdir implementation ignores the offset parameter, and$

ERROR: code indent should never use tabs
#565: FILE: tools/virtiofsd/fuse.h:546:
+^I * passes zero to the filler function's offset. The filler$

ERROR: code indent should never use tabs
#566: FILE: tools/virtiofsd/fuse.h:547:
+^I * function will not return '1' (unless an error happens), so the$

ERROR: code indent should never use tabs
#567: FILE: tools/virtiofsd/fuse.h:548:
+^I * whole directory is read in a single readdir operation.$

ERROR: code indent should never use tabs
#568: FILE: tools/virtiofsd/fuse.h:549:
+^I *$

ERROR: code indent should never use tabs
#569: FILE: tools/virtiofsd/fuse.h:550:
+^I * 2) The readdir implementation keeps track of the offsets of the$

ERROR: code indent should never use tabs
#570: FILE: tools/virtiofsd/fuse.h:551:
+^I * directory entries. It uses the offset parameter and always$

ERROR: code indent should never use tabs
#571: FILE: tools/virtiofsd/fuse.h:552:
+^I * passes non-zero offset to the filler function. When the buffer$

ERROR: code indent should never use tabs
#572: FILE: tools/virtiofsd/fuse.h:553:
+^I * is full (or an error happens) the filler function will return$

ERROR: code indent should never use tabs
#573: FILE: tools/virtiofsd/fuse.h:554:
+^I * '1'.$

ERROR: code indent should never use tabs
#574: FILE: tools/virtiofsd/fuse.h:555:
+^I */$

ERROR: code indent should never use tabs
#575: FILE: tools/virtiofsd/fuse.h:556:
+^Iint (*readdir) (const char *, void *, fuse_fill_dir_t, off_t,$

ERROR: code indent should never use tabs
#576: FILE: tools/virtiofsd/fuse.h:557:
+^I^I^Istruct fuse_file_info *, enum fuse_readdir_flags);$

ERROR: code indent should never use tabs
#578: FILE: tools/virtiofsd/fuse.h:559:
+^I/** Release directory$

WARNING: Block comments use a leading /* on a separate line #578: FILE: tools/virtiofsd/fuse.h:559:
+ /** Release directory

ERROR: code indent should never use tabs
#579: FILE: tools/virtiofsd/fuse.h:560:
+^I */$

ERROR: code indent should never use tabs
#580: FILE: tools/virtiofsd/fuse.h:561:
+^Iint (*releasedir) (const char *, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#582: FILE: tools/virtiofsd/fuse.h:563:
+^I/** Synchronize directory contents$

WARNING: Block comments use a leading /* on a separate line #582: FILE: tools/virtiofsd/fuse.h:563:
+ /** Synchronize directory contents

ERROR: code indent should never use tabs
#583: FILE: tools/virtiofsd/fuse.h:564:
+^I *$

ERROR: code indent should never use tabs
#584: FILE: tools/virtiofsd/fuse.h:565:
+^I * If the datasync parameter is non-zero, then only the user data$

ERROR: code indent should never use tabs
#585: FILE: tools/virtiofsd/fuse.h:566:
+^I * should be flushed, not the meta data$

ERROR: code indent should never use tabs
#586: FILE: tools/virtiofsd/fuse.h:567:
+^I */$

ERROR: code indent should never use tabs
#587: FILE: tools/virtiofsd/fuse.h:568:
+^Iint (*fsyncdir) (const char *, int, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#589: FILE: tools/virtiofsd/fuse.h:570:
+^I/**$

ERROR: code indent should never use tabs
#590: FILE: tools/virtiofsd/fuse.h:571:
+^I * Initialize filesystem$

ERROR: code indent should never use tabs
#591: FILE: tools/virtiofsd/fuse.h:572:
+^I *$

ERROR: code indent should never use tabs
#592: FILE: tools/virtiofsd/fuse.h:573:
+^I * The return value will passed in the private_data field of$

ERROR: code indent should never use tabs
#593: FILE: tools/virtiofsd/fuse.h:574:
+^I * struct fuse_context to all file operations, and as a$

ERROR: code indent should never use tabs
#594: FILE: tools/virtiofsd/fuse.h:575:
+^I * parameter to the destroy() method. It overrides the initial$

ERROR: code indent should never use tabs #595: FILE: tools/virtiofsd/fuse.h:576:
+^I * value provided to fuse_main() / fuse_new().$

ERROR: code indent should never use tabs
#596: FILE: tools/virtiofsd/fuse.h:577:
+^I */$

ERROR: code indent should never use tabs
#597: FILE: tools/virtiofsd/fuse.h:578:
+^Ivoid *(*init) (struct fuse_conn_info *conn,$

ERROR: code indent should never use tabs
#598: FILE: tools/virtiofsd/fuse.h:579:
+^I^I struct fuse_config *cfg);$

ERROR: code indent should never use tabs
#600: FILE: tools/virtiofsd/fuse.h:581:
+^I/**$

ERROR: code indent should never use tabs
#601: FILE: tools/virtiofsd/fuse.h:582:
+^I * Clean up filesystem$

ERROR: code indent should never use tabs
#602: FILE: tools/virtiofsd/fuse.h:583:
+^I *$

ERROR: code indent should never use tabs
#603: FILE: tools/virtiofsd/fuse.h:584:
+^I * Called on filesystem exit.$

ERROR: code indent should never use tabs
#604: FILE: tools/virtiofsd/fuse.h:585:
+^I */$

ERROR: code indent should never use tabs
#605: FILE: tools/virtiofsd/fuse.h:586:
+^Ivoid (*destroy) (void *private_data);$

ERROR: code indent should never use tabs
#607: FILE: tools/virtiofsd/fuse.h:588:
+^I/**$

ERROR: code indent should never use tabs
#608: FILE: tools/virtiofsd/fuse.h:589:
+^I * Check file access permissions$

ERROR: code indent should never use tabs
#609: FILE: tools/virtiofsd/fuse.h:590:
+^I *$

ERROR: code indent should never use tabs
#610: FILE: tools/virtiofsd/fuse.h:591:
+^I * This will be called for the access() system call. If the$

ERROR: code indent should never use tabs
#611: FILE: tools/virtiofsd/fuse.h:592:
+^I * 'default_permissions' mount option is given, this method is not$

ERROR: code indent should never use tabs
#612: FILE: tools/virtiofsd/fuse.h:593:
+^I * called.$

ERROR: code indent should never use tabs
#613: FILE: tools/virtiofsd/fuse.h:594:
+^I *$

ERROR: code indent should never use tabs
#614: FILE: tools/virtiofsd/fuse.h:595:
+^I * This method is not called under Linux kernel versions 2.4.x$

ERROR: code indent should never use tabs
#615: FILE: tools/virtiofsd/fuse.h:596:
+^I */$

ERROR: code indent should never use tabs
#616: FILE: tools/virtiofsd/fuse.h:597:
+^Iint (*access) (const char *, int);$

ERROR: code indent should never use tabs
#618: FILE: tools/virtiofsd/fuse.h:599:
+^I/**$

ERROR: code indent should never use tabs
#619: FILE: tools/virtiofsd/fuse.h:600:
+^I * Create and open a file$

ERROR: code indent should never use tabs
#620: FILE: tools/virtiofsd/fuse.h:601:
+^I *$

ERROR: code indent should never use tabs
#621: FILE: tools/virtiofsd/fuse.h:602:
+^I * If the file does not exist, first create it with the specified$

ERROR: code indent should never use tabs
#622: FILE: tools/virtiofsd/fuse.h:603:
+^I * mode, and then open it.$

ERROR: code indent should never use tabs
#623: FILE: tools/virtiofsd/fuse.h:604:
+^I *$

ERROR: code indent should never use tabs
#624: FILE: tools/virtiofsd/fuse.h:605:
+^I * If this method is not implemented or under Linux kernel$

ERROR: code indent should never use tabs
#625: FILE: tools/virtiofsd/fuse.h:606:
+^I * versions earlier than 2.6.15, the mknod() and open() methods$

ERROR: code indent should never use tabs
#626: FILE: tools/virtiofsd/fuse.h:607:
+^I * will be called instead.$

ERROR: code indent should never use tabs
#627: FILE: tools/virtiofsd/fuse.h:608:
+^I */$

ERROR: code indent should never use tabs
#628: FILE: tools/virtiofsd/fuse.h:609:
+^Iint (*create) (const char *, mode_t, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#630: FILE: tools/virtiofsd/fuse.h:611:
+^I/**$

ERROR: code indent should never use tabs
#631: FILE: tools/virtiofsd/fuse.h:612:
+^I * Perform POSIX file locking operation$

ERROR: code indent should never use tabs
#632: FILE: tools/virtiofsd/fuse.h:613:
+^I *$

ERROR: code indent should never use tabs
#633: FILE: tools/virtiofsd/fuse.h:614:
+^I * The cmd argument will be either F_GETLK, F_SETLK or F_SETLKW.$

ERROR: code indent should never use tabs
#634: FILE: tools/virtiofsd/fuse.h:615:
+^I *$

ERROR: code indent should never use tabs
#635: FILE: tools/virtiofsd/fuse.h:616:
+^I * For the meaning of fields in 'struct flock' see the man page$

ERROR: code indent should never use tabs
#636: FILE: tools/virtiofsd/fuse.h:617:
+^I * for fcntl(2). The l_whence field will always be set to$

ERROR: code indent should never use tabs
#637: FILE: tools/virtiofsd/fuse.h:618:
+^I * SEEK_SET.$

ERROR: code indent should never use tabs
#638: FILE: tools/virtiofsd/fuse.h:619:
+^I *$

ERROR: code indent should never use tabs
#639: FILE: tools/virtiofsd/fuse.h:620:
+^I * For checking lock ownership, the 'fuse_file_info->owner'$

ERROR: code indent should never use tabs
#640: FILE: tools/virtiofsd/fuse.h:621:
+^I * argument must be used.$

ERROR: code indent should never use tabs
#641: FILE: tools/virtiofsd/fuse.h:622:
+^I *$

ERROR: code indent should never use tabs
#642: FILE: tools/virtiofsd/fuse.h:623:
+^I * For F_GETLK operation, the library will first check currently$

ERROR: code indent should never use tabs
#643: FILE: tools/virtiofsd/fuse.h:624:
+^I * held locks, and if a conflicting lock is found it will return$

ERROR: code indent should never use tabs
#644: FILE: tools/virtiofsd/fuse.h:625:
+^I * information without calling this method.^I This ensures, that$

ERROR: code indent should never use tabs
#645: FILE: tools/virtiofsd/fuse.h:626:
+^I * for local locks the l_pid field is correctly filled in.^IThe$

ERROR: code indent should never use tabs
#646: FILE: tools/virtiofsd/fuse.h:627:
+^I * results may not be accurate in case of race conditions and in$

ERROR: code indent should never use tabs
#647: FILE: tools/virtiofsd/fuse.h:628:
+^I * the presence of hard links, but it's unlikely that an$

ERROR: code indent should never use tabs
#648: FILE: tools/virtiofsd/fuse.h:629:
+^I * application would rely on accurate GETLK results in these$

ERROR: code indent should never use tabs
#649: FILE: tools/virtiofsd/fuse.h:630:
+^I * cases. If a conflicting lock is not found, this method will be$

ERROR: code indent should never use tabs
#650: FILE: tools/virtiofsd/fuse.h:631:
+^I * called, and the filesystem may fill out l_pid by a meaningful$

ERROR: code indent should never use tabs
#651: FILE: tools/virtiofsd/fuse.h:632:
+^I * value, or it may leave this field zero.$

ERROR: code indent should never use tabs
#652: FILE: tools/virtiofsd/fuse.h:633:
+^I *$

ERROR: code indent should never use tabs
#653: FILE: tools/virtiofsd/fuse.h:634:
+^I * For F_SETLK and F_SETLKW the l_pid field will be set to the pid$

ERROR: code indent should never use tabs
#654: FILE: tools/virtiofsd/fuse.h:635:
+^I * of the process performing the locking operation.$

ERROR: code indent should never use tabs
#655: FILE: tools/virtiofsd/fuse.h:636:
+^I *$

ERROR: code indent should never use tabs
#656: FILE: tools/virtiofsd/fuse.h:637:
+^I * Note: if this method is not implemented, the kernel will still$

ERROR: code indent should never use tabs
#657: FILE: tools/virtiofsd/fuse.h:638:
+^I * allow file locking to work locally. Hence it is only$

ERROR: code indent should never use tabs
#658: FILE: tools/virtiofsd/fuse.h:639:
+^I * interesting for network filesystems and similar.$

ERROR: code indent should never use tabs
#659: FILE: tools/virtiofsd/fuse.h:640:
+^I */$

ERROR: code indent should never use tabs
#660: FILE: tools/virtiofsd/fuse.h:641:
+^Iint (*lock) (const char *, struct fuse_file_info *, int cmd,$

ERROR: code indent should never use tabs
#661: FILE: tools/virtiofsd/fuse.h:642:
+^I^I struct flock *);$

ERROR: code indent should never use tabs
#663: FILE: tools/virtiofsd/fuse.h:644:
+^I/**$

ERROR: code indent should never use tabs
#664: FILE: tools/virtiofsd/fuse.h:645:
+^I * Change the access and modification times of a file with$

ERROR: code indent should never use tabs
#665: FILE: tools/virtiofsd/fuse.h:646:
+^I * nanosecond resolution$

ERROR: code indent should never use tabs
#666: FILE: tools/virtiofsd/fuse.h:647:
+^I *$

ERROR: code indent should never use tabs
#667: FILE: tools/virtiofsd/fuse.h:648:
+^I * This supersedes the old utime() interface. New applications$

ERROR: code indent should never use tabs
#668: FILE: tools/virtiofsd/fuse.h:649:
+^I * should use this.$

ERROR: code indent should never use tabs
#669: FILE: tools/virtiofsd/fuse.h:650:
+^I *$

ERROR: code indent should never use tabs
#670: FILE: tools/virtiofsd/fuse.h:651:
+^I * fi will always be NULL if the file is not currenlty open, but$

ERROR: code indent should never use tabs
#671: FILE: tools/virtiofsd/fuse.h:652:
+^I * may also be NULL if the file is open.$

ERROR: code indent should never use tabs
#672: FILE: tools/virtiofsd/fuse.h:653:
+^I *$

ERROR: code indent should never use tabs
#673: FILE: tools/virtiofsd/fuse.h:654:
+^I * See the utimensat(2) man page for details.$

ERROR: code indent should never use tabs
#674: FILE: tools/virtiofsd/fuse.h:655:
+^I */$

ERROR: code indent should never use tabs
#675: FILE: tools/virtiofsd/fuse.h:656:
+^I int (*utimens) (const char *, const struct timespec tv[2],$

ERROR: code indent should never use tabs
#676: FILE: tools/virtiofsd/fuse.h:657:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#678: FILE: tools/virtiofsd/fuse.h:659:
+^I/**$

ERROR: code indent should never use tabs
#679: FILE: tools/virtiofsd/fuse.h:660:
+^I * Map block index within file to block index within device$

ERROR: code indent should never use tabs
#680: FILE: tools/virtiofsd/fuse.h:661:
+^I *$

ERROR: code indent should never use tabs
#681: FILE: tools/virtiofsd/fuse.h:662:
+^I * Note: This makes sense only for block device backed filesystems$

ERROR: code indent should never use tabs
#682: FILE: tools/virtiofsd/fuse.h:663:
+^I * mounted with the 'blkdev' option$

ERROR: code indent should never use tabs
#683: FILE: tools/virtiofsd/fuse.h:664:
+^I */$

ERROR: code indent should never use tabs
#684: FILE: tools/virtiofsd/fuse.h:665:
+^Iint (*bmap) (const char *, size_t blocksize, uint64_t *idx);$

ERROR: code indent should never use tabs
#686: FILE: tools/virtiofsd/fuse.h:667:
+^I/**$

ERROR: code indent should never use tabs
#687: FILE: tools/virtiofsd/fuse.h:668:
+^I * Ioctl$

ERROR: code indent should never use tabs
#688: FILE: tools/virtiofsd/fuse.h:669:
+^I *$

ERROR: code indent should never use tabs
#689: FILE: tools/virtiofsd/fuse.h:670:
+^I * flags will have FUSE_IOCTL_COMPAT set for 32bit ioctls in$

ERROR: code indent should never use tabs
#690: FILE: tools/virtiofsd/fuse.h:671:
+^I * 64bit environment. The size and direction of data is$

ERROR: code indent should never use tabs
#691: FILE: tools/virtiofsd/fuse.h:672:
+^I * determined by _IOC_*() decoding of cmd. For _IOC_NONE,$

ERROR: code indent should never use tabs
#692: FILE: tools/virtiofsd/fuse.h:673:
+^I * data will be NULL, for _IOC_WRITE data is out area, for$

ERROR: code indent should never use tabs
#693: FILE: tools/virtiofsd/fuse.h:674:
+^I * _IOC_READ in area and if both are set in/out area. In all$

ERROR: code indent should never use tabs
#694: FILE: tools/virtiofsd/fuse.h:675:
+^I * non-NULL cases, the area is of _IOC_SIZE(cmd) bytes.$

ERROR: code indent should never use tabs
#695: FILE: tools/virtiofsd/fuse.h:676:
+^I *$

ERROR: code indent should never use tabs
#696: FILE: tools/virtiofsd/fuse.h:677:
+^I * If flags has FUSE_IOCTL_DIR then the fuse_file_info refers to a$

ERROR: code indent should never use tabs
#697: FILE: tools/virtiofsd/fuse.h:678:
+^I * directory file handle.$

ERROR: code indent should never use tabs
#698: FILE: tools/virtiofsd/fuse.h:679:
+^I *$

ERROR: code indent should never use tabs
#699: FILE: tools/virtiofsd/fuse.h:680:
+^I * Note : the unsigned long request submitted by the application$

ERROR: code indent should never use tabs
#700: FILE: tools/virtiofsd/fuse.h:681:
+^I * is truncated to 32 bits.$

ERROR: code indent should never use tabs
#701: FILE: tools/virtiofsd/fuse.h:682:
+^I */$

ERROR: code indent should never use tabs
#702: FILE: tools/virtiofsd/fuse.h:683:
+^Iint (*ioctl) (const char *, unsigned int cmd, void *arg,$

ERROR: code indent should never use tabs
#703: FILE: tools/virtiofsd/fuse.h:684:
+^I^I struct fuse_file_info *, unsigned int flags, void *data);$

ERROR: code indent should never use tabs
#705: FILE: tools/virtiofsd/fuse.h:686:
+^I/**$

ERROR: code indent should never use tabs
#706: FILE: tools/virtiofsd/fuse.h:687:
+^I * Poll for IO readiness events$

ERROR: code indent should never use tabs
#707: FILE: tools/virtiofsd/fuse.h:688:
+^I *$

ERROR: code indent should never use tabs
#708: FILE: tools/virtiofsd/fuse.h:689:
+^I * Note: If ph is non-NULL, the client should notify$

ERROR: code indent should never use tabs
#709: FILE: tools/virtiofsd/fuse.h:690:
+^I * when IO readiness events occur by calling$

ERROR: code indent should never use tabs
#710: FILE: tools/virtiofsd/fuse.h:691:
+^I * fuse_notify_poll() with the specified ph.$

ERROR: code indent should never use tabs
#711: FILE: tools/virtiofsd/fuse.h:692:
+^I *$

ERROR: code indent should never use tabs
#712: FILE: tools/virtiofsd/fuse.h:693:
+^I * Regardless of the number of times poll with a non-NULL ph$

ERROR: code indent should never use tabs
#713: FILE: tools/virtiofsd/fuse.h:694:
+^I * is received, single notification is enough to clear all.$

ERROR: code indent should never use tabs
#714: FILE: tools/virtiofsd/fuse.h:695:
+^I * Notifying more times incurs overhead but doesn't harm$

ERROR: code indent should never use tabs
#715: FILE: tools/virtiofsd/fuse.h:696:
+^I * correctness.$

ERROR: code indent should never use tabs
#716: FILE: tools/virtiofsd/fuse.h:697:
+^I *$

ERROR: code indent should never use tabs
#717: FILE: tools/virtiofsd/fuse.h:698:
+^I * The callee is responsible for destroying ph with$

ERROR: code indent should never use tabs
#718: FILE: tools/virtiofsd/fuse.h:699:
+^I * fuse_pollhandle_destroy() when no longer in use.$

ERROR: code indent should never use tabs
#719: FILE: tools/virtiofsd/fuse.h:700:
+^I */$

ERROR: code indent should never use tabs
#720: FILE: tools/virtiofsd/fuse.h:701:
+^Iint (*poll) (const char *, struct fuse_file_info *,$

ERROR: code indent should never use tabs
#721: FILE: tools/virtiofsd/fuse.h:702:
+^I^I struct fuse_pollhandle *ph, unsigned *reventsp);$

ERROR: code indent should never use tabs
#723: FILE: tools/virtiofsd/fuse.h:704:
+^I/** Write contents of buffer to an open file$

WARNING: Block comments use a leading /* on a separate line #723: FILE: tools/virtiofsd/fuse.h:704:
+ /** Write contents of buffer to an open file

ERROR: code indent should never use tabs
#724: FILE: tools/virtiofsd/fuse.h:705:
+^I *$

ERROR: code indent should never use tabs
#725: FILE: tools/virtiofsd/fuse.h:706:
+^I * Similar to the write() method, but data is supplied in a$

ERROR: code indent should never use tabs
#726: FILE: tools/virtiofsd/fuse.h:707:
+^I * generic buffer. Use fuse_buf_copy() to transfer data to$

ERROR: code indent should never use tabs
#727: FILE: tools/virtiofsd/fuse.h:708:
+^I * the destination.$

ERROR: code indent should never use tabs
#728: FILE: tools/virtiofsd/fuse.h:709:
+^I *$

ERROR: code indent should never use tabs
#729: FILE: tools/virtiofsd/fuse.h:710:
+^I * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is$

ERROR: code indent should never use tabs #730: FILE: tools/virtiofsd/fuse.h:711:
+^I * expected to reset the setuid and setgid bits.$

ERROR: code indent should never use tabs
#731: FILE: tools/virtiofsd/fuse.h:712:
+^I */$

ERROR: code indent should never use tabs
#732: FILE: tools/virtiofsd/fuse.h:713:
+^Iint (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off,$

ERROR: code indent should never use tabs
#733: FILE: tools/virtiofsd/fuse.h:714:
+^I^I^I struct fuse_file_info *);$

ERROR: code indent should never use tabs
#735: FILE: tools/virtiofsd/fuse.h:716:
+^I/** Store data from an open file in a buffer$

WARNING: Block comments use a leading /* on a separate line #735: FILE: tools/virtiofsd/fuse.h:716:
+ /** Store data from an open file in a buffer

ERROR: code indent should never use tabs
#736: FILE: tools/virtiofsd/fuse.h:717:
+^I *$

ERROR: code indent should never use tabs
#737: FILE: tools/virtiofsd/fuse.h:718:
+^I * Similar to the read() method, but data is stored and$

ERROR: code indent should never use tabs
#738: FILE: tools/virtiofsd/fuse.h:719:
+^I * returned in a generic buffer.$

ERROR: code indent should never use tabs
#739: FILE: tools/virtiofsd/fuse.h:720:
+^I *$

ERROR: code indent should never use tabs
#740: FILE: tools/virtiofsd/fuse.h:721:
+^I * No actual copying of data has to take place, the source$

ERROR: code indent should never use tabs
#741: FILE: tools/virtiofsd/fuse.h:722:
+^I * file descriptor may simply be stored in the buffer for$

ERROR: code indent should never use tabs
#742: FILE: tools/virtiofsd/fuse.h:723:
+^I * later data transfer.$

ERROR: code indent should never use tabs
#743: FILE: tools/virtiofsd/fuse.h:724:
+^I *$

ERROR: code indent should never use tabs
#744: FILE: tools/virtiofsd/fuse.h:725:
+^I * The buffer must be allocated dynamically and stored at the$

ERROR: code indent should never use tabs
#745: FILE: tools/virtiofsd/fuse.h:726:
+^I * location pointed to by bufp. If the buffer contains memory$

ERROR: code indent should never use tabs
#746: FILE: tools/virtiofsd/fuse.h:727:
+^I * regions, they too must be allocated using malloc(). The$

ERROR: code indent should never use tabs #747: FILE: tools/virtiofsd/fuse.h:728:
+^I * allocated memory will be freed by the caller.$

ERROR: code indent should never use tabs
#748: FILE: tools/virtiofsd/fuse.h:729:
+^I */$

ERROR: code indent should never use tabs
#749: FILE: tools/virtiofsd/fuse.h:730:
+^Iint (*read_buf) (const char *, struct fuse_bufvec **bufp,$

ERROR: code indent should never use tabs
#750: FILE: tools/virtiofsd/fuse.h:731:
+^I^I^I size_t size, off_t off, struct fuse_file_info *);$

ERROR: code indent should never use tabs
#751: FILE: tools/virtiofsd/fuse.h:732:
+^I/**$

ERROR: code indent should never use tabs
#752: FILE: tools/virtiofsd/fuse.h:733:
+^I * Perform BSD file locking operation$

ERROR: code indent should never use tabs
#753: FILE: tools/virtiofsd/fuse.h:734:
+^I *$

ERROR: code indent should never use tabs
#754: FILE: tools/virtiofsd/fuse.h:735:
+^I * The op argument will be either LOCK_SH, LOCK_EX or LOCK_UN$

ERROR: code indent should never use tabs
#755: FILE: tools/virtiofsd/fuse.h:736:
+^I *$

ERROR: code indent should never use tabs
#756: FILE: tools/virtiofsd/fuse.h:737:
+^I * Nonblocking requests will be indicated by ORing LOCK_NB to$

ERROR: code indent should never use tabs
#757: FILE: tools/virtiofsd/fuse.h:738:
+^I * the above operations$

ERROR: code indent should never use tabs
#758: FILE: tools/virtiofsd/fuse.h:739:
+^I *$

ERROR: code indent should never use tabs
#759: FILE: tools/virtiofsd/fuse.h:740:
+^I * For more information see the flock(2) manual page.$

ERROR: code indent should never use tabs
#760: FILE: tools/virtiofsd/fuse.h:741:
+^I *$

ERROR: code indent should never use tabs
#761: FILE: tools/virtiofsd/fuse.h:742:
+^I * Additionally fi->owner will be set to a value unique to$

ERROR: code indent should never use tabs
#762: FILE: tools/virtiofsd/fuse.h:743:
+^I * this open file. This same value will be supplied to$

ERROR: code indent should never use tabs
#763: FILE: tools/virtiofsd/fuse.h:744:
+^I * ->release() when the file is released.$

ERROR: code indent should never use tabs
#764: FILE: tools/virtiofsd/fuse.h:745:
+^I *$

ERROR: code indent should never use tabs
#765: FILE: tools/virtiofsd/fuse.h:746:
+^I * Note: if this method is not implemented, the kernel will still$

ERROR: code indent should never use tabs
#766: FILE: tools/virtiofsd/fuse.h:747:
+^I * allow file locking to work locally. Hence it is only$

ERROR: code indent should never use tabs
#767: FILE: tools/virtiofsd/fuse.h:748:
+^I * interesting for network filesystems and similar.$

ERROR: code indent should never use tabs
#768: FILE: tools/virtiofsd/fuse.h:749:
+^I */$

ERROR: code indent should never use tabs
#769: FILE: tools/virtiofsd/fuse.h:750:
+^Iint (*flock) (const char *, struct fuse_file_info *, int op);$

ERROR: code indent should never use tabs
#771: FILE: tools/virtiofsd/fuse.h:752:
+^I/**$

ERROR: code indent should never use tabs
#772: FILE: tools/virtiofsd/fuse.h:753:
+^I * Allocates space for an open file$

ERROR: code indent should never use tabs
#773: FILE: tools/virtiofsd/fuse.h:754:
+^I *$

ERROR: code indent should never use tabs
#774: FILE: tools/virtiofsd/fuse.h:755:
+^I * This function ensures that required space is allocated for specified$

ERROR: code indent should never use tabs
#775: FILE: tools/virtiofsd/fuse.h:756:
+^I * file. If this function returns success then any subsequent write$

ERROR: code indent should never use tabs
#776: FILE: tools/virtiofsd/fuse.h:757:
+^I * request to specified range is guaranteed not to fail because of lack$

ERROR: code indent should never use tabs
#777: FILE: tools/virtiofsd/fuse.h:758:
+^I * of space on the file system media.$

ERROR: code indent should never use tabs
#778: FILE: tools/virtiofsd/fuse.h:759:
+^I */$

ERROR: code indent should never use tabs #779: FILE: tools/virtiofsd/fuse.h:760:
+^Iint (*fallocate) (const char *, int, off_t, off_t,$

ERROR: code indent should never use tabs
#780: FILE: tools/virtiofsd/fuse.h:761:
+^I^I^I struct fuse_file_info *);$

ERROR: code indent should never use tabs
#782: FILE: tools/virtiofsd/fuse.h:763:
+^I/**$

ERROR: code indent should never use tabs #783: FILE: tools/virtiofsd/fuse.h:764:
+^I * Copy a range of data from one file to another$

ERROR: code indent should never use tabs
#784: FILE: tools/virtiofsd/fuse.h:765:
+^I *$

ERROR: code indent should never use tabs
#785: FILE: tools/virtiofsd/fuse.h:766:
+^I * Performs an optimized copy between two file descriptors without the$

ERROR: code indent should never use tabs
#786: FILE: tools/virtiofsd/fuse.h:767:
+^I * additional cost of transferring data through the FUSE kernel module$

ERROR: code indent should never use tabs
#787: FILE: tools/virtiofsd/fuse.h:768:
+^I * to user space (glibc) and then back into the FUSE filesystem again.$

ERROR: code indent should never use tabs
#788: FILE: tools/virtiofsd/fuse.h:769:
+^I *$

ERROR: code indent should never use tabs
#789: FILE: tools/virtiofsd/fuse.h:770:
+^I * In case this method is not implemented, glibc falls back to reading$

ERROR: code indent should never use tabs
#790: FILE: tools/virtiofsd/fuse.h:771:
+^I * data from the source and writing to the destination. Effectively$

ERROR: code indent should never use tabs
#791: FILE: tools/virtiofsd/fuse.h:772:
+^I * doing an inefficient copy of the data.$

ERROR: code indent should never use tabs
#792: FILE: tools/virtiofsd/fuse.h:773:
+^I */$

ERROR: code indent should never use tabs #793: FILE: tools/virtiofsd/fuse.h:774:
+^Issize_t (*copy_file_range) (const char *path_in,$

ERROR: code indent should never use tabs
#794: FILE: tools/virtiofsd/fuse.h:775:
+^I^I^I^I struct fuse_file_info *fi_in,$

ERROR: code indent should never use tabs
#795: FILE: tools/virtiofsd/fuse.h:776:
+^I^I^I^I off_t offset_in, const char *path_out,$

ERROR: code indent should never use tabs
#796: FILE: tools/virtiofsd/fuse.h:777:
+^I^I^I^I struct fuse_file_info *fi_out,$

ERROR: code indent should never use tabs
#797: FILE: tools/virtiofsd/fuse.h:778:
+^I^I^I^I off_t offset_out, size_t size, int flags);$

ERROR: code indent should never use tabs
#799: FILE: tools/virtiofsd/fuse.h:780:
+^I/**$

ERROR: code indent should never use tabs
#800: FILE: tools/virtiofsd/fuse.h:781:
+^I * Find next data or hole after the specified offset$

ERROR: code indent should never use tabs
#801: FILE: tools/virtiofsd/fuse.h:782:
+^I */$

WARNING: line over 80 characters
#802: FILE: tools/virtiofsd/fuse.h:783:
+ off_t (*lseek) (const char *, off_t off, int whence, struct fuse_file_info *);

ERROR: code indent should never use tabs
#802: FILE: tools/virtiofsd/fuse.h:783:
+^Ioff_t (*lseek) (const char *, off_t off, int whence, struct fuse_file_info *);$

WARNING: Block comments use a leading /* on a separate line #805: FILE: tools/virtiofsd/fuse.h:786:
+/** Extra context that may be needed by some filesystems

ERROR: code indent should never use tabs
#811: FILE: tools/virtiofsd/fuse.h:792:
+^I/** Pointer to the fuse object */$

ERROR: code indent should never use tabs
#812: FILE: tools/virtiofsd/fuse.h:793:
+^Istruct fuse *fuse;$

ERROR: code indent should never use tabs
#814: FILE: tools/virtiofsd/fuse.h:795:
+^I/** User ID of the calling process */$

ERROR: code indent should never use tabs
#815: FILE: tools/virtiofsd/fuse.h:796:
+^Iuid_t uid;$

ERROR: code indent should never use tabs
#817: FILE: tools/virtiofsd/fuse.h:798:
+^I/** Group ID of the calling process */$

ERROR: code indent should never use tabs
#818: FILE: tools/virtiofsd/fuse.h:799:
+^Igid_t gid;$

ERROR: code indent should never use tabs
#820: FILE: tools/virtiofsd/fuse.h:801:
+^I/** Process ID of the calling thread */$

ERROR: code indent should never use tabs
#821: FILE: tools/virtiofsd/fuse.h:802:
+^Ipid_t pid;$

ERROR: code indent should never use tabs
#823: FILE: tools/virtiofsd/fuse.h:804:
+^I/** Private filesystem data */$

ERROR: code indent should never use tabs
#824: FILE: tools/virtiofsd/fuse.h:805:
+^Ivoid *private_data;$

ERROR: code indent should never use tabs
#826: FILE: tools/virtiofsd/fuse.h:807:
+^I/** Umask of the calling process */$

ERROR: code indent should never use tabs
#827: FILE: tools/virtiofsd/fuse.h:808:
+^Imode_t umask;$

WARNING: Block comments use * on subsequent lines
#885: FILE: tools/virtiofsd/fuse.h:866:
+/*
+ int fuse_main(int argc, char *argv[], const struct fuse_operations *op,

ERROR: code indent should never use tabs
#888: FILE: tools/virtiofsd/fuse.h:869:
+#define fuse_main(argc, argv, op, private_data)^I^I^I^I\$

ERROR: code indent should never use tabs
#889: FILE: tools/virtiofsd/fuse.h:870:
+^Ifuse_main_real(argc, argv, op, sizeof(*(op)), private_data)$

WARNING: Block comments use a leading /* on a separate line #891: FILE: tools/virtiofsd/fuse.h:872:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#892: FILE: tools/virtiofsd/fuse.h:873:
+ * More detailed API^I^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #893: FILE: tools/virtiofsd/fuse.h:874:
+ * ----------------------------------------------------------- */

WARNING: line over 80 characters
#936: FILE: tools/virtiofsd/fuse.h:917:
+struct fuse *fuse_new_30(struct fuse_args *args, const struct fuse_operations *op,

ERROR: code indent should never use tabs
#937: FILE: tools/virtiofsd/fuse.h:918:
+^I^I^I size_t op_size, void *private_data);$

ERROR: code indent should never use tabs
#941: FILE: tools/virtiofsd/fuse.h:922:
+^I^I size_t op_size, void *private_data);$

ERROR: code indent should never use tabs
#966: FILE: tools/virtiofsd/fuse.h:947:
+ * NOTE: This function does not unmount the filesystem.^I If this is$

ERROR: code indent should never use tabs
#1094: FILE: tools/virtiofsd/fuse.h:1075:
+^I^I size_t op_size, void *private_data);$

ERROR: code indent should never use tabs
#1145: FILE: tools/virtiofsd/fuse.h:1126:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1147: FILE: tools/virtiofsd/fuse.h:1128:
+^I^I const char *newpath, unsigned int flags);$

ERROR: code indent should never use tabs
#1151: FILE: tools/virtiofsd/fuse.h:1132:
+^I^I const char *path);$

ERROR: code indent should never use tabs
#1153: FILE: tools/virtiofsd/fuse.h:1134:
+int fuse_fs_release(struct fuse_fs *fs,^I const char *path,$

ERROR: code indent should never use tabs
#1154: FILE: tools/virtiofsd/fuse.h:1135:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1156: FILE: tools/virtiofsd/fuse.h:1137:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1158: FILE: tools/virtiofsd/fuse.h:1139:
+^I^I off_t off, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1160: FILE: tools/virtiofsd/fuse.h:1141:
+^I^I struct fuse_bufvec **bufp, size_t size, off_t off,$

ERROR: code indent should never use tabs
#1161: FILE: tools/virtiofsd/fuse.h:1142:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1163: FILE: tools/virtiofsd/fuse.h:1144:
+^I^I size_t size, off_t off, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1165: FILE: tools/virtiofsd/fuse.h:1146:
+^I^I struct fuse_bufvec *buf, off_t off,$

ERROR: code indent should never use tabs
#1166: FILE: tools/virtiofsd/fuse.h:1147:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1168: FILE: tools/virtiofsd/fuse.h:1149:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1170: FILE: tools/virtiofsd/fuse.h:1151:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1173: FILE: tools/virtiofsd/fuse.h:1154:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1175: FILE: tools/virtiofsd/fuse.h:1156:
+^I^I fuse_fill_dir_t filler, off_t off,$

ERROR: code indent should never use tabs
#1176: FILE: tools/virtiofsd/fuse.h:1157:
+^I^I struct fuse_file_info *fi, enum fuse_readdir_flags flags);$

ERROR: code indent should never use tabs
#1178: FILE: tools/virtiofsd/fuse.h:1159:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1180: FILE: tools/virtiofsd/fuse.h:1161:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1182: FILE: tools/virtiofsd/fuse.h:1163:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1184: FILE: tools/virtiofsd/fuse.h:1165:
+^I^I struct fuse_file_info *fi, int cmd, struct flock *lock);$

ERROR: code indent should never use tabs
#1186: FILE: tools/virtiofsd/fuse.h:1167:
+^I^I struct fuse_file_info *fi, int op);$

ERROR: code indent should never use tabs
#1188: FILE: tools/virtiofsd/fuse.h:1169:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1190: FILE: tools/virtiofsd/fuse.h:1171:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1192: FILE: tools/virtiofsd/fuse.h:1173:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1194: FILE: tools/virtiofsd/fuse.h:1175:
+^I^I const struct timespec tv[2], struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1197: FILE: tools/virtiofsd/fuse.h:1178:
+^I^I size_t len);$

ERROR: code indent should never use tabs
#1199: FILE: tools/virtiofsd/fuse.h:1180:
+^I^I dev_t rdev);$

ERROR: code indent should never use tabs
#1202: FILE: tools/virtiofsd/fuse.h:1183:
+^I^I const char *value, size_t size, int flags);$

ERROR: code indent should never use tabs
#1204: FILE: tools/virtiofsd/fuse.h:1185:
+^I^I char *value, size_t size);$

ERROR: code indent should never use tabs
#1206: FILE: tools/virtiofsd/fuse.h:1187:
+^I^I size_t size);$

ERROR: code indent should never use tabs
#1208: FILE: tools/virtiofsd/fuse.h:1189:
+^I^I^Iconst char *name);$

ERROR: code indent should never use tabs
#1210: FILE: tools/virtiofsd/fuse.h:1191:
+^I^I uint64_t *idx);$

ERROR: code indent should never use tabs
#1212: FILE: tools/virtiofsd/fuse.h:1193:
+^I^I void *arg, struct fuse_file_info *fi, unsigned int flags,$

ERROR: code indent should never use tabs
#1213: FILE: tools/virtiofsd/fuse.h:1194:
+^I^I void *data);$

ERROR: code indent should never use tabs
#1215: FILE: tools/virtiofsd/fuse.h:1196:
+^I^I struct fuse_file_info *fi, struct fuse_pollhandle *ph,$

ERROR: code indent should never use tabs
#1216: FILE: tools/virtiofsd/fuse.h:1197:
+^I^I unsigned *reventsp);$

ERROR: code indent should never use tabs
#1218: FILE: tools/virtiofsd/fuse.h:1199:
+^I^I off_t offset, off_t length, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs #1220: FILE: tools/virtiofsd/fuse.h:1201:
+^I^I^I^Istruct fuse_file_info *fi_in, off_t off_in,$

ERROR: code indent should never use tabs
#1221: FILE: tools/virtiofsd/fuse.h:1202:
+^I^I^I^Iconst char *path_out,$

ERROR: code indent should never use tabs #1222: FILE: tools/virtiofsd/fuse.h:1203:
+^I^I^I^Istruct fuse_file_info *fi_out, off_t off_out,$

ERROR: code indent should never use tabs
#1223: FILE: tools/virtiofsd/fuse.h:1204:
+^I^I^I^Isize_t len, int flags);$

ERROR: code indent should never use tabs
#1225: FILE: tools/virtiofsd/fuse.h:1206:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#1227: FILE: tools/virtiofsd/fuse.h:1208:
+^I^Istruct fuse_config *cfg);$

ERROR: code indent should never use tabs
#1246: FILE: tools/virtiofsd/fuse.h:1227:
+^I^I^I void *private_data);$

ERROR: code indent should never use tabs
#1263: FILE: tools/virtiofsd/fuse.h:1244:
+^I^I^I^I^I^I struct fuse_fs *fs[]);$

ERROR: code indent should never use tabs
#1275: FILE: tools/virtiofsd/fuse.h:1256:
+^Ifuse_module_factory_t fuse_module_ ## name_ ## _factory = factory_$

WARNING: architecture specific defines should be avoided #1290: FILE: tools/virtiofsd/fuse.h:1271:
+#ifdef __cplusplus

WARNING: Block comments use a leading /* on a separate line #1301: FILE: tools/virtiofsd/fuse_common.h:1:
+/* FUSE: Filesystem in Userspace

WARNING: Block comments use * on subsequent lines #1302: FILE: tools/virtiofsd/fuse_common.h:2:
+/* FUSE: Filesystem in Userspace
+ Copyright (C) 2001-2007 Miklos Szeredi <[email protected]>

ERROR: line over 90 characters
#1311: FILE: tools/virtiofsd/fuse_common.h:11:
+#error "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."

WARNING: architecture specific defines should be avoided #1331: FILE: tools/virtiofsd/fuse_common.h:31:
+#ifdef __cplusplus

ERROR: code indent should never use tabs
#1345: FILE: tools/virtiofsd/fuse_common.h:45:
+^I/** Open flags.^I Available in open() and release() */$

ERROR: code indent should never use tabs
#1346: FILE: tools/virtiofsd/fuse_common.h:46:
+^Iint flags;$

ERROR: code indent should never use tabs
#1348: FILE: tools/virtiofsd/fuse_common.h:48:
+^I/** In case of a write operation indicates if this was caused$

WARNING: Block comments use a leading /* on a separate line #1348: FILE: tools/virtiofsd/fuse_common.h:48:
+ /** In case of a write operation indicates if this was caused

ERROR: code indent should never use tabs
#1349: FILE: tools/virtiofsd/fuse_common.h:49:
+^I by a delayed write from the page cache. If so, then the$

WARNING: Block comments use * on subsequent lines
#1349: FILE: tools/virtiofsd/fuse_common.h:49:
+ /** In case of a write operation indicates if this was caused
+ by a delayed write from the page cache. If so, then the

ERROR: code indent should never use tabs
#1350: FILE: tools/virtiofsd/fuse_common.h:50:
+^I context's pid, uid, and gid fields will not be valid, and$

ERROR: code indent should never use tabs
#1351: FILE: tools/virtiofsd/fuse_common.h:51:
+^I the *fh* value may not match the *fh* value that would$

ERROR: code indent should never use tabs
#1352: FILE: tools/virtiofsd/fuse_common.h:52:
+^I have been sent with the corresponding individual write$

ERROR: code indent should never use tabs
#1353: FILE: tools/virtiofsd/fuse_common.h:53:
+^I requests if write caching had been disabled. */$

WARNING: Block comments use a trailing */ on a separate line #1353: FILE: tools/virtiofsd/fuse_common.h:53:
+ requests if write caching had been disabled. */

ERROR: code indent should never use tabs
#1354: FILE: tools/virtiofsd/fuse_common.h:54:
+^Iunsigned int writepage : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1354: FILE: tools/virtiofsd/fuse_common.h:54:

+       unsigned int writepage : 1;
                               ^

ERROR: code indent should never use tabs
#1356: FILE: tools/virtiofsd/fuse_common.h:56:
+^I/** Can be filled in by open, to use direct I/O on this file. */$

ERROR: code indent should never use tabs
#1357: FILE: tools/virtiofsd/fuse_common.h:57:
+^Iunsigned int direct_io : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1357: FILE: tools/virtiofsd/fuse_common.h:57:

+       unsigned int direct_io : 1;
                               ^

ERROR: code indent should never use tabs
#1359: FILE: tools/virtiofsd/fuse_common.h:59:
+^I/** Can be filled in by open. It signals the kernel that any$

WARNING: Block comments use a leading /* on a separate line #1359: FILE: tools/virtiofsd/fuse_common.h:59:
+ /** Can be filled in by open. It signals the kernel that any

ERROR: code indent should never use tabs
#1360: FILE: tools/virtiofsd/fuse_common.h:60:
+^I currently cached file data (ie., data that the filesystem$

WARNING: Block comments use * on subsequent lines
#1360: FILE: tools/virtiofsd/fuse_common.h:60:
+ /** Can be filled in by open. It signals the kernel that any
+ currently cached file data (ie., data that the filesystem

ERROR: code indent should never use tabs
#1361: FILE: tools/virtiofsd/fuse_common.h:61:
+^I provided the last time the file was open) need not be$

ERROR: code indent should never use tabs
#1362: FILE: tools/virtiofsd/fuse_common.h:62:
+^I invalidated. Has no effect when set in other contexts (in$

ERROR: code indent should never use tabs
#1363: FILE: tools/virtiofsd/fuse_common.h:63:
+^I particular it does nothing when set by opendir()). */$

WARNING: Block comments use a trailing */ on a separate line #1363: FILE: tools/virtiofsd/fuse_common.h:63:
+ particular it does nothing when set by opendir()). */

ERROR: code indent should never use tabs
#1364: FILE: tools/virtiofsd/fuse_common.h:64:
+^Iunsigned int keep_cache : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1364: FILE: tools/virtiofsd/fuse_common.h:64:

+       unsigned int keep_cache : 1;
                                ^

ERROR: code indent should never use tabs
#1366: FILE: tools/virtiofsd/fuse_common.h:66:
+^I/** Indicates a flush operation. Set in flush operation, also$

WARNING: Block comments use a leading /* on a separate line #1366: FILE: tools/virtiofsd/fuse_common.h:66:
+ /** Indicates a flush operation. Set in flush operation, also

ERROR: code indent should never use tabs
#1367: FILE: tools/virtiofsd/fuse_common.h:67:
+^I maybe set in highlevel lock operation and lowlevel release$

WARNING: Block comments use * on subsequent lines
#1367: FILE: tools/virtiofsd/fuse_common.h:67:
+ /** Indicates a flush operation. Set in flush operation, also
+ maybe set in highlevel lock operation and lowlevel release

ERROR: code indent should never use tabs
#1368: FILE: tools/virtiofsd/fuse_common.h:68:
+^I operation. */$

WARNING: Block comments use a trailing */ on a separate line #1368: FILE: tools/virtiofsd/fuse_common.h:68:
+ operation. */

ERROR: code indent should never use tabs
#1369: FILE: tools/virtiofsd/fuse_common.h:69:
+^Iunsigned int flush : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1369: FILE: tools/virtiofsd/fuse_common.h:69:

+       unsigned int flush : 1;
                           ^

ERROR: code indent should never use tabs
#1371: FILE: tools/virtiofsd/fuse_common.h:71:
+^I/** Can be filled in by open, to indicate that the file is not$

WARNING: Block comments use a leading /* on a separate line #1371: FILE: tools/virtiofsd/fuse_common.h:71:
+ /** Can be filled in by open, to indicate that the file is not

ERROR: code indent should never use tabs
#1372: FILE: tools/virtiofsd/fuse_common.h:72:
+^I seekable. */$

WARNING: Block comments use * on subsequent lines
#1372: FILE: tools/virtiofsd/fuse_common.h:72:
+ /** Can be filled in by open, to indicate that the file is not
+ seekable. */

WARNING: Block comments use a trailing */ on a separate line #1372: FILE: tools/virtiofsd/fuse_common.h:72:
+ seekable. */

ERROR: code indent should never use tabs
#1373: FILE: tools/virtiofsd/fuse_common.h:73:
+^Iunsigned int nonseekable : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1373: FILE: tools/virtiofsd/fuse_common.h:73:

+       unsigned int nonseekable : 1;
                                 ^

ERROR: code indent should never use tabs
#1375: FILE: tools/virtiofsd/fuse_common.h:75:
+^I/* Indicates that flock locks for this file should be$

WARNING: Block comments use a leading /* on a separate line #1375: FILE: tools/virtiofsd/fuse_common.h:75:
+ /* Indicates that flock locks for this file should be

ERROR: code indent should never use tabs
#1376: FILE: tools/virtiofsd/fuse_common.h:76:
+^I released. If set, lock_owner shall contain a valid value.$

WARNING: Block comments use * on subsequent lines
#1376: FILE: tools/virtiofsd/fuse_common.h:76:
+ /* Indicates that flock locks for this file should be
+ released. If set, lock_owner shall contain a valid value.

ERROR: code indent should never use tabs
#1377: FILE: tools/virtiofsd/fuse_common.h:77:
+^I May only be set in ->release(). */$

WARNING: Block comments use a trailing */ on a separate line #1377: FILE: tools/virtiofsd/fuse_common.h:77:
+ May only be set in ->release(). */

ERROR: code indent should never use tabs
#1378: FILE: tools/virtiofsd/fuse_common.h:78:
+^Iunsigned int flock_release : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1378: FILE: tools/virtiofsd/fuse_common.h:78:

+       unsigned int flock_release : 1;
                                   ^

ERROR: code indent should never use tabs
#1380: FILE: tools/virtiofsd/fuse_common.h:80:
+^I/** Can be filled in by opendir. It signals the kernel to$

WARNING: Block comments use a leading /* on a separate line #1380: FILE: tools/virtiofsd/fuse_common.h:80:
+ /** Can be filled in by opendir. It signals the kernel to

ERROR: code indent should never use tabs
#1381: FILE: tools/virtiofsd/fuse_common.h:81:
+^I enable caching of entries returned by readdir(). Has no$

WARNING: Block comments use * on subsequent lines
#1381: FILE: tools/virtiofsd/fuse_common.h:81:
+ /** Can be filled in by opendir. It signals the kernel to
+ enable caching of entries returned by readdir(). Has no

ERROR: code indent should never use tabs
#1382: FILE: tools/virtiofsd/fuse_common.h:82:
+^I effect when set in other contexts (in particular it does$

ERROR: code indent should never use tabs
#1383: FILE: tools/virtiofsd/fuse_common.h:83:
+^I nothing when set by open()). */$

WARNING: Block comments use a trailing */ on a separate line #1383: FILE: tools/virtiofsd/fuse_common.h:83:
+ nothing when set by open()). */

ERROR: code indent should never use tabs
#1384: FILE: tools/virtiofsd/fuse_common.h:84:
+^Iunsigned int cache_readdir : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1384: FILE: tools/virtiofsd/fuse_common.h:84:

+       unsigned int cache_readdir : 1;
                                   ^

ERROR: code indent should never use tabs
#1386: FILE: tools/virtiofsd/fuse_common.h:86:
+^I/** Padding. Reserved for future use*/$

ERROR: code indent should never use tabs
#1387: FILE: tools/virtiofsd/fuse_common.h:87:
+^Iunsigned int padding : 25;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1387: FILE: tools/virtiofsd/fuse_common.h:87:

+       unsigned int padding : 25;
                             ^

ERROR: code indent should never use tabs
#1388: FILE: tools/virtiofsd/fuse_common.h:88:
+^Iunsigned int padding2 : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #1388: FILE: tools/virtiofsd/fuse_common.h:88:

+       unsigned int padding2 : 32;
                              ^

ERROR: code indent should never use tabs
#1390: FILE: tools/virtiofsd/fuse_common.h:90:
+^I/** File handle id. May be filled in by filesystem in create,$

WARNING: Block comments use a leading /* on a separate line #1390: FILE: tools/virtiofsd/fuse_common.h:90:
+ /** File handle id. May be filled in by filesystem in create,

ERROR: code indent should never use tabs
#1391: FILE: tools/virtiofsd/fuse_common.h:91:
+^I * open, and opendir(). Available in most other file operations on the$

ERROR: code indent should never use tabs
#1392: FILE: tools/virtiofsd/fuse_common.h:92:
+^I * same file handle. */$

WARNING: Block comments use a trailing */ on a separate line #1392: FILE: tools/virtiofsd/fuse_common.h:92:
+ * same file handle. */

ERROR: code indent should never use tabs
#1393: FILE: tools/virtiofsd/fuse_common.h:93:
+^Iuint64_t fh;$

ERROR: code indent should never use tabs
#1395: FILE: tools/virtiofsd/fuse_common.h:95:
+^I/** Lock owner id. Available in locking operations and flush */$

ERROR: code indent should never use tabs
#1396: FILE: tools/virtiofsd/fuse_common.h:96:
+^Iuint64_t lock_owner;$

ERROR: code indent should never use tabs
#1398: FILE: tools/virtiofsd/fuse_common.h:98:
+^I/** Requested poll events. Available in ->poll. Only set on kernels$

WARNING: Block comments use a leading /* on a separate line #1398: FILE: tools/virtiofsd/fuse_common.h:98:
+ /** Requested poll events. Available in ->poll. Only set on kernels

ERROR: code indent should never use tabs
#1399: FILE: tools/virtiofsd/fuse_common.h:99:
+^I which support it. If unsupported, this field is set to zero. */$

WARNING: Block comments use * on subsequent lines
#1399: FILE: tools/virtiofsd/fuse_common.h:99:
+ /** Requested poll events. Available in ->poll. Only set on kernels
+ which support it. If unsupported, this field is set to zero. */

WARNING: Block comments use a trailing */ on a separate line #1399: FILE: tools/virtiofsd/fuse_common.h:99:
+ which support it. If unsupported, this field is set to zero. */

ERROR: code indent should never use tabs
#1400: FILE: tools/virtiofsd/fuse_common.h:100:
+^Iuint32_t poll_events;$

ERROR: code indent should never use tabs
#1408: FILE: tools/virtiofsd/fuse_common.h:108:
+^I/**$

ERROR: code indent should never use tabs
#1409: FILE: tools/virtiofsd/fuse_common.h:109:
+^I * whether to use separate device fds for each thread$

ERROR: code indent should never use tabs
#1410: FILE: tools/virtiofsd/fuse_common.h:110:
+^I * (may increase performance)$

ERROR: code indent should never use tabs
#1411: FILE: tools/virtiofsd/fuse_common.h:111:
+^I */$

ERROR: code indent should never use tabs
#1412: FILE: tools/virtiofsd/fuse_common.h:112:
+^Iint clone_fd;$

ERROR: code indent should never use tabs
#1414: FILE: tools/virtiofsd/fuse_common.h:114:
+^I/**$

ERROR: code indent should never use tabs
#1415: FILE: tools/virtiofsd/fuse_common.h:115:
+^I * The maximum number of available worker threads before they$

ERROR: code indent should never use tabs
#1416: FILE: tools/virtiofsd/fuse_common.h:116:
+^I * start to get deleted when they become idle. If not$

ERROR: code indent should never use tabs
#1417: FILE: tools/virtiofsd/fuse_common.h:117:
+^I * specified, the default is 10.$

ERROR: code indent should never use tabs
#1418: FILE: tools/virtiofsd/fuse_common.h:118:
+^I *$

ERROR: code indent should never use tabs
#1419: FILE: tools/virtiofsd/fuse_common.h:119:
+^I * Adjusting this has performance implications; a very small number$

ERROR: code indent should never use tabs
#1420: FILE: tools/virtiofsd/fuse_common.h:120:
+^I * of threads in the pool will cause a lot of thread creation and$

ERROR: code indent should never use tabs
#1421: FILE: tools/virtiofsd/fuse_common.h:121:
+^I * deletion overhead and performance may suffer. When set to 0, a new$

ERROR: code indent should never use tabs
#1422: FILE: tools/virtiofsd/fuse_common.h:122:
+^I * thread will be created to service every operation.$

ERROR: code indent should never use tabs
#1423: FILE: tools/virtiofsd/fuse_common.h:123:
+^I */$

ERROR: code indent should never use tabs
#1424: FILE: tools/virtiofsd/fuse_common.h:124:
+^Iunsigned int max_idle_threads;$

WARNING: Block comments use a leading /* on a separate line #1427: FILE: tools/virtiofsd/fuse_common.h:127:
+/**************************************************************************

ERROR: code indent should never use tabs
#1441: FILE: tools/virtiofsd/fuse_common.h:141:
+#define FUSE_CAP_ASYNC_READ^I^I(1 << 0)$

ERROR: code indent should never use tabs
#1449: FILE: tools/virtiofsd/fuse_common.h:149:
+#define FUSE_CAP_POSIX_LOCKS^I^I(1 << 1)$

ERROR: code indent should never use tabs
#1458: FILE: tools/virtiofsd/fuse_common.h:158:
+#define FUSE_CAP_ATOMIC_O_TRUNC^I^I(1 << 3)$

ERROR: code indent should never use tabs
#1465: FILE: tools/virtiofsd/fuse_common.h:165:
+#define FUSE_CAP_EXPORT_SUPPORT^I^I(1 << 4)$

ERROR: code indent should never use tabs
#1473: FILE: tools/virtiofsd/fuse_common.h:173:
+#define FUSE_CAP_DONT_MASK^I^I(1 << 6)$

ERROR: code indent should never use tabs
#1481: FILE: tools/virtiofsd/fuse_common.h:181:
+#define FUSE_CAP_SPLICE_WRITE^I^I(1 << 7)$

ERROR: code indent should never use tabs
#1489: FILE: tools/virtiofsd/fuse_common.h:189:
+#define FUSE_CAP_SPLICE_MOVE^I^I(1 << 8)$

ERROR: code indent should never use tabs
#1498: FILE: tools/virtiofsd/fuse_common.h:198:
+#define FUSE_CAP_SPLICE_READ^I^I(1 << 9)$

ERROR: code indent should never use tabs
#1511: FILE: tools/virtiofsd/fuse_common.h:211:
+#define FUSE_CAP_FLOCK_LOCKS^I^I(1 << 10)$

ERROR: code indent should never use tabs
#1518: FILE: tools/virtiofsd/fuse_common.h:218:
+#define FUSE_CAP_IOCTL_DIR^I^I(1 << 11)$

ERROR: code indent should never use tabs
#1540: FILE: tools/virtiofsd/fuse_common.h:240:
+#define FUSE_CAP_AUTO_INVAL_DATA^I(1 << 12)$

ERROR: code indent should never use tabs
#1548: FILE: tools/virtiofsd/fuse_common.h:248:
+#define FUSE_CAP_READDIRPLUS^I^I(1 << 13)$

ERROR: code indent should never use tabs
#1576: FILE: tools/virtiofsd/fuse_common.h:276:
+#define FUSE_CAP_READDIRPLUS_AUTO^I(1 << 14)$

ERROR: code indent should never use tabs
#1587: FILE: tools/virtiofsd/fuse_common.h:287:
+#define FUSE_CAP_ASYNC_DIO^I^I(1 << 15)$

ERROR: code indent should never use tabs
#1596: FILE: tools/virtiofsd/fuse_common.h:296:
+#define FUSE_CAP_WRITEBACK_CACHE^I(1 << 16)$

ERROR: code indent should never use tabs
#1609: FILE: tools/virtiofsd/fuse_common.h:309:
+#define FUSE_CAP_NO_OPEN_SUPPORT^I(1 << 17)$

ERROR: code indent should never use tabs
#1671: FILE: tools/virtiofsd/fuse_common.h:371:
+#define FUSE_IOCTL_COMPAT^I(1 << 0)$

ERROR: code indent should never use tabs
#1672: FILE: tools/virtiofsd/fuse_common.h:372:
+#define FUSE_IOCTL_UNRESTRICTED^I(1 << 1)$

ERROR: code indent should never use tabs
#1673: FILE: tools/virtiofsd/fuse_common.h:373:
+#define FUSE_IOCTL_RETRY^I(1 << 2)$

ERROR: code indent should never use tabs
#1674: FILE: tools/virtiofsd/fuse_common.h:374:
+#define FUSE_IOCTL_DIR^I^I(1 << 4)$

ERROR: code indent should never use tabs
#1676: FILE: tools/virtiofsd/fuse_common.h:376:
+#define FUSE_IOCTL_MAX_IOV^I256$

ERROR: code indent should never use tabs
#1686: FILE: tools/virtiofsd/fuse_common.h:386:
+^I/**$

ERROR: code indent should never use tabs
#1687: FILE: tools/virtiofsd/fuse_common.h:387:
+^I * Major version of the protocol (read-only)$

ERROR: code indent should never use tabs
#1688: FILE: tools/virtiofsd/fuse_common.h:388:
+^I */$

ERROR: code indent should never use tabs
#1689: FILE: tools/virtiofsd/fuse_common.h:389:
+^Iunsigned proto_major;$

ERROR: code indent should never use tabs
#1691: FILE: tools/virtiofsd/fuse_common.h:391:
+^I/**$

ERROR: code indent should never use tabs
#1692: FILE: tools/virtiofsd/fuse_common.h:392:
+^I * Minor version of the protocol (read-only)$

ERROR: code indent should never use tabs
#1693: FILE: tools/virtiofsd/fuse_common.h:393:
+^I */$

ERROR: code indent should never use tabs
#1694: FILE: tools/virtiofsd/fuse_common.h:394:
+^Iunsigned proto_minor;$

ERROR: code indent should never use tabs
#1696: FILE: tools/virtiofsd/fuse_common.h:396:
+^I/**$

ERROR: code indent should never use tabs
#1697: FILE: tools/virtiofsd/fuse_common.h:397:
+^I * Maximum size of the write buffer$

ERROR: code indent should never use tabs
#1698: FILE: tools/virtiofsd/fuse_common.h:398:
+^I */$

ERROR: code indent should never use tabs
#1699: FILE: tools/virtiofsd/fuse_common.h:399:
+^Iunsigned max_write;$

ERROR: code indent should never use tabs
#1701: FILE: tools/virtiofsd/fuse_common.h:401:
+^I/**$

ERROR: code indent should never use tabs
#1702: FILE: tools/virtiofsd/fuse_common.h:402:
+^I * Maximum size of read requests. A value of zero indicates no$

ERROR: code indent should never use tabs
#1703: FILE: tools/virtiofsd/fuse_common.h:403:
+^I * limit. However, even if the filesystem does not specify a$

ERROR: code indent should never use tabs
#1704: FILE: tools/virtiofsd/fuse_common.h:404:
+^I * limit, the maximum size of read requests will still be$

ERROR: code indent should never use tabs
#1705: FILE: tools/virtiofsd/fuse_common.h:405:
+^I * limited by the kernel.$

ERROR: code indent should never use tabs
#1706: FILE: tools/virtiofsd/fuse_common.h:406:
+^I *$

ERROR: code indent should never use tabs
#1707: FILE: tools/virtiofsd/fuse_common.h:407:
+^I * NOTE: For the time being, the maximum size of read requests$

ERROR: code indent should never use tabs
#1708: FILE: tools/virtiofsd/fuse_common.h:408:
+^I * must be set both here *and* passed to fuse_session_new()$

ERROR: code indent should never use tabs
#1709: FILE: tools/virtiofsd/fuse_common.h:409:
+^I * using the ``-o max_read=<n>`` mount option. At some point$

ERROR: code indent should never use tabs
#1710: FILE: tools/virtiofsd/fuse_common.h:410:
+^I * in the future, specifying the mount option will no longer$

ERROR: code indent should never use tabs
#1711: FILE: tools/virtiofsd/fuse_common.h:411:
+^I * be necessary.$

ERROR: code indent should never use tabs
#1712: FILE: tools/virtiofsd/fuse_common.h:412:
+^I */$

ERROR: code indent should never use tabs
#1713: FILE: tools/virtiofsd/fuse_common.h:413:
+^Iunsigned max_read;$

ERROR: code indent should never use tabs
#1715: FILE: tools/virtiofsd/fuse_common.h:415:
+^I/**$

ERROR: code indent should never use tabs
#1716: FILE: tools/virtiofsd/fuse_common.h:416:
+^I * Maximum readahead$

ERROR: code indent should never use tabs
#1717: FILE: tools/virtiofsd/fuse_common.h:417:
+^I */$

ERROR: code indent should never use tabs
#1718: FILE: tools/virtiofsd/fuse_common.h:418:
+^Iunsigned max_readahead;$

ERROR: code indent should never use tabs
#1720: FILE: tools/virtiofsd/fuse_common.h:420:
+^I/**$

ERROR: code indent should never use tabs
#1721: FILE: tools/virtiofsd/fuse_common.h:421:
+^I * Capability flags that the kernel supports (read-only)$

ERROR: code indent should never use tabs
#1722: FILE: tools/virtiofsd/fuse_common.h:422:
+^I */$

ERROR: code indent should never use tabs
#1723: FILE: tools/virtiofsd/fuse_common.h:423:
+^Iunsigned capable;$

ERROR: code indent should never use tabs
#1725: FILE: tools/virtiofsd/fuse_common.h:425:
+^I/**$

ERROR: code indent should never use tabs
#1726: FILE: tools/virtiofsd/fuse_common.h:426:
+^I * Capability flags that the filesystem wants to enable.$

ERROR: code indent should never use tabs
#1727: FILE: tools/virtiofsd/fuse_common.h:427:
+^I *$

ERROR: code indent should never use tabs #1728: FILE: tools/virtiofsd/fuse_common.h:428:
+^I * libfuse attempts to initialize this field with$

ERROR: code indent should never use tabs
#1729: FILE: tools/virtiofsd/fuse_common.h:429:
+^I * reasonable default values before calling the init() handler.$

ERROR: code indent should never use tabs
#1730: FILE: tools/virtiofsd/fuse_common.h:430:
+^I */$

ERROR: code indent should never use tabs
#1731: FILE: tools/virtiofsd/fuse_common.h:431:
+^Iunsigned want;$

ERROR: code indent should never use tabs
#1733: FILE: tools/virtiofsd/fuse_common.h:433:
+^I/**$

ERROR: code indent should never use tabs
#1734: FILE: tools/virtiofsd/fuse_common.h:434:
+^I * Maximum number of pending "background" requests. A$

ERROR: code indent should never use tabs
#1735: FILE: tools/virtiofsd/fuse_common.h:435:
+^I * background request is any type of request for which the$

ERROR: code indent should never use tabs
#1736: FILE: tools/virtiofsd/fuse_common.h:436:
+^I * total number is not limited by other means. As of kernel$

ERROR: code indent should never use tabs
#1737: FILE: tools/virtiofsd/fuse_common.h:437:
+^I * 4.8, only two types of requests fall into this category:$

ERROR: code indent should never use tabs
#1738: FILE: tools/virtiofsd/fuse_common.h:438:
+^I *$

ERROR: code indent should never use tabs
#1739: FILE: tools/virtiofsd/fuse_common.h:439:
+^I * 1. Read-ahead requests$

ERROR: code indent should never use tabs
#1740: FILE: tools/virtiofsd/fuse_common.h:440:
+^I * 2. Asynchronous direct I/O requests$

ERROR: code indent should never use tabs
#1741: FILE: tools/virtiofsd/fuse_common.h:441:
+^I *$

ERROR: code indent should never use tabs
#1742: FILE: tools/virtiofsd/fuse_common.h:442:
+^I * Read-ahead requests are generated (if max_readahead is$

ERROR: code indent should never use tabs
#1743: FILE: tools/virtiofsd/fuse_common.h:443:
+^I * non-zero) by the kernel to preemptively fill its caches$

ERROR: code indent should never use tabs
#1744: FILE: tools/virtiofsd/fuse_common.h:444:
+^I * when it anticipates that userspace will soon read more$

ERROR: code indent should never use tabs
#1745: FILE: tools/virtiofsd/fuse_common.h:445:
+^I * data.$

ERROR: code indent should never use tabs
#1746: FILE: tools/virtiofsd/fuse_common.h:446:
+^I *$

ERROR: code indent should never use tabs
#1747: FILE: tools/virtiofsd/fuse_common.h:447:
+^I * Asynchronous direct I/O requests are generated if$

ERROR: code indent should never use tabs
#1748: FILE: tools/virtiofsd/fuse_common.h:448:
+^I * FUSE_CAP_ASYNC_DIO is enabled and userspace submits a large$

ERROR: code indent should never use tabs
#1749: FILE: tools/virtiofsd/fuse_common.h:449:
+^I * direct I/O request. In this case the kernel will internally$

ERROR: code indent should never use tabs
#1750: FILE: tools/virtiofsd/fuse_common.h:450:
+^I * split it up into multiple smaller requests and submit them$

ERROR: code indent should never use tabs
#1751: FILE: tools/virtiofsd/fuse_common.h:451:
+^I * to the filesystem concurrently.$

ERROR: code indent should never use tabs
#1752: FILE: tools/virtiofsd/fuse_common.h:452:
+^I *$

ERROR: code indent should never use tabs
#1753: FILE: tools/virtiofsd/fuse_common.h:453:
+^I * Note that the following requests are *not* background$

ERROR: code indent should never use tabs
#1754: FILE: tools/virtiofsd/fuse_common.h:454:
+^I * requests: writeback requests (limited by the kernel's$

ERROR: code indent should never use tabs
#1755: FILE: tools/virtiofsd/fuse_common.h:455:
+^I * flusher algorithm), regular (i.e., synchronous and$

ERROR: code indent should never use tabs
#1756: FILE: tools/virtiofsd/fuse_common.h:456:
+^I * buffered) userspace read/write requests (limited to one per$

ERROR: code indent should never use tabs
#1757: FILE: tools/virtiofsd/fuse_common.h:457:
+^I * thread), asynchronous read requests (Linux's io_submit(2)$

ERROR: code indent should never use tabs
#1758: FILE: tools/virtiofsd/fuse_common.h:458:
+^I * call actually blocks, so these are also limited to one per$

ERROR: code indent should never use tabs
#1759: FILE: tools/virtiofsd/fuse_common.h:459:
+^I * thread).$

ERROR: code indent should never use tabs
#1760: FILE: tools/virtiofsd/fuse_common.h:460:
+^I */$

ERROR: code indent should never use tabs
#1761: FILE: tools/virtiofsd/fuse_common.h:461:
+^Iunsigned max_background;$

ERROR: code indent should never use tabs
#1763: FILE: tools/virtiofsd/fuse_common.h:463:
+^I/**$

ERROR: code indent should never use tabs
#1764: FILE: tools/virtiofsd/fuse_common.h:464:
+^I * Kernel congestion threshold parameter. If the number of pending$

ERROR: code indent should never use tabs
#1765: FILE: tools/virtiofsd/fuse_common.h:465:
+^I * background requests exceeds this number, the FUSE kernel module will$

ERROR: code indent should never use tabs
#1766: FILE: tools/virtiofsd/fuse_common.h:466:
+^I * mark the filesystem as "congested". This instructs the kernel to$

ERROR: code indent should never use tabs
#1767: FILE: tools/virtiofsd/fuse_common.h:467:
+^I * expect that queued requests will take some time to complete, and to$

ERROR: code indent should never use tabs
#1768: FILE: tools/virtiofsd/fuse_common.h:468:
+^I * adjust its algorithms accordingly (e.g. by putting a waiting thread$

ERROR: code indent should never use tabs
#1769: FILE: tools/virtiofsd/fuse_common.h:469:
+^I * to sleep instead of using a busy-loop).$

ERROR: code indent should never use tabs
#1770: FILE: tools/virtiofsd/fuse_common.h:470:
+^I */$

ERROR: code indent should never use tabs
#1771: FILE: tools/virtiofsd/fuse_common.h:471:
+^Iunsigned congestion_threshold;$

ERROR: code indent should never use tabs
#1773: FILE: tools/virtiofsd/fuse_common.h:473:
+^I/**$

ERROR: code indent should never use tabs
#1774: FILE: tools/virtiofsd/fuse_common.h:474:
+^I * When FUSE_CAP_WRITEBACK_CACHE is enabled, the kernel is responsible$

ERROR: code indent should never use tabs
#1775: FILE: tools/virtiofsd/fuse_common.h:475:
+^I * for updating mtime and ctime when write requests are received. The$

ERROR: code indent should never use tabs
#1776: FILE: tools/virtiofsd/fuse_common.h:476:
+^I * updated values are passed to the filesystem with setattr() requests.$

ERROR: code indent should never use tabs
#1777: FILE: tools/virtiofsd/fuse_common.h:477:
+^I * However, if the filesystem does not support the full resolution of$

ERROR: code indent should never use tabs
#1778: FILE: tools/virtiofsd/fuse_common.h:478:
+^I * the kernel timestamps (nanoseconds), the mtime and ctime values used$

ERROR: code indent should never use tabs
#1779: FILE: tools/virtiofsd/fuse_common.h:479:
+^I * by kernel and filesystem will differ (and result in an apparent$

ERROR: code indent should never use tabs
#1780: FILE: tools/virtiofsd/fuse_common.h:480:
+^I * change of times after a cache flush).$

ERROR: code indent should never use tabs
#1781: FILE: tools/virtiofsd/fuse_common.h:481:
+^I *$

ERROR: code indent should never use tabs
#1782: FILE: tools/virtiofsd/fuse_common.h:482:
+^I * To prevent this problem, this variable can be used to inform the$

ERROR: code indent should never use tabs
#1783: FILE: tools/virtiofsd/fuse_common.h:483:
+^I * kernel about the timestamp granularity supported by the file-system.$

ERROR: code indent should never use tabs
#1784: FILE: tools/virtiofsd/fuse_common.h:484:
+^I * The value should be power of 10. The default is 1, i.e. full$

ERROR: code indent should never use tabs
#1785: FILE: tools/virtiofsd/fuse_common.h:485:
+^I * nano-second resolution. Filesystems supporting only second resolution$

ERROR: code indent should never use tabs
#1786: FILE: tools/virtiofsd/fuse_common.h:486:
+^I * should set this to 1000000000.$

ERROR: code indent should never use tabs
#1787: FILE: tools/virtiofsd/fuse_common.h:487:
+^I */$

ERROR: code indent should never use tabs
#1788: FILE: tools/virtiofsd/fuse_common.h:488:
+^Iunsigned time_gran;$

ERROR: code indent should never use tabs
#1790: FILE: tools/virtiofsd/fuse_common.h:490:
+^I/**$

ERROR: code indent should never use tabs
#1791: FILE: tools/virtiofsd/fuse_common.h:491:
+^I * For future use.$

ERROR: code indent should never use tabs
#1792: FILE: tools/virtiofsd/fuse_common.h:492:
+^I */$

ERROR: code indent should never use tabs
#1793: FILE: tools/virtiofsd/fuse_common.h:493:
+^Iunsigned reserved[22];$

WARNING: line over 80 characters
#1820: FILE: tools/virtiofsd/fuse_common.h:520:
+ * -o no_remote_lock Equivalent to -o no_remote_flock,no_remote_posix_lock

ERROR: "foo* bar" should be "foo *bar"
#1842: FILE: tools/virtiofsd/fuse_common.h:542:
+struct fuse_conn_info_opts* fuse_parse_conn_info_opts(struct fuse_args *args);

ERROR: code indent should never use tabs
#1852: FILE: tools/virtiofsd/fuse_common.h:552:
+^I^I^I struct fuse_conn_info *conn);$

WARNING: Block comments use a leading /* on a separate line #1883: FILE: tools/virtiofsd/fuse_common.h:583:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#1884: FILE: tools/virtiofsd/fuse_common.h:584:
+ * Data buffer^I^I^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #1885: FILE: tools/virtiofsd/fuse_common.h:585:
+ * ----------------------------------------------------------- */

ERROR: code indent should never use tabs
#1891: FILE: tools/virtiofsd/fuse_common.h:591:
+^I/**$

ERROR: code indent should never use tabs
#1892: FILE: tools/virtiofsd/fuse_common.h:592:
+^I * Buffer contains a file descriptor$

ERROR: code indent should never use tabs
#1893: FILE: tools/virtiofsd/fuse_common.h:593:
+^I *$

ERROR: code indent should never use tabs
#1894: FILE: tools/virtiofsd/fuse_common.h:594:
+^I * If this flag is set, the .fd field is valid, otherwise the$

ERROR: code indent should never use tabs
#1895: FILE: tools/virtiofsd/fuse_common.h:595:
+^I * .mem fields is valid.$

ERROR: code indent should never use tabs
#1896: FILE: tools/virtiofsd/fuse_common.h:596:
+^I */$

ERROR: code indent should never use tabs
#1897: FILE: tools/virtiofsd/fuse_common.h:597:
+^IFUSE_BUF_IS_FD^I^I= (1 << 1),$

ERROR: code indent should never use tabs
#1899: FILE: tools/virtiofsd/fuse_common.h:599:
+^I/**$

ERROR: code indent should never use tabs
#1900: FILE: tools/virtiofsd/fuse_common.h:600:
+^I * Seek on the file descriptor$

ERROR: code indent should never use tabs
#1901: FILE: tools/virtiofsd/fuse_common.h:601:
+^I *$

ERROR: code indent should never use tabs
#1902: FILE: tools/virtiofsd/fuse_common.h:602:
+^I * If this flag is set then the .pos field is valid and is$

ERROR: code indent should never use tabs
#1903: FILE: tools/virtiofsd/fuse_common.h:603:
+^I * used to seek to the given offset before performing$

ERROR: code indent should never use tabs
#1904: FILE: tools/virtiofsd/fuse_common.h:604:
+^I * operation on file descriptor.$

ERROR: code indent should never use tabs
#1905: FILE: tools/virtiofsd/fuse_common.h:605:
+^I */$

ERROR: code indent should never use tabs
#1906: FILE: tools/virtiofsd/fuse_common.h:606:
+^IFUSE_BUF_FD_SEEK^I= (1 << 2),$

ERROR: code indent should never use tabs
#1908: FILE: tools/virtiofsd/fuse_common.h:608:
+^I/**$

ERROR: code indent should never use tabs
#1909: FILE: tools/virtiofsd/fuse_common.h:609:
+^I * Retry operation on file descriptor$

ERROR: code indent should never use tabs
#1910: FILE: tools/virtiofsd/fuse_common.h:610:
+^I *$

ERROR: code indent should never use tabs
#1911: FILE: tools/virtiofsd/fuse_common.h:611:
+^I * If this flag is set then retry operation on file descriptor$

ERROR: code indent should never use tabs
#1912: FILE: tools/virtiofsd/fuse_common.h:612:
+^I * until .size bytes have been copied or an error or EOF is$

ERROR: code indent should never use tabs
#1913: FILE: tools/virtiofsd/fuse_common.h:613:
+^I * detected.$

ERROR: code indent should never use tabs
#1914: FILE: tools/virtiofsd/fuse_common.h:614:
+^I */$

ERROR: code indent should never use tabs
#1915: FILE: tools/virtiofsd/fuse_common.h:615:
+^IFUSE_BUF_FD_RETRY^I= (1 << 3),$

ERROR: code indent should never use tabs
#1922: FILE: tools/virtiofsd/fuse_common.h:622:
+^I/**$

ERROR: code indent should never use tabs
#1923: FILE: tools/virtiofsd/fuse_common.h:623:
+^I * Don't use splice(2)$

ERROR: code indent should never use tabs
#1924: FILE: tools/virtiofsd/fuse_common.h:624:
+^I *$

ERROR: code indent should never use tabs
#1925: FILE: tools/virtiofsd/fuse_common.h:625:
+^I * Always fall back to using read and write instead of$

ERROR: code indent should never use tabs
#1926: FILE: tools/virtiofsd/fuse_common.h:626:
+^I * splice(2) to copy data from one file descriptor to another.$

ERROR: code indent should never use tabs
#1927: FILE: tools/virtiofsd/fuse_common.h:627:
+^I *$

ERROR: code indent should never use tabs
#1928: FILE: tools/virtiofsd/fuse_common.h:628:
+^I * If this flag is not set, then only fall back if splice is$

ERROR: code indent should never use tabs
#1929: FILE: tools/virtiofsd/fuse_common.h:629:
+^I * unavailable.$

ERROR: code indent should never use tabs
#1930: FILE: tools/virtiofsd/fuse_common.h:630:
+^I */$

ERROR: code indent should never use tabs
#1931: FILE: tools/virtiofsd/fuse_common.h:631:
+^IFUSE_BUF_NO_SPLICE^I= (1 << 1),$

ERROR: code indent should never use tabs
#1933: FILE: tools/virtiofsd/fuse_common.h:633:
+^I/**$

ERROR: code indent should never use tabs
#1934: FILE: tools/virtiofsd/fuse_common.h:634:
+^I * Force splice$

ERROR: code indent should never use tabs
#1935: FILE: tools/virtiofsd/fuse_common.h:635:
+^I *$

ERROR: code indent should never use tabs
#1936: FILE: tools/virtiofsd/fuse_common.h:636:
+^I * Always use splice(2) to copy data from one file descriptor$

ERROR: code indent should never use tabs
#1937: FILE: tools/virtiofsd/fuse_common.h:637:
+^I * to another. If splice is not available, return -EINVAL.$

ERROR: code indent should never use tabs
#1938: FILE: tools/virtiofsd/fuse_common.h:638:
+^I */$

ERROR: code indent should never use tabs
#1939: FILE: tools/virtiofsd/fuse_common.h:639:
+^IFUSE_BUF_FORCE_SPLICE^I= (1 << 2),$

ERROR: code indent should never use tabs
#1941: FILE: tools/virtiofsd/fuse_common.h:641:
+^I/**$

ERROR: code indent should never use tabs
#1942: FILE: tools/virtiofsd/fuse_common.h:642:
+^I * Try to move data with splice.$

ERROR: code indent should never use tabs
#1943: FILE: tools/virtiofsd/fuse_common.h:643:
+^I *$

ERROR: code indent should never use tabs
#1944: FILE: tools/virtiofsd/fuse_common.h:644:
+^I * If splice is used, try to move pages from the source to the$

ERROR: code indent should never use tabs
#1945: FILE: tools/virtiofsd/fuse_common.h:645:
+^I * destination instead of copying. See documentation of$

ERROR: code indent should never use tabs
#1946: FILE: tools/virtiofsd/fuse_common.h:646:
+^I * SPLICE_F_MOVE in splice(2) man page.$

ERROR: code indent should never use tabs
#1947: FILE: tools/virtiofsd/fuse_common.h:647:
+^I */$

ERROR: code indent should never use tabs
#1948: FILE: tools/virtiofsd/fuse_common.h:648:
+^IFUSE_BUF_SPLICE_MOVE^I= (1 << 3),$

ERROR: code indent should never use tabs
#1950: FILE: tools/virtiofsd/fuse_common.h:650:
+^I/**$

ERROR: code indent should never use tabs
#1951: FILE: tools/virtiofsd/fuse_common.h:651:
+^I * Don't block on the pipe when copying data with splice$

ERROR: code indent should never use tabs
#1952: FILE: tools/virtiofsd/fuse_common.h:652:
+^I *$

ERROR: code indent should never use tabs
#1953: FILE: tools/virtiofsd/fuse_common.h:653:
+^I * Makes the operations on the pipe non-blocking (if the pipe$

ERROR: code indent should never use tabs
#1954: FILE: tools/virtiofsd/fuse_common.h:654:
+^I * is full or empty). See SPLICE_F_NONBLOCK in the splice(2)$

ERROR: code indent should never use tabs
#1955: FILE: tools/virtiofsd/fuse_common.h:655:
+^I * man page.$

ERROR: code indent should never use tabs
#1956: FILE: tools/virtiofsd/fuse_common.h:656:
+^I */$

ERROR: code indent should never use tabs
#1957: FILE: tools/virtiofsd/fuse_common.h:657:
+^IFUSE_BUF_SPLICE_NONBLOCK= (1 << 4),$

ERROR: spaces required around that '=' (ctx:VxW)
#1957: FILE: tools/virtiofsd/fuse_common.h:657:
+ FUSE_BUF_SPLICE_NONBLOCK= (1 << 4),

                                ^

ERROR: code indent should never use tabs
#1967: FILE: tools/virtiofsd/fuse_common.h:667:
+^I/**$

ERROR: code indent should never use tabs
#1968: FILE: tools/virtiofsd/fuse_common.h:668:
+^I * Size of data in bytes$

ERROR: code indent should never use tabs
#1969: FILE: tools/virtiofsd/fuse_common.h:669:
+^I */$

ERROR: code indent should never use tabs
#1970: FILE: tools/virtiofsd/fuse_common.h:670:
+^Isize_t size;$

ERROR: code indent should never use tabs
#1972: FILE: tools/virtiofsd/fuse_common.h:672:
+^I/**$

ERROR: code indent should never use tabs
#1973: FILE: tools/virtiofsd/fuse_common.h:673:
+^I * Buffer flags$

ERROR: code indent should never use tabs
#1974: FILE: tools/virtiofsd/fuse_common.h:674:
+^I */$

ERROR: code indent should never use tabs
#1975: FILE: tools/virtiofsd/fuse_common.h:675:
+^Ienum fuse_buf_flags flags;$

ERROR: code indent should never use tabs
#1977: FILE: tools/virtiofsd/fuse_common.h:677:
+^I/**$

ERROR: code indent should never use tabs
#1978: FILE: tools/virtiofsd/fuse_common.h:678:
+^I * Memory pointer$

ERROR: code indent should never use tabs
#1979: FILE: tools/virtiofsd/fuse_common.h:679:
+^I *$

ERROR: code indent should never use tabs
#1980: FILE: tools/virtiofsd/fuse_common.h:680:
+^I * Used unless FUSE_BUF_IS_FD flag is set.$

ERROR: code indent should never use tabs
#1981: FILE: tools/virtiofsd/fuse_common.h:681:
+^I */$

ERROR: code indent should never use tabs
#1982: FILE: tools/virtiofsd/fuse_common.h:682:
+^Ivoid *mem;$

ERROR: code indent should never use tabs
#1984: FILE: tools/virtiofsd/fuse_common.h:684:
+^I/**$

ERROR: code indent should never use tabs
#1985: FILE: tools/virtiofsd/fuse_common.h:685:
+^I * File descriptor$

ERROR: code indent should never use tabs
#1986: FILE: tools/virtiofsd/fuse_common.h:686:
+^I *$

ERROR: code indent should never use tabs
#1987: FILE: tools/virtiofsd/fuse_common.h:687:
+^I * Used if FUSE_BUF_IS_FD flag is set.$

ERROR: code indent should never use tabs
#1988: FILE: tools/virtiofsd/fuse_common.h:688:
+^I */$

ERROR: code indent should never use tabs
#1989: FILE: tools/virtiofsd/fuse_common.h:689:
+^Iint fd;$

ERROR: code indent should never use tabs
#1991: FILE: tools/virtiofsd/fuse_common.h:691:
+^I/**$

ERROR: code indent should never use tabs
#1992: FILE: tools/virtiofsd/fuse_common.h:692:
+^I * File position$

ERROR: code indent should never use tabs
#1993: FILE: tools/virtiofsd/fuse_common.h:693:
+^I *$

ERROR: code indent should never use tabs
#1994: FILE: tools/virtiofsd/fuse_common.h:694:
+^I * Used if FUSE_BUF_FD_SEEK flag is set.$

ERROR: code indent should never use tabs
#1995: FILE: tools/virtiofsd/fuse_common.h:695:
+^I */$

ERROR: code indent should never use tabs
#1996: FILE: tools/virtiofsd/fuse_common.h:696:
+^Ioff_t pos;$

ERROR: code indent should never use tabs
#2008: FILE: tools/virtiofsd/fuse_common.h:708:
+^I/**$

ERROR: code indent should never use tabs
#2009: FILE: tools/virtiofsd/fuse_common.h:709:
+^I * Number of buffers in the array$

ERROR: code indent should never use tabs
#2010: FILE: tools/virtiofsd/fuse_common.h:710:
+^I */$

ERROR: code indent should never use tabs
#2011: FILE: tools/virtiofsd/fuse_common.h:711:
+^Isize_t count;$

ERROR: code indent should never use tabs
#2013: FILE: tools/virtiofsd/fuse_common.h:713:
+^I/**$

ERROR: code indent should never use tabs
#2014: FILE: tools/virtiofsd/fuse_common.h:714:
+^I * Index of current buffer within the array$

ERROR: code indent should never use tabs
#2015: FILE: tools/virtiofsd/fuse_common.h:715:
+^I */$

ERROR: code indent should never use tabs
#2016: FILE: tools/virtiofsd/fuse_common.h:716:
+^Isize_t idx;$

ERROR: code indent should never use tabs
#2018: FILE: tools/virtiofsd/fuse_common.h:718:
+^I/**$

ERROR: code indent should never use tabs
#2019: FILE: tools/virtiofsd/fuse_common.h:719:
+^I * Current offset within the current buffer$

ERROR: code indent should never use tabs
#2020: FILE: tools/virtiofsd/fuse_common.h:720:
+^I */$

ERROR: code indent should never use tabs
#2021: FILE: tools/virtiofsd/fuse_common.h:721:
+^Isize_t off;$

ERROR: code indent should never use tabs
#2023: FILE: tools/virtiofsd/fuse_common.h:723:
+^I/**$

ERROR: code indent should never use tabs
#2024: FILE: tools/virtiofsd/fuse_common.h:724:
+^I * Array of buffers$

ERROR: code indent should never use tabs
#2025: FILE: tools/virtiofsd/fuse_common.h:725:
+^I */$

ERROR: code indent should never use tabs
#2026: FILE: tools/virtiofsd/fuse_common.h:726:
+^Istruct fuse_buf buf[1];$

ERROR: code indent should never use tabs
#2030: FILE: tools/virtiofsd/fuse_common.h:730:
+#define FUSE_BUFVEC_INIT(size__)^I^I^I^I\$

ERROR: code indent should never use tabs
#2031: FILE: tools/virtiofsd/fuse_common.h:731:
+^I((struct fuse_bufvec) {^I^I^I^I^I\$

ERROR: code indent should never use tabs
#2032: FILE: tools/virtiofsd/fuse_common.h:732:
+^I^I/* .count= */ 1,^I^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2032: FILE: tools/virtiofsd/fuse_common.h:732:
+ /* .count= */ 1, \

ERROR: code indent should never use tabs
#2033: FILE: tools/virtiofsd/fuse_common.h:733:
+^I^I/* .idx = */ 0,^I^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2033: FILE: tools/virtiofsd/fuse_common.h:733:
+ /* .idx = */ 0, \

ERROR: code indent should never use tabs
#2034: FILE: tools/virtiofsd/fuse_common.h:734:
+^I^I/* .off = */ 0,^I^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2034: FILE: tools/virtiofsd/fuse_common.h:734:
+ /* .off = */ 0, \

ERROR: code indent should never use tabs
#2035: FILE: tools/virtiofsd/fuse_common.h:735:
+^I^I/* .buf = */ { /* [0] = */ {^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2035: FILE: tools/virtiofsd/fuse_common.h:735:
+ /* .buf = */ { /* [0] = */ { \

ERROR: code indent should never use tabs
#2036: FILE: tools/virtiofsd/fuse_common.h:736:
+^I^I^I/* .size = */ (size__),^I^I\$

WARNING: Block comments use a leading /* on a separate line #2036: FILE: tools/virtiofsd/fuse_common.h:736:
+ /* .size = */ (size__), \

ERROR: code indent should never use tabs #2037: FILE: tools/virtiofsd/fuse_common.h:737:
+^I^I^I/* .flags = */ (enum fuse_buf_flags) 0,^I\$

WARNING: Block comments use a leading /* on a separate line #2037: FILE: tools/virtiofsd/fuse_common.h:737:
+ /* .flags = */ (enum fuse_buf_flags) 0, \

ERROR: code indent should never use tabs
#2038: FILE: tools/virtiofsd/fuse_common.h:738:
+^I^I^I/* .mem = */ NULL,^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2038: FILE: tools/virtiofsd/fuse_common.h:738:
+ /* .mem = */ NULL, \

ERROR: code indent should never use tabs
#2039: FILE: tools/virtiofsd/fuse_common.h:739:
+^I^I^I/* .fd = */ -1,^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2039: FILE: tools/virtiofsd/fuse_common.h:739:
+ /* .fd = */ -1, \

ERROR: code indent should never use tabs
#2040: FILE: tools/virtiofsd/fuse_common.h:740:
+^I^I^I/* .pos = */ 0,^I^I^I\$

WARNING: Block comments use a leading /* on a separate line #2040: FILE: tools/virtiofsd/fuse_common.h:740:
+ /* .pos = */ 0, \

ERROR: code indent should never use tabs
#2041: FILE: tools/virtiofsd/fuse_common.h:741:
+^I^I} }^I^I^I^I^I^I\$

ERROR: code indent should never use tabs
#2042: FILE: tools/virtiofsd/fuse_common.h:742:
+^I} )$

ERROR: space prohibited before that close parenthesis ')' #2042: FILE: tools/virtiofsd/fuse_common.h:742:
+ } )

ERROR: code indent should never use tabs
#2061: FILE: tools/virtiofsd/fuse_common.h:761:
+^I^I enum fuse_buf_copy_flags flags);$

WARNING: Block comments use a leading /* on a separate line #2063: FILE: tools/virtiofsd/fuse_common.h:763:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#2064: FILE: tools/virtiofsd/fuse_common.h:764:
+ * Signal handling^I^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #2065: FILE: tools/virtiofsd/fuse_common.h:765:
+ * ----------------------------------------------------------- */

ERROR: code indent should never use tabs
#2070: FILE: tools/virtiofsd/fuse_common.h:770:
+ * Stores session in a global variable.^I May only be called once per$

WARNING: Block comments use a leading /* on a separate line #2097: FILE: tools/virtiofsd/fuse_common.h:797:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#2098: FILE: tools/virtiofsd/fuse_common.h:798:
+ * Compatibility stuff^I^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #2099: FILE: tools/virtiofsd/fuse_common.h:799:
+ * ----------------------------------------------------------- */

WARNING: architecture specific defines should be avoided #2105: FILE: tools/virtiofsd/fuse_common.h:805:
+#ifdef __cplusplus

ERROR: line over 90 characters
#2116: FILE: tools/virtiofsd/fuse_common.h:816:
+#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus

WARNING: architecture specific defines should be avoided
#2116: FILE: tools/virtiofsd/fuse_common.h:816:
+#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus

ERROR: code indent should never use tabs
#2120: FILE: tools/virtiofsd/fuse_common.h:820:
+^I{ unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1); };$

WARNING: Block comments use * on subsequent lines
#2131: FILE: tools/virtiofsd/fuse_i.h:2:
+/*
+ FUSE: Filesystem in Userspace

ERROR: code indent should never use tabs
#2144: FILE: tools/virtiofsd/fuse_i.h:15:
+^Istruct fuse_session *se;$

ERROR: code indent should never use tabs
#2145: FILE: tools/virtiofsd/fuse_i.h:16:
+^Iuint64_t unique;$

ERROR: code indent should never use tabs
#2146: FILE: tools/virtiofsd/fuse_i.h:17:
+^Iint ctr;$

ERROR: code indent should never use tabs
#2147: FILE: tools/virtiofsd/fuse_i.h:18:
+^Ipthread_mutex_t lock;$

ERROR: code indent should never use tabs
#2148: FILE: tools/virtiofsd/fuse_i.h:19:
+^Istruct fuse_ctx ctx;$

ERROR: code indent should never use tabs
#2149: FILE: tools/virtiofsd/fuse_i.h:20:
+^Istruct fuse_chan *ch;$

ERROR: code indent should never use tabs
#2150: FILE: tools/virtiofsd/fuse_i.h:21:
+^Iint interrupted;$

ERROR: code indent should never use tabs
#2151: FILE: tools/virtiofsd/fuse_i.h:22:
+^Iunsigned int ioctl_64bit : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW) #2151: FILE: tools/virtiofsd/fuse_i.h:22:

+       unsigned int ioctl_64bit : 1;
                                 ^

ERROR: code indent should never use tabs
#2152: FILE: tools/virtiofsd/fuse_i.h:23:
+^Iunion {$

ERROR: code indent should never use tabs
#2153: FILE: tools/virtiofsd/fuse_i.h:24:
+^I^Istruct {$

ERROR: code indent should never use tabs
#2154: FILE: tools/virtiofsd/fuse_i.h:25:
+^I^I^Iuint64_t unique;$

ERROR: code indent should never use tabs
#2155: FILE: tools/virtiofsd/fuse_i.h:26:
+^I^I} i;$

ERROR: code indent should never use tabs
#2156: FILE: tools/virtiofsd/fuse_i.h:27:
+^I^Istruct {$

ERROR: code indent should never use tabs
#2157: FILE: tools/virtiofsd/fuse_i.h:28:
+^I^I^Ifuse_interrupt_func_t func;$

ERROR: code indent should never use tabs
#2158: FILE: tools/virtiofsd/fuse_i.h:29:
+^I^I^Ivoid *data;$

ERROR: code indent should never use tabs
#2159: FILE: tools/virtiofsd/fuse_i.h:30:
+^I^I} ni;$

ERROR: code indent should never use tabs
#2160: FILE: tools/virtiofsd/fuse_i.h:31:
+^I} u;$

ERROR: code indent should never use tabs
#2161: FILE: tools/virtiofsd/fuse_i.h:32:
+^Istruct fuse_req *next;$

ERROR: code indent should never use tabs
#2162: FILE: tools/virtiofsd/fuse_i.h:33:
+^Istruct fuse_req *prev;$

ERROR: code indent should never use tabs
#2166: FILE: tools/virtiofsd/fuse_i.h:37:
+^Iuint64_t unique;$

ERROR: code indent should never use tabs
#2167: FILE: tools/virtiofsd/fuse_i.h:38:
+^Ivoid (*reply)(struct fuse_notify_req *, fuse_req_t, fuse_ino_t,$

ERROR: code indent should never use tabs
#2168: FILE: tools/virtiofsd/fuse_i.h:39:
+^I^I const void *, const struct fuse_buf *);$

ERROR: code indent should never use tabs
#2169: FILE: tools/virtiofsd/fuse_i.h:40:
+^Istruct fuse_notify_req *next;$

ERROR: code indent should never use tabs
#2170: FILE: tools/virtiofsd/fuse_i.h:41:
+^Istruct fuse_notify_req *prev;$

ERROR: code indent should never use tabs
#2174: FILE: tools/virtiofsd/fuse_i.h:45:
+^Ichar *mountpoint;$

ERROR: code indent should never use tabs
#2175: FILE: tools/virtiofsd/fuse_i.h:46:
+^Ivolatile int exited;$

ERROR: Use of volatile is usually wrong, please add a comment #2175: FILE: tools/virtiofsd/fuse_i.h:46:
+ volatile int exited;

ERROR: code indent should never use tabs
#2176: FILE: tools/virtiofsd/fuse_i.h:47:
+^Iint fd;$

ERROR: code indent should never use tabs
#2177: FILE: tools/virtiofsd/fuse_i.h:48:
+^Istruct mount_opts *mo;$

ERROR: code indent should never use tabs
#2178: FILE: tools/virtiofsd/fuse_i.h:49:
+^Iint debug;$

ERROR: code indent should never use tabs
#2179: FILE: tools/virtiofsd/fuse_i.h:50:
+^Iint deny_others;$

ERROR: code indent should never use tabs
#2180: FILE: tools/virtiofsd/fuse_i.h:51:
+^Istruct fuse_lowlevel_ops op;$

ERROR: code indent should never use tabs
#2181: FILE: tools/virtiofsd/fuse_i.h:52:
+^Iint got_init;$

ERROR: code indent should never use tabs
#2182: FILE: tools/virtiofsd/fuse_i.h:53:
+^Istruct cuse_data *cuse_data;$

ERROR: code indent should never use tabs
#2183: FILE: tools/virtiofsd/fuse_i.h:54:
+^Ivoid *userdata;$

ERROR: code indent should never use tabs
#2184: FILE: tools/virtiofsd/fuse_i.h:55:
+^Iuid_t owner;$

ERROR: code indent should never use tabs
#2185: FILE: tools/virtiofsd/fuse_i.h:56:
+^Istruct fuse_conn_info conn;$

ERROR: code indent should never use tabs
#2186: FILE: tools/virtiofsd/fuse_i.h:57:
+^Istruct fuse_req list;$

ERROR: code indent should never use tabs
#2187: FILE: tools/virtiofsd/fuse_i.h:58:
+^Istruct fuse_req interrupts;$

ERROR: code indent should never use tabs
#2188: FILE: tools/virtiofsd/fuse_i.h:59:
+^Ipthread_mutex_t lock;$

ERROR: code indent should never use tabs
#2189: FILE: tools/virtiofsd/fuse_i.h:60:
+^Iint got_destroy;$

ERROR: code indent should never use tabs
#2190: FILE: tools/virtiofsd/fuse_i.h:61:
+^Ipthread_key_t pipe_key;$

ERROR: code indent should never use tabs
#2191: FILE: tools/virtiofsd/fuse_i.h:62:
+^Iint broken_splice_nonblock;$

ERROR: code indent should never use tabs
#2192: FILE: tools/virtiofsd/fuse_i.h:63:
+^Iuint64_t notify_ctr;$

ERROR: code indent should never use tabs
#2193: FILE: tools/virtiofsd/fuse_i.h:64:
+^Istruct fuse_notify_req notify_list;$

ERROR: code indent should never use tabs
#2194: FILE: tools/virtiofsd/fuse_i.h:65:
+^Isize_t bufsize;$

ERROR: code indent should never use tabs
#2195: FILE: tools/virtiofsd/fuse_i.h:66:
+^Iint error;$

ERROR: code indent should never use tabs
#2199: FILE: tools/virtiofsd/fuse_i.h:70:
+^Ipthread_mutex_t lock;$

ERROR: code indent should never use tabs
#2200: FILE: tools/virtiofsd/fuse_i.h:71:
+^Iint ctr;$

ERROR: code indent should never use tabs
#2201: FILE: tools/virtiofsd/fuse_i.h:72:
+^Iint fd;$

ERROR: code indent should never use tabs
#2212: FILE: tools/virtiofsd/fuse_i.h:83:
+^Ichar *name;$

ERROR: code indent should never use tabs
#2213: FILE: tools/virtiofsd/fuse_i.h:84:
+^Ifuse_module_factory_t factory;$

ERROR: code indent should never use tabs
#2214: FILE: tools/virtiofsd/fuse_i.h:85:
+^Istruct fuse_module *next;$

ERROR: code indent should never use tabs
#2215: FILE: tools/virtiofsd/fuse_i.h:86:
+^Istruct fusemod_so *so;$

ERROR: code indent should never use tabs
#2216: FILE: tools/virtiofsd/fuse_i.h:87:
+^Iint ctr;$

WARNING: Block comments use a leading /* on a separate line #2219: FILE: tools/virtiofsd/fuse_i.h:90:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#2220: FILE: tools/virtiofsd/fuse_i.h:91:
+ * Channel interface (when using -o clone_fd)^I^I *$

WARNING: Block comments use a trailing */ on a separate line #2221: FILE: tools/virtiofsd/fuse_i.h:92:
+ * ----------------------------------------------------------- */

ERROR: code indent should never use tabs
#2246: FILE: tools/virtiofsd/fuse_i.h:117:
+^I^I^I int count);$

ERROR: code indent should never use tabs
#2254: FILE: tools/virtiofsd/fuse_i.h:125:
+^I^I^I^I struct fuse_chan *ch);$

WARNING: line over 80 characters
#2256: FILE: tools/virtiofsd/fuse_i.h:127:
+ const struct fuse_buf *buf, struct fuse_chan *ch);

ERROR: code indent should never use tabs
#2256: FILE: tools/virtiofsd/fuse_i.h:127:
+^I^I^I^I const struct fuse_buf *buf, struct fuse_chan *ch);$

WARNING: line over 80 characters
#2258: FILE: tools/virtiofsd/fuse_i.h:129:
+struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *op,

ERROR: code indent should never use tabs
#2259: FILE: tools/virtiofsd/fuse_i.h:130:
+^I^I size_t op_size, void *private_data);$

WARNING: line over 80 characters
#2261: FILE: tools/virtiofsd/fuse_i.h:132:
+int fuse_session_loop_mt_32(struct fuse_session *se, struct fuse_loop_config *config);

WARNING: Block comments use * on subsequent lines
#2276: FILE: tools/virtiofsd/fuse_log.h:2:
+/*
+ FUSE: Filesystem in Userspace

WARNING: Block comments use a leading /* on a separate line #2286: FILE: tools/virtiofsd/fuse_log.h:12:
+/** @file

WARNING: architecture specific defines should be avoided #2293: FILE: tools/virtiofsd/fuse_log.h:19:
+#ifdef __cplusplus

ERROR: code indent should never use tabs
#2303: FILE: tools/virtiofsd/fuse_log.h:29:
+^IFUSE_LOG_EMERG,$

ERROR: code indent should never use tabs
#2304: FILE: tools/virtiofsd/fuse_log.h:30:
+^IFUSE_LOG_ALERT,$

ERROR: code indent should never use tabs
#2305: FILE: tools/virtiofsd/fuse_log.h:31:
+^IFUSE_LOG_CRIT,$

ERROR: code indent should never use tabs
#2306: FILE: tools/virtiofsd/fuse_log.h:32:
+^IFUSE_LOG_ERR,$

ERROR: code indent should never use tabs
#2307: FILE: tools/virtiofsd/fuse_log.h:33:
+^IFUSE_LOG_WARNING,$

ERROR: code indent should never use tabs
#2308: FILE: tools/virtiofsd/fuse_log.h:34:
+^IFUSE_LOG_NOTICE,$

ERROR: code indent should never use tabs
#2309: FILE: tools/virtiofsd/fuse_log.h:35:
+^IFUSE_LOG_INFO,$

ERROR: code indent should never use tabs
#2310: FILE: tools/virtiofsd/fuse_log.h:36:
+^IFUSE_LOG_DEBUG$

ERROR: code indent should never use tabs
#2327: FILE: tools/virtiofsd/fuse_log.h:53:
+^I^I^I^Iconst char *fmt, va_list ap);$

WARNING: architecture specific defines should be avoided #2352: FILE: tools/virtiofsd/fuse_log.h:78:
+#ifdef __cplusplus

WARNING: Block comments use * on subsequent lines
#2364: FILE: tools/virtiofsd/fuse_lowlevel.h:2:
+/*
+ FUSE: Filesystem in Userspace

WARNING: Block comments use a leading /* on a separate line #2374: FILE: tools/virtiofsd/fuse_lowlevel.h:12:
+/** @file

WARNING: architecture specific defines should be avoided #2396: FILE: tools/virtiofsd/fuse_lowlevel.h:34:
+#ifdef __cplusplus

WARNING: Block comments use a leading /* on a separate line #2400: FILE: tools/virtiofsd/fuse_lowlevel.h:38:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#2401: FILE: tools/virtiofsd/fuse_lowlevel.h:39:
+ * Miscellaneous definitions^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #2402: FILE: tools/virtiofsd/fuse_lowlevel.h:40:
+ * ----------------------------------------------------------- */

ERROR: code indent should never use tabs
#2422: FILE: tools/virtiofsd/fuse_lowlevel.h:60:
+^I/** Unique inode number$

WARNING: Block comments use a leading /* on a separate line #2422: FILE: tools/virtiofsd/fuse_lowlevel.h:60:
+ /** Unique inode number

ERROR: code indent should never use tabs
#2423: FILE: tools/virtiofsd/fuse_lowlevel.h:61:
+^I *$

ERROR: code indent should never use tabs
#2424: FILE: tools/virtiofsd/fuse_lowlevel.h:62:
+^I * In lookup, zero means negative entry (from version 2.5)$

ERROR: code indent should never use tabs
#2425: FILE: tools/virtiofsd/fuse_lowlevel.h:63:
+^I * Returning ENOENT also means negative entry, but by setting zero$

ERROR: code indent should never use tabs
#2426: FILE: tools/virtiofsd/fuse_lowlevel.h:64:
+^I * ino the kernel may cache negative entries for entry_timeout$

ERROR: code indent should never use tabs
#2427: FILE: tools/virtiofsd/fuse_lowlevel.h:65:
+^I * seconds.$

ERROR: code indent should never use tabs
#2428: FILE: tools/virtiofsd/fuse_lowlevel.h:66:
+^I */$

ERROR: code indent should never use tabs
#2429: FILE: tools/virtiofsd/fuse_lowlevel.h:67:
+^Ifuse_ino_t ino;$

ERROR: code indent should never use tabs
#2431: FILE: tools/virtiofsd/fuse_lowlevel.h:69:
+^I/** Generation number for this entry.$

WARNING: Block comments use a leading /* on a separate line #2431: FILE: tools/virtiofsd/fuse_lowlevel.h:69:
+ /** Generation number for this entry.

ERROR: code indent should never use tabs
#2432: FILE: tools/virtiofsd/fuse_lowlevel.h:70:
+^I *$

ERROR: code indent should never use tabs
#2433: FILE: tools/virtiofsd/fuse_lowlevel.h:71:
+^I * If the file system will be exported over NFS, the$

ERROR: code indent should never use tabs
#2434: FILE: tools/virtiofsd/fuse_lowlevel.h:72:
+^I * ino/generation pairs need to be unique over the file$

ERROR: code indent should never use tabs
#2435: FILE: tools/virtiofsd/fuse_lowlevel.h:73:
+^I * system's lifetime (rather than just the mount time). So if$

ERROR: code indent should never use tabs
#2436: FILE: tools/virtiofsd/fuse_lowlevel.h:74:
+^I * the file system reuses an inode after it has been deleted,$

ERROR: code indent should never use tabs
#2437: FILE: tools/virtiofsd/fuse_lowlevel.h:75:
+^I * it must assign a new, previously unused generation number$

ERROR: code indent should never use tabs
#2438: FILE: tools/virtiofsd/fuse_lowlevel.h:76:
+^I * to the inode at the same time.$

ERROR: code indent should never use tabs
#2439: FILE: tools/virtiofsd/fuse_lowlevel.h:77:
+^I *$

ERROR: code indent should never use tabs
#2440: FILE: tools/virtiofsd/fuse_lowlevel.h:78:
+^I */$

ERROR: code indent should never use tabs
#2441: FILE: tools/virtiofsd/fuse_lowlevel.h:79:
+^Iuint64_t generation;$

ERROR: code indent should never use tabs
#2443: FILE: tools/virtiofsd/fuse_lowlevel.h:81:
+^I/** Inode attributes.$

WARNING: Block comments use a leading /* on a separate line #2443: FILE: tools/virtiofsd/fuse_lowlevel.h:81:
+ /** Inode attributes.

ERROR: code indent should never use tabs
#2444: FILE: tools/virtiofsd/fuse_lowlevel.h:82:
+^I *$

ERROR: code indent should never use tabs
#2445: FILE: tools/virtiofsd/fuse_lowlevel.h:83:
+^I * Even if attr_timeout == 0, attr must be correct. For example,$

ERROR: code indent should never use tabs
#2446: FILE: tools/virtiofsd/fuse_lowlevel.h:84:
+^I * for open(), FUSE uses attr.st_size from lookup() to determine$

ERROR: code indent should never use tabs
#2447: FILE: tools/virtiofsd/fuse_lowlevel.h:85:
+^I * how many bytes to request. If this value is not correct,$

ERROR: code indent should never use tabs
#2448: FILE: tools/virtiofsd/fuse_lowlevel.h:86:
+^I * incorrect data will be returned.$

ERROR: code indent should never use tabs
#2449: FILE: tools/virtiofsd/fuse_lowlevel.h:87:
+^I */$

ERROR: code indent should never use tabs
#2450: FILE: tools/virtiofsd/fuse_lowlevel.h:88:
+^Istruct stat attr;$

ERROR: code indent should never use tabs
#2452: FILE: tools/virtiofsd/fuse_lowlevel.h:90:
+^I/** Validity timeout (in seconds) for inode attributes. If$

WARNING: Block comments use a leading /* on a separate line #2452: FILE: tools/virtiofsd/fuse_lowlevel.h:90:
+ /** Validity timeout (in seconds) for inode attributes. If

ERROR: code indent should never use tabs
#2453: FILE: tools/virtiofsd/fuse_lowlevel.h:91:
+^I attributes only change as a result of requests that come$

WARNING: Block comments use * on subsequent lines
#2453: FILE: tools/virtiofsd/fuse_lowlevel.h:91:
+ /** Validity timeout (in seconds) for inode attributes. If
+ attributes only change as a result of requests that come

ERROR: code indent should never use tabs
#2454: FILE: tools/virtiofsd/fuse_lowlevel.h:92:
+^I through the kernel, this should be set to a very large$

ERROR: code indent should never use tabs
#2455: FILE: tools/virtiofsd/fuse_lowlevel.h:93:
+^I value. */$

WARNING: Block comments use a trailing */ on a separate line #2455: FILE: tools/virtiofsd/fuse_lowlevel.h:93:
+ value. */

ERROR: code indent should never use tabs
#2456: FILE: tools/virtiofsd/fuse_lowlevel.h:94:
+^Idouble attr_timeout;$

ERROR: code indent should never use tabs
#2458: FILE: tools/virtiofsd/fuse_lowlevel.h:96:
+^I/** Validity timeout (in seconds) for the name. If directory$

WARNING: Block comments use a leading /* on a separate line #2458: FILE: tools/virtiofsd/fuse_lowlevel.h:96:
+ /** Validity timeout (in seconds) for the name. If directory

ERROR: code indent should never use tabs
#2459: FILE: tools/virtiofsd/fuse_lowlevel.h:97:
+^I entries are changed/deleted only as a result of requests$

WARNING: Block comments use * on subsequent lines
#2459: FILE: tools/virtiofsd/fuse_lowlevel.h:97:
+ /** Validity timeout (in seconds) for the name. If directory
+ entries are changed/deleted only as a result of requests

ERROR: code indent should never use tabs
#2460: FILE: tools/virtiofsd/fuse_lowlevel.h:98:
+^I that come through the kernel, this should be set to a very$

ERROR: code indent should never use tabs
#2461: FILE: tools/virtiofsd/fuse_lowlevel.h:99:
+^I large value. */$

WARNING: Block comments use a trailing */ on a separate line #2461: FILE: tools/virtiofsd/fuse_lowlevel.h:99:
+ large value. */

ERROR: code indent should never use tabs
#2462: FILE: tools/virtiofsd/fuse_lowlevel.h:100:
+^Idouble entry_timeout;$

ERROR: code indent should never use tabs
#2474: FILE: tools/virtiofsd/fuse_lowlevel.h:112:
+^I/** User ID of the calling process */$

ERROR: code indent should never use tabs
#2475: FILE: tools/virtiofsd/fuse_lowlevel.h:113:
+^Iuid_t uid;$

ERROR: code indent should never use tabs
#2477: FILE: tools/virtiofsd/fuse_lowlevel.h:115:
+^I/** Group ID of the calling process */$

ERROR: code indent should never use tabs
#2478: FILE: tools/virtiofsd/fuse_lowlevel.h:116:
+^Igid_t gid;$

ERROR: code indent should never use tabs
#2480: FILE: tools/virtiofsd/fuse_lowlevel.h:118:
+^I/** Thread ID of the calling process */$

ERROR: code indent should never use tabs
#2481: FILE: tools/virtiofsd/fuse_lowlevel.h:119:
+^Ipid_t pid;$

ERROR: code indent should never use tabs
#2483: FILE: tools/virtiofsd/fuse_lowlevel.h:121:
+^I/** Umask of the calling process */$

ERROR: code indent should never use tabs
#2484: FILE: tools/virtiofsd/fuse_lowlevel.h:122:
+^Imode_t umask;$

ERROR: code indent should never use tabs
#2488: FILE: tools/virtiofsd/fuse_lowlevel.h:126:
+^Ifuse_ino_t ino;$

ERROR: code indent should never use tabs
#2489: FILE: tools/virtiofsd/fuse_lowlevel.h:127:
+^Iuint64_t nlookup;$

ERROR: code indent should never use tabs
#2493: FILE: tools/virtiofsd/fuse_lowlevel.h:131:
+#define FUSE_SET_ATTR_MODE^I(1 << 0)$

ERROR: code indent should never use tabs
#2494: FILE: tools/virtiofsd/fuse_lowlevel.h:132:
+#define FUSE_SET_ATTR_UID^I(1 << 1)$

ERROR: code indent should never use tabs
#2495: FILE: tools/virtiofsd/fuse_lowlevel.h:133:
+#define FUSE_SET_ATTR_GID^I(1 << 2)$

ERROR: code indent should never use tabs
#2496: FILE: tools/virtiofsd/fuse_lowlevel.h:134:
+#define FUSE_SET_ATTR_SIZE^I(1 << 3)$

ERROR: code indent should never use tabs
#2497: FILE: tools/virtiofsd/fuse_lowlevel.h:135:
+#define FUSE_SET_ATTR_ATIME^I(1 << 4)$

ERROR: code indent should never use tabs
#2498: FILE: tools/virtiofsd/fuse_lowlevel.h:136:
+#define FUSE_SET_ATTR_MTIME^I(1 << 5)$

ERROR: code indent should never use tabs
#2499: FILE: tools/virtiofsd/fuse_lowlevel.h:137:
+#define FUSE_SET_ATTR_ATIME_NOW^I(1 << 7)$

ERROR: code indent should never use tabs
#2500: FILE: tools/virtiofsd/fuse_lowlevel.h:138:
+#define FUSE_SET_ATTR_MTIME_NOW^I(1 << 8)$

ERROR: code indent should never use tabs
#2501: FILE: tools/virtiofsd/fuse_lowlevel.h:139:
+#define FUSE_SET_ATTR_CTIME^I(1 << 10)$

WARNING: Block comments use a leading /* on a separate line #2503: FILE: tools/virtiofsd/fuse_lowlevel.h:141:
+/* ----------------------------------------------------------- *

ERROR: code indent should never use tabs
#2504: FILE: tools/virtiofsd/fuse_lowlevel.h:142:
+ * Request methods and replies^I^I^I^I *$

WARNING: Block comments use a trailing */ on a separate line #2505: FILE: tools/virtiofsd/fuse_lowlevel.h:143:
+ * ----------------------------------------------------------- */

ERROR: code indent should never use tabs
#2535: FILE: tools/virtiofsd/fuse_lowlevel.h:173:
+^I/**$

ERROR: code indent should never use tabs
#2536: FILE: tools/virtiofsd/fuse_lowlevel.h:174:
+^I * Initialize filesystem$

ERROR: code indent should never use tabs
#2537: FILE: tools/virtiofsd/fuse_lowlevel.h:175:
+^I *$

ERROR: code indent should never use tabs #2538: FILE: tools/virtiofsd/fuse_lowlevel.h:176:
+^I * This function is called when libfuse establishes$

ERROR: code indent should never use tabs
#2539: FILE: tools/virtiofsd/fuse_lowlevel.h:177:
+^I * communication with the FUSE kernel module. The file system$

ERROR: code indent should never use tabs
#2540: FILE: tools/virtiofsd/fuse_lowlevel.h:178:
+^I * should use this module to inspect and/or modify the$

ERROR: code indent should never use tabs
#2541: FILE: tools/virtiofsd/fuse_lowlevel.h:179:
+^I * connection parameters provided in the conn structure.$

ERROR: code indent should never use tabs
#2542: FILE: tools/virtiofsd/fuse_lowlevel.h:180:
+^I *$

ERROR: code indent should never use tabs
#2543: FILE: tools/virtiofsd/fuse_lowlevel.h:181:
+^I * Note that some parameters may be overwritten by options$

ERROR: code indent should never use tabs
#2544: FILE: tools/virtiofsd/fuse_lowlevel.h:182:
+^I * passed to fuse_session_new() which take precedence over the$

ERROR: code indent should never use tabs
#2545: FILE: tools/virtiofsd/fuse_lowlevel.h:183:
+^I * values set in this handler.$

ERROR: code indent should never use tabs
#2546: FILE: tools/virtiofsd/fuse_lowlevel.h:184:
+^I *$

ERROR: code indent should never use tabs
#2547: FILE: tools/virtiofsd/fuse_lowlevel.h:185:
+^I * There's no reply to this function$

ERROR: code indent should never use tabs
#2548: FILE: tools/virtiofsd/fuse_lowlevel.h:186:
+^I *$

ERROR: code indent should never use tabs
#2549: FILE: tools/virtiofsd/fuse_lowlevel.h:187:
+^I * @param userdata the user data passed to fuse_session_new()$

ERROR: code indent should never use tabs
#2550: FILE: tools/virtiofsd/fuse_lowlevel.h:188:
+^I */$

ERROR: code indent should never use tabs
#2551: FILE: tools/virtiofsd/fuse_lowlevel.h:189:
+^Ivoid (*init) (void *userdata, struct fuse_conn_info *conn);$

ERROR: code indent should never use tabs
#2553: FILE: tools/virtiofsd/fuse_lowlevel.h:191:
+^I/**$

ERROR: code indent should never use tabs
#2554: FILE: tools/virtiofsd/fuse_lowlevel.h:192:
+^I * Clean up filesystem.$

ERROR: code indent should never use tabs
#2555: FILE: tools/virtiofsd/fuse_lowlevel.h:193:
+^I *$

ERROR: code indent should never use tabs
#2556: FILE: tools/virtiofsd/fuse_lowlevel.h:194:
+^I * Called on filesystem exit. When this method is called, the$

ERROR: code indent should never use tabs
#2557: FILE: tools/virtiofsd/fuse_lowlevel.h:195:
+^I * connection to the kernel may be gone already, so that eg. calls$

ERROR: code indent should never use tabs
#2558: FILE: tools/virtiofsd/fuse_lowlevel.h:196:
+^I * to fuse_lowlevel_notify_* will fail.$

ERROR: code indent should never use tabs
#2559: FILE: tools/virtiofsd/fuse_lowlevel.h:197:
+^I *$

ERROR: code indent should never use tabs
#2560: FILE: tools/virtiofsd/fuse_lowlevel.h:198:
+^I * There's no reply to this function$

ERROR: code indent should never use tabs
#2561: FILE: tools/virtiofsd/fuse_lowlevel.h:199:
+^I *$

ERROR: code indent should never use tabs
#2562: FILE: tools/virtiofsd/fuse_lowlevel.h:200:
+^I * @param userdata the user data passed to fuse_session_new()$

ERROR: code indent should never use tabs
#2563: FILE: tools/virtiofsd/fuse_lowlevel.h:201:
+^I */$

ERROR: code indent should never use tabs
#2564: FILE: tools/virtiofsd/fuse_lowlevel.h:202:
+^Ivoid (*destroy) (void *userdata);$

ERROR: code indent should never use tabs
#2566: FILE: tools/virtiofsd/fuse_lowlevel.h:204:
+^I/**$

ERROR: code indent should never use tabs
#2567: FILE: tools/virtiofsd/fuse_lowlevel.h:205:
+^I * Look up a directory entry by name and get its attributes.$

ERROR: code indent should never use tabs
#2568: FILE: tools/virtiofsd/fuse_lowlevel.h:206:
+^I *$

ERROR: code indent should never use tabs
#2569: FILE: tools/virtiofsd/fuse_lowlevel.h:207:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2570: FILE: tools/virtiofsd/fuse_lowlevel.h:208:
+^I * fuse_reply_entry$

ERROR: code indent should never use tabs
#2571: FILE: tools/virtiofsd/fuse_lowlevel.h:209:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2572: FILE: tools/virtiofsd/fuse_lowlevel.h:210:
+^I *$

ERROR: code indent should never use tabs
#2573: FILE: tools/virtiofsd/fuse_lowlevel.h:211:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2574: FILE: tools/virtiofsd/fuse_lowlevel.h:212:
+^I * @param parent inode number of the parent directory$

ERROR: code indent should never use tabs
#2575: FILE: tools/virtiofsd/fuse_lowlevel.h:213:
+^I * @param name the name to look up$

ERROR: code indent should never use tabs
#2576: FILE: tools/virtiofsd/fuse_lowlevel.h:214:
+^I */$

ERROR: code indent should never use tabs
#2577: FILE: tools/virtiofsd/fuse_lowlevel.h:215:
+^Ivoid (*lookup) (fuse_req_t req, fuse_ino_t parent, const char *name);$

ERROR: code indent should never use tabs
#2579: FILE: tools/virtiofsd/fuse_lowlevel.h:217:
+^I/**$

ERROR: code indent should never use tabs
#2580: FILE: tools/virtiofsd/fuse_lowlevel.h:218:
+^I * Forget about an inode$

ERROR: code indent should never use tabs
#2581: FILE: tools/virtiofsd/fuse_lowlevel.h:219:
+^I *$

ERROR: code indent should never use tabs
#2582: FILE: tools/virtiofsd/fuse_lowlevel.h:220:
+^I * This function is called when the kernel removes an inode$

ERROR: code indent should never use tabs
#2583: FILE: tools/virtiofsd/fuse_lowlevel.h:221:
+^I * from its internal caches.$

ERROR: code indent should never use tabs
#2584: FILE: tools/virtiofsd/fuse_lowlevel.h:222:
+^I *$

ERROR: code indent should never use tabs
#2585: FILE: tools/virtiofsd/fuse_lowlevel.h:223:
+^I * The inode's lookup count increases by one for every call to$

ERROR: code indent should never use tabs
#2586: FILE: tools/virtiofsd/fuse_lowlevel.h:224:
+^I * fuse_reply_entry and fuse_reply_create. The nlookup parameter$

ERROR: code indent should never use tabs
#2587: FILE: tools/virtiofsd/fuse_lowlevel.h:225:
+^I * indicates by how much the lookup count should be decreased.$

ERROR: code indent should never use tabs
#2588: FILE: tools/virtiofsd/fuse_lowlevel.h:226:
+^I *$

ERROR: code indent should never use tabs
#2589: FILE: tools/virtiofsd/fuse_lowlevel.h:227:
+^I * Inodes with a non-zero lookup count may receive request from$

ERROR: code indent should never use tabs
#2590: FILE: tools/virtiofsd/fuse_lowlevel.h:228:
+^I * the kernel even after calls to unlink, rmdir or (when$

ERROR: code indent should never use tabs
#2591: FILE: tools/virtiofsd/fuse_lowlevel.h:229:
+^I * overwriting an existing file) rename. Filesystems must handle$

ERROR: code indent should never use tabs
#2592: FILE: tools/virtiofsd/fuse_lowlevel.h:230:
+^I * such requests properly and it is recommended to defer removal$

ERROR: code indent should never use tabs
#2593: FILE: tools/virtiofsd/fuse_lowlevel.h:231:
+^I * of the inode until the lookup count reaches zero. Calls to$

ERROR: code indent should never use tabs
#2594: FILE: tools/virtiofsd/fuse_lowlevel.h:232:
+^I * unlink, rmdir or rename will be followed closely by forget$

ERROR: code indent should never use tabs
#2595: FILE: tools/virtiofsd/fuse_lowlevel.h:233:
+^I * unless the file or directory is open, in which case the$

ERROR: code indent should never use tabs
#2596: FILE: tools/virtiofsd/fuse_lowlevel.h:234:
+^I * kernel issues forget only after the release or releasedir$

ERROR: code indent should never use tabs
#2597: FILE: tools/virtiofsd/fuse_lowlevel.h:235:
+^I * calls.$

ERROR: code indent should never use tabs
#2598: FILE: tools/virtiofsd/fuse_lowlevel.h:236:
+^I *$

ERROR: code indent should never use tabs
#2599: FILE: tools/virtiofsd/fuse_lowlevel.h:237:
+^I * Note that if a file system will be exported over NFS the$

ERROR: code indent should never use tabs
#2600: FILE: tools/virtiofsd/fuse_lowlevel.h:238:
+^I * inodes lifetime must extend even beyond forget. See the$

ERROR: code indent should never use tabs
#2601: FILE: tools/virtiofsd/fuse_lowlevel.h:239:
+^I * generation field in struct fuse_entry_param above.$

ERROR: code indent should never use tabs
#2602: FILE: tools/virtiofsd/fuse_lowlevel.h:240:
+^I *$

ERROR: code indent should never use tabs
#2603: FILE: tools/virtiofsd/fuse_lowlevel.h:241:
+^I * On unmount the lookup count for all inodes implicitly drops$

ERROR: code indent should never use tabs
#2604: FILE: tools/virtiofsd/fuse_lowlevel.h:242:
+^I * to zero. It is not guaranteed that the file system will$

ERROR: code indent should never use tabs
#2605: FILE: tools/virtiofsd/fuse_lowlevel.h:243:
+^I * receive corresponding forget messages for the affected$

ERROR: code indent should never use tabs
#2606: FILE: tools/virtiofsd/fuse_lowlevel.h:244:
+^I * inodes.$

ERROR: code indent should never use tabs
#2607: FILE: tools/virtiofsd/fuse_lowlevel.h:245:
+^I *$

ERROR: code indent should never use tabs
#2608: FILE: tools/virtiofsd/fuse_lowlevel.h:246:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2609: FILE: tools/virtiofsd/fuse_lowlevel.h:247:
+^I * fuse_reply_none$

ERROR: code indent should never use tabs
#2610: FILE: tools/virtiofsd/fuse_lowlevel.h:248:
+^I *$

ERROR: code indent should never use tabs
#2611: FILE: tools/virtiofsd/fuse_lowlevel.h:249:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2612: FILE: tools/virtiofsd/fuse_lowlevel.h:250:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs #2613: FILE: tools/virtiofsd/fuse_lowlevel.h:251:
+^I * @param nlookup the number of lookups to forget$

ERROR: code indent should never use tabs
#2614: FILE: tools/virtiofsd/fuse_lowlevel.h:252:
+^I */$

ERROR: code indent should never use tabs
#2615: FILE: tools/virtiofsd/fuse_lowlevel.h:253:
+^Ivoid (*forget) (fuse_req_t req, fuse_ino_t ino, uint64_t nlookup);$

ERROR: code indent should never use tabs
#2617: FILE: tools/virtiofsd/fuse_lowlevel.h:255:
+^I/**$

ERROR: code indent should never use tabs
#2618: FILE: tools/virtiofsd/fuse_lowlevel.h:256:
+^I * Get file attributes.$

ERROR: code indent should never use tabs
#2619: FILE: tools/virtiofsd/fuse_lowlevel.h:257:
+^I *$

ERROR: code indent should never use tabs
#2620: FILE: tools/virtiofsd/fuse_lowlevel.h:258:
+^I * If writeback caching is enabled, the kernel may have a$

ERROR: code indent should never use tabs
#2621: FILE: tools/virtiofsd/fuse_lowlevel.h:259:
+^I * better idea of a file's length than the FUSE file system$

ERROR: code indent should never use tabs
#2622: FILE: tools/virtiofsd/fuse_lowlevel.h:260:
+^I * (eg if there has been a write that extended the file size,$

ERROR: code indent should never use tabs
#2623: FILE: tools/virtiofsd/fuse_lowlevel.h:261:
+^I * but that has not yet been passed to the filesystem.n$

ERROR: code indent should never use tabs
#2624: FILE: tools/virtiofsd/fuse_lowlevel.h:262:
+^I *$

ERROR: code indent should never use tabs
#2625: FILE: tools/virtiofsd/fuse_lowlevel.h:263:
+^I * In this case, the st_size value provided by the file system$

ERROR: code indent should never use tabs
#2626: FILE: tools/virtiofsd/fuse_lowlevel.h:264:
+^I * will be ignored.$

ERROR: code indent should never use tabs
#2627: FILE: tools/virtiofsd/fuse_lowlevel.h:265:
+^I *$

ERROR: code indent should never use tabs
#2628: FILE: tools/virtiofsd/fuse_lowlevel.h:266:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2629: FILE: tools/virtiofsd/fuse_lowlevel.h:267:
+^I * fuse_reply_attr$

ERROR: code indent should never use tabs
#2630: FILE: tools/virtiofsd/fuse_lowlevel.h:268:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2631: FILE: tools/virtiofsd/fuse_lowlevel.h:269:
+^I *$

ERROR: code indent should never use tabs
#2632: FILE: tools/virtiofsd/fuse_lowlevel.h:270:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2633: FILE: tools/virtiofsd/fuse_lowlevel.h:271:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs #2634: FILE: tools/virtiofsd/fuse_lowlevel.h:272:
+^I * @param fi for future use, currently always NULL$

ERROR: code indent should never use tabs
#2635: FILE: tools/virtiofsd/fuse_lowlevel.h:273:
+^I */$

ERROR: code indent should never use tabs #2636: FILE: tools/virtiofsd/fuse_lowlevel.h:274:
+^Ivoid (*getattr) (fuse_req_t req, fuse_ino_t ino,$

ERROR: code indent should never use tabs
#2637: FILE: tools/virtiofsd/fuse_lowlevel.h:275:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2639: FILE: tools/virtiofsd/fuse_lowlevel.h:277:
+^I/**$

ERROR: code indent should never use tabs
#2640: FILE: tools/virtiofsd/fuse_lowlevel.h:278:
+^I * Set file attributes$

ERROR: code indent should never use tabs
#2641: FILE: tools/virtiofsd/fuse_lowlevel.h:279:
+^I *$

ERROR: code indent should never use tabs
#2642: FILE: tools/virtiofsd/fuse_lowlevel.h:280:
+^I * In the 'attr' argument only members indicated by the 'to_set'$

ERROR: code indent should never use tabs
#2643: FILE: tools/virtiofsd/fuse_lowlevel.h:281:
+^I * bitmask contain valid values. Other members contain undefined$

ERROR: code indent should never use tabs
#2644: FILE: tools/virtiofsd/fuse_lowlevel.h:282:
+^I * values.$

ERROR: code indent should never use tabs
#2645: FILE: tools/virtiofsd/fuse_lowlevel.h:283:
+^I *$

ERROR: code indent should never use tabs
#2646: FILE: tools/virtiofsd/fuse_lowlevel.h:284:
+^I * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is$

ERROR: code indent should never use tabs
#2647: FILE: tools/virtiofsd/fuse_lowlevel.h:285:
+^I * expected to reset the setuid and setgid bits if the file$

ERROR: code indent should never use tabs
#2648: FILE: tools/virtiofsd/fuse_lowlevel.h:286:
+^I * size or owner is being changed.$

ERROR: code indent should never use tabs
#2649: FILE: tools/virtiofsd/fuse_lowlevel.h:287:
+^I *$

ERROR: code indent should never use tabs
#2650: FILE: tools/virtiofsd/fuse_lowlevel.h:288:
+^I * If the setattr was invoked from the ftruncate() system call$

ERROR: code indent should never use tabs
#2651: FILE: tools/virtiofsd/fuse_lowlevel.h:289:
+^I * under Linux kernel versions 2.6.15 or later, the fi->fh will$

ERROR: code indent should never use tabs
#2652: FILE: tools/virtiofsd/fuse_lowlevel.h:290:
+^I * contain the value set by the open method or will be undefined$

ERROR: code indent should never use tabs
#2653: FILE: tools/virtiofsd/fuse_lowlevel.h:291:
+^I * if the open method didn't set any value. Otherwise (not$

ERROR: code indent should never use tabs
#2654: FILE: tools/virtiofsd/fuse_lowlevel.h:292:
+^I * ftruncate call, or kernel version earlier than 2.6.15) the fi$

ERROR: code indent should never use tabs
#2655: FILE: tools/virtiofsd/fuse_lowlevel.h:293:
+^I * parameter will be NULL.$

ERROR: code indent should never use tabs
#2656: FILE: tools/virtiofsd/fuse_lowlevel.h:294:
+^I *$

ERROR: code indent should never use tabs
#2657: FILE: tools/virtiofsd/fuse_lowlevel.h:295:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2658: FILE: tools/virtiofsd/fuse_lowlevel.h:296:
+^I * fuse_reply_attr$

ERROR: code indent should never use tabs
#2659: FILE: tools/virtiofsd/fuse_lowlevel.h:297:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2660: FILE: tools/virtiofsd/fuse_lowlevel.h:298:
+^I *$

ERROR: code indent should never use tabs
#2661: FILE: tools/virtiofsd/fuse_lowlevel.h:299:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2662: FILE: tools/virtiofsd/fuse_lowlevel.h:300:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2663: FILE: tools/virtiofsd/fuse_lowlevel.h:301:
+^I * @param attr the attributes$

ERROR: code indent should never use tabs
#2664: FILE: tools/virtiofsd/fuse_lowlevel.h:302:
+^I * @param to_set bit mask of attributes which should be set$

ERROR: code indent should never use tabs
#2665: FILE: tools/virtiofsd/fuse_lowlevel.h:303:
+^I * @param fi file information, or NULL$

ERROR: code indent should never use tabs
#2666: FILE: tools/virtiofsd/fuse_lowlevel.h:304:
+^I */$

ERROR: code indent should never use tabs
#2667: FILE: tools/virtiofsd/fuse_lowlevel.h:305:
+^Ivoid (*setattr) (fuse_req_t req, fuse_ino_t ino, struct stat *attr,$

ERROR: code indent should never use tabs
#2668: FILE: tools/virtiofsd/fuse_lowlevel.h:306:
+^I^I^I int to_set, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2670: FILE: tools/virtiofsd/fuse_lowlevel.h:308:
+^I/**$

ERROR: code indent should never use tabs
#2671: FILE: tools/virtiofsd/fuse_lowlevel.h:309:
+^I * Read symbolic link$

ERROR: code indent should never use tabs
#2672: FILE: tools/virtiofsd/fuse_lowlevel.h:310:
+^I *$

ERROR: code indent should never use tabs
#2673: FILE: tools/virtiofsd/fuse_lowlevel.h:311:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2674: FILE: tools/virtiofsd/fuse_lowlevel.h:312:
+^I * fuse_reply_readlink$

ERROR: code indent should never use tabs
#2675: FILE: tools/virtiofsd/fuse_lowlevel.h:313:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2676: FILE: tools/virtiofsd/fuse_lowlevel.h:314:
+^I *$

ERROR: code indent should never use tabs
#2677: FILE: tools/virtiofsd/fuse_lowlevel.h:315:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2678: FILE: tools/virtiofsd/fuse_lowlevel.h:316:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2679: FILE: tools/virtiofsd/fuse_lowlevel.h:317:
+^I */$

ERROR: code indent should never use tabs #2680: FILE: tools/virtiofsd/fuse_lowlevel.h:318:
+^Ivoid (*readlink) (fuse_req_t req, fuse_ino_t ino);$

ERROR: code indent should never use tabs
#2682: FILE: tools/virtiofsd/fuse_lowlevel.h:320:
+^I/**$

ERROR: code indent should never use tabs
#2683: FILE: tools/virtiofsd/fuse_lowlevel.h:321:
+^I * Create file node$

ERROR: code indent should never use tabs
#2684: FILE: tools/virtiofsd/fuse_lowlevel.h:322:
+^I *$

ERROR: code indent should never use tabs
#2685: FILE: tools/virtiofsd/fuse_lowlevel.h:323:
+^I * Create a regular file, character device, block device, fifo or$

ERROR: code indent should never use tabs
#2686: FILE: tools/virtiofsd/fuse_lowlevel.h:324:
+^I * socket node.$

ERROR: code indent should never use tabs
#2687: FILE: tools/virtiofsd/fuse_lowlevel.h:325:
+^I *$

ERROR: code indent should never use tabs
#2688: FILE: tools/virtiofsd/fuse_lowlevel.h:326:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2689: FILE: tools/virtiofsd/fuse_lowlevel.h:327:
+^I * fuse_reply_entry$

ERROR: code indent should never use tabs
#2690: FILE: tools/virtiofsd/fuse_lowlevel.h:328:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2691: FILE: tools/virtiofsd/fuse_lowlevel.h:329:
+^I *$

ERROR: code indent should never use tabs
#2692: FILE: tools/virtiofsd/fuse_lowlevel.h:330:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2693: FILE: tools/virtiofsd/fuse_lowlevel.h:331:
+^I * @param parent inode number of the parent directory$

ERROR: code indent should never use tabs
#2694: FILE: tools/virtiofsd/fuse_lowlevel.h:332:
+^I * @param name to create$

ERROR: code indent should never use tabs
#2695: FILE: tools/virtiofsd/fuse_lowlevel.h:333:
+^I * @param mode file type and mode with which to create the new file$

WARNING: line over 80 characters
#2696: FILE: tools/virtiofsd/fuse_lowlevel.h:334:
+ * @param rdev the device number (only valid if created file is a device)

ERROR: code indent should never use tabs
#2696: FILE: tools/virtiofsd/fuse_lowlevel.h:334:
+^I * @param rdev the device number (only valid if created file is a device)$

ERROR: code indent should never use tabs
#2697: FILE: tools/virtiofsd/fuse_lowlevel.h:335:
+^I */$

ERROR: code indent should never use tabs
#2698: FILE: tools/virtiofsd/fuse_lowlevel.h:336:
+^Ivoid (*mknod) (fuse_req_t req, fuse_ino_t parent, const char *name,$

ERROR: code indent should never use tabs
#2699: FILE: tools/virtiofsd/fuse_lowlevel.h:337:
+^I^I mode_t mode, dev_t rdev);$

ERROR: code indent should never use tabs
#2701: FILE: tools/virtiofsd/fuse_lowlevel.h:339:
+^I/**$

ERROR: code indent should never use tabs
#2702: FILE: tools/virtiofsd/fuse_lowlevel.h:340:
+^I * Create a directory$

ERROR: code indent should never use tabs
#2703: FILE: tools/virtiofsd/fuse_lowlevel.h:341:
+^I *$

ERROR: code indent should never use tabs
#2704: FILE: tools/virtiofsd/fuse_lowlevel.h:342:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2705: FILE: tools/virtiofsd/fuse_lowlevel.h:343:
+^I * fuse_reply_entry$

ERROR: code indent should never use tabs
#2706: FILE: tools/virtiofsd/fuse_lowlevel.h:344:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2707: FILE: tools/virtiofsd/fuse_lowlevel.h:345:
+^I *$

ERROR: code indent should never use tabs
#2708: FILE: tools/virtiofsd/fuse_lowlevel.h:346:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2709: FILE: tools/virtiofsd/fuse_lowlevel.h:347:
+^I * @param parent inode number of the parent directory$

ERROR: code indent should never use tabs
#2710: FILE: tools/virtiofsd/fuse_lowlevel.h:348:
+^I * @param name to create$

ERROR: code indent should never use tabs #2711: FILE: tools/virtiofsd/fuse_lowlevel.h:349:
+^I * @param mode with which to create the new file$

ERROR: code indent should never use tabs
#2712: FILE: tools/virtiofsd/fuse_lowlevel.h:350:
+^I */$

ERROR: code indent should never use tabs
#2713: FILE: tools/virtiofsd/fuse_lowlevel.h:351:
+^Ivoid (*mkdir) (fuse_req_t req, fuse_ino_t parent, const char *name,$

ERROR: code indent should never use tabs
#2714: FILE: tools/virtiofsd/fuse_lowlevel.h:352:
+^I^I mode_t mode);$

ERROR: code indent should never use tabs
#2716: FILE: tools/virtiofsd/fuse_lowlevel.h:354:
+^I/**$

ERROR: code indent should never use tabs
#2717: FILE: tools/virtiofsd/fuse_lowlevel.h:355:
+^I * Remove a file$

ERROR: code indent should never use tabs
#2718: FILE: tools/virtiofsd/fuse_lowlevel.h:356:
+^I *$

ERROR: code indent should never use tabs
#2719: FILE: tools/virtiofsd/fuse_lowlevel.h:357:
+^I * If the file's inode's lookup count is non-zero, the file$

ERROR: code indent should never use tabs
#2720: FILE: tools/virtiofsd/fuse_lowlevel.h:358:
+^I * system is expected to postpone any removal of the inode$

ERROR: code indent should never use tabs
#2721: FILE: tools/virtiofsd/fuse_lowlevel.h:359:
+^I * until the lookup count reaches zero (see description of the$

ERROR: code indent should never use tabs
#2722: FILE: tools/virtiofsd/fuse_lowlevel.h:360:
+^I * forget function).$

ERROR: code indent should never use tabs
#2723: FILE: tools/virtiofsd/fuse_lowlevel.h:361:
+^I *$

ERROR: code indent should never use tabs
#2724: FILE: tools/virtiofsd/fuse_lowlevel.h:362:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2725: FILE: tools/virtiofsd/fuse_lowlevel.h:363:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2726: FILE: tools/virtiofsd/fuse_lowlevel.h:364:
+^I *$

ERROR: code indent should never use tabs
#2727: FILE: tools/virtiofsd/fuse_lowlevel.h:365:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2728: FILE: tools/virtiofsd/fuse_lowlevel.h:366:
+^I * @param parent inode number of the parent directory$

ERROR: code indent should never use tabs
#2729: FILE: tools/virtiofsd/fuse_lowlevel.h:367:
+^I * @param name to remove$

ERROR: code indent should never use tabs
#2730: FILE: tools/virtiofsd/fuse_lowlevel.h:368:
+^I */$

ERROR: code indent should never use tabs
#2731: FILE: tools/virtiofsd/fuse_lowlevel.h:369:
+^Ivoid (*unlink) (fuse_req_t req, fuse_ino_t parent, const char *name);$

ERROR: code indent should never use tabs
#2733: FILE: tools/virtiofsd/fuse_lowlevel.h:371:
+^I/**$

ERROR: code indent should never use tabs
#2734: FILE: tools/virtiofsd/fuse_lowlevel.h:372:
+^I * Remove a directory$

ERROR: code indent should never use tabs
#2735: FILE: tools/virtiofsd/fuse_lowlevel.h:373:
+^I *$

ERROR: code indent should never use tabs
#2736: FILE: tools/virtiofsd/fuse_lowlevel.h:374:
+^I * If the directory's inode's lookup count is non-zero, the$

ERROR: code indent should never use tabs
#2737: FILE: tools/virtiofsd/fuse_lowlevel.h:375:
+^I * file system is expected to postpone any removal of the$

ERROR: code indent should never use tabs
#2738: FILE: tools/virtiofsd/fuse_lowlevel.h:376:
+^I * inode until the lookup count reaches zero (see description$

ERROR: code indent should never use tabs
#2739: FILE: tools/virtiofsd/fuse_lowlevel.h:377:
+^I * of the forget function).$

ERROR: code indent should never use tabs
#2740: FILE: tools/virtiofsd/fuse_lowlevel.h:378:
+^I *$

ERROR: code indent should never use tabs
#2741: FILE: tools/virtiofsd/fuse_lowlevel.h:379:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2742: FILE: tools/virtiofsd/fuse_lowlevel.h:380:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2743: FILE: tools/virtiofsd/fuse_lowlevel.h:381:
+^I *$

ERROR: code indent should never use tabs
#2744: FILE: tools/virtiofsd/fuse_lowlevel.h:382:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2745: FILE: tools/virtiofsd/fuse_lowlevel.h:383:
+^I * @param parent inode number of the parent directory$

ERROR: code indent should never use tabs
#2746: FILE: tools/virtiofsd/fuse_lowlevel.h:384:
+^I * @param name to remove$

ERROR: code indent should never use tabs
#2747: FILE: tools/virtiofsd/fuse_lowlevel.h:385:
+^I */$

ERROR: code indent should never use tabs
#2748: FILE: tools/virtiofsd/fuse_lowlevel.h:386:
+^Ivoid (*rmdir) (fuse_req_t req, fuse_ino_t parent, const char *name);$

ERROR: code indent should never use tabs
#2750: FILE: tools/virtiofsd/fuse_lowlevel.h:388:
+^I/**$

ERROR: code indent should never use tabs
#2751: FILE: tools/virtiofsd/fuse_lowlevel.h:389:
+^I * Create a symbolic link$

ERROR: code indent should never use tabs
#2752: FILE: tools/virtiofsd/fuse_lowlevel.h:390:
+^I *$

ERROR: code indent should never use tabs
#2753: FILE: tools/virtiofsd/fuse_lowlevel.h:391:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2754: FILE: tools/virtiofsd/fuse_lowlevel.h:392:
+^I * fuse_reply_entry$

ERROR: code indent should never use tabs
#2755: FILE: tools/virtiofsd/fuse_lowlevel.h:393:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2756: FILE: tools/virtiofsd/fuse_lowlevel.h:394:
+^I *$

ERROR: code indent should never use tabs
#2757: FILE: tools/virtiofsd/fuse_lowlevel.h:395:
+^I * @param req request handle$

ERROR: code indent should never use tabs #2758: FILE: tools/virtiofsd/fuse_lowlevel.h:396:
+^I * @param link the contents of the symbolic link$

ERROR: code indent should never use tabs
#2759: FILE: tools/virtiofsd/fuse_lowlevel.h:397:
+^I * @param parent inode number of the parent directory$

ERROR: code indent should never use tabs
#2760: FILE: tools/virtiofsd/fuse_lowlevel.h:398:
+^I * @param name to create$

ERROR: code indent should never use tabs
#2761: FILE: tools/virtiofsd/fuse_lowlevel.h:399:
+^I */$

ERROR: code indent should never use tabs
#2762: FILE: tools/virtiofsd/fuse_lowlevel.h:400:
+^Ivoid (*symlink) (fuse_req_t req, const char *link, fuse_ino_t parent,$

ERROR: code indent should never use tabs
#2763: FILE: tools/virtiofsd/fuse_lowlevel.h:401:
+^I^I^I const char *name);$

ERROR: code indent should never use tabs
#2765: FILE: tools/virtiofsd/fuse_lowlevel.h:403:
+^I/** Rename a file$

WARNING: Block comments use a leading /* on a separate line #2765: FILE: tools/virtiofsd/fuse_lowlevel.h:403:
+ /** Rename a file

ERROR: code indent should never use tabs
#2766: FILE: tools/virtiofsd/fuse_lowlevel.h:404:
+^I *$

ERROR: code indent should never use tabs
#2767: FILE: tools/virtiofsd/fuse_lowlevel.h:405:
+^I * If the target exists it should be atomically replaced. If$

ERROR: code indent should never use tabs
#2768: FILE: tools/virtiofsd/fuse_lowlevel.h:406:
+^I * the target's inode's lookup count is non-zero, the file$

ERROR: code indent should never use tabs
#2769: FILE: tools/virtiofsd/fuse_lowlevel.h:407:
+^I * system is expected to postpone any removal of the inode$

ERROR: code indent should never use tabs
#2770: FILE: tools/virtiofsd/fuse_lowlevel.h:408:
+^I * until the lookup count reaches zero (see description of the$

ERROR: code indent should never use tabs
#2771: FILE: tools/virtiofsd/fuse_lowlevel.h:409:
+^I * forget function).$

ERROR: code indent should never use tabs
#2772: FILE: tools/virtiofsd/fuse_lowlevel.h:410:
+^I *$

ERROR: code indent should never use tabs
#2773: FILE: tools/virtiofsd/fuse_lowlevel.h:411:
+^I * If this request is answered with an error code of ENOSYS, this is$

ERROR: code indent should never use tabs
#2774: FILE: tools/virtiofsd/fuse_lowlevel.h:412:
+^I * treated as a permanent failure with error code EINVAL, i.e. all$

ERROR: code indent should never use tabs
#2775: FILE: tools/virtiofsd/fuse_lowlevel.h:413:
+^I * future bmap requests will fail with EINVAL without being$

ERROR: code indent should never use tabs
#2776: FILE: tools/virtiofsd/fuse_lowlevel.h:414:
+^I * send to the filesystem process.$

ERROR: code indent should never use tabs
#2777: FILE: tools/virtiofsd/fuse_lowlevel.h:415:
+^I *$

ERROR: code indent should never use tabs
#2778: FILE: tools/virtiofsd/fuse_lowlevel.h:416:
+^I * *flags* may be RENAME_EXCHANGE or RENAME_NOREPLACE. If$

ERROR: code indent should never use tabs
#2779: FILE: tools/virtiofsd/fuse_lowlevel.h:417:
+^I * RENAME_NOREPLACE is specified, the filesystem must not$

ERROR: code indent should never use tabs
#2780: FILE: tools/virtiofsd/fuse_lowlevel.h:418:
+^I * overwrite *newname* if it exists and return an error$

ERROR: code indent should never use tabs
#2781: FILE: tools/virtiofsd/fuse_lowlevel.h:419:
+^I * instead. If RENAME_EXCHANGE is specified, the filesystem$

ERROR: code indent should never use tabs
#2782: FILE: tools/virtiofsd/fuse_lowlevel.h:420:
+^I * must atomically exchange the two files, i.e. both must$

ERROR: code indent should never use tabs
#2783: FILE: tools/virtiofsd/fuse_lowlevel.h:421:
+^I * exist and neither may be deleted.$

ERROR: code indent should never use tabs
#2784: FILE: tools/virtiofsd/fuse_lowlevel.h:422:
+^I *$

ERROR: code indent should never use tabs
#2785: FILE: tools/virtiofsd/fuse_lowlevel.h:423:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2786: FILE: tools/virtiofsd/fuse_lowlevel.h:424:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2787: FILE: tools/virtiofsd/fuse_lowlevel.h:425:
+^I *$

ERROR: code indent should never use tabs
#2788: FILE: tools/virtiofsd/fuse_lowlevel.h:426:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2789: FILE: tools/virtiofsd/fuse_lowlevel.h:427:
+^I * @param parent inode number of the old parent directory$

ERROR: code indent should never use tabs
#2790: FILE: tools/virtiofsd/fuse_lowlevel.h:428:
+^I * @param name old name$

ERROR: code indent should never use tabs
#2791: FILE: tools/virtiofsd/fuse_lowlevel.h:429:
+^I * @param newparent inode number of the new parent directory$

ERROR: code indent should never use tabs
#2792: FILE: tools/virtiofsd/fuse_lowlevel.h:430:
+^I * @param newname new name$

ERROR: code indent should never use tabs
#2793: FILE: tools/virtiofsd/fuse_lowlevel.h:431:
+^I */$

ERROR: code indent should never use tabs
#2794: FILE: tools/virtiofsd/fuse_lowlevel.h:432:
+^Ivoid (*rename) (fuse_req_t req, fuse_ino_t parent, const char *name,$

ERROR: code indent should never use tabs #2795: FILE: tools/virtiofsd/fuse_lowlevel.h:433:
+^I^I^Ifuse_ino_t newparent, const char *newname,$

ERROR: code indent should never use tabs
#2796: FILE: tools/virtiofsd/fuse_lowlevel.h:434:
+^I^I^Iunsigned int flags);$

ERROR: code indent should never use tabs
#2798: FILE: tools/virtiofsd/fuse_lowlevel.h:436:
+^I/**$

ERROR: code indent should never use tabs
#2799: FILE: tools/virtiofsd/fuse_lowlevel.h:437:
+^I * Create a hard link$

ERROR: code indent should never use tabs
#2800: FILE: tools/virtiofsd/fuse_lowlevel.h:438:
+^I *$

ERROR: code indent should never use tabs
#2801: FILE: tools/virtiofsd/fuse_lowlevel.h:439:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2802: FILE: tools/virtiofsd/fuse_lowlevel.h:440:
+^I * fuse_reply_entry$

ERROR: code indent should never use tabs
#2803: FILE: tools/virtiofsd/fuse_lowlevel.h:441:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2804: FILE: tools/virtiofsd/fuse_lowlevel.h:442:
+^I *$

ERROR: code indent should never use tabs
#2805: FILE: tools/virtiofsd/fuse_lowlevel.h:443:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2806: FILE: tools/virtiofsd/fuse_lowlevel.h:444:
+^I * @param ino the old inode number$

ERROR: code indent should never use tabs
#2807: FILE: tools/virtiofsd/fuse_lowlevel.h:445:
+^I * @param newparent inode number of the new parent directory$

ERROR: code indent should never use tabs
#2808: FILE: tools/virtiofsd/fuse_lowlevel.h:446:
+^I * @param newname new name to create$

ERROR: code indent should never use tabs
#2809: FILE: tools/virtiofsd/fuse_lowlevel.h:447:
+^I */$

ERROR: code indent should never use tabs
#2810: FILE: tools/virtiofsd/fuse_lowlevel.h:448:
+^Ivoid (*link) (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,$

ERROR: code indent should never use tabs
#2811: FILE: tools/virtiofsd/fuse_lowlevel.h:449:
+^I^I const char *newname);$

ERROR: code indent should never use tabs
#2813: FILE: tools/virtiofsd/fuse_lowlevel.h:451:
+^I/**$

ERROR: code indent should never use tabs
#2814: FILE: tools/virtiofsd/fuse_lowlevel.h:452:
+^I * Open a file$

ERROR: code indent should never use tabs
#2815: FILE: tools/virtiofsd/fuse_lowlevel.h:453:
+^I *$

ERROR: code indent should never use tabs
#2816: FILE: tools/virtiofsd/fuse_lowlevel.h:454:
+^I * Open flags are available in fi->flags. The following rules$

ERROR: code indent should never use tabs
#2817: FILE: tools/virtiofsd/fuse_lowlevel.h:455:
+^I * apply.$

ERROR: code indent should never use tabs
#2818: FILE: tools/virtiofsd/fuse_lowlevel.h:456:
+^I *$

ERROR: code indent should never use tabs
#2819: FILE: tools/virtiofsd/fuse_lowlevel.h:457:
+^I * - Creation (O_CREAT, O_EXCL, O_NOCTTY) flags will be$

ERROR: code indent should never use tabs
#2820: FILE: tools/virtiofsd/fuse_lowlevel.h:458:
+^I * filtered out / handled by the kernel.$

ERROR: code indent should never use tabs
#2821: FILE: tools/virtiofsd/fuse_lowlevel.h:459:
+^I *$

ERROR: code indent should never use tabs
#2822: FILE: tools/virtiofsd/fuse_lowlevel.h:460:
+^I * - Access modes (O_RDONLY, O_WRONLY, O_RDWR) should be used$

ERROR: code indent should never use tabs
#2823: FILE: tools/virtiofsd/fuse_lowlevel.h:461:
+^I * by the filesystem to check if the operation is$

ERROR: code indent should never use tabs
#2824: FILE: tools/virtiofsd/fuse_lowlevel.h:462:
+^I * permitted. If the ``-o default_permissions`` mount$

ERROR: code indent should never use tabs
#2825: FILE: tools/virtiofsd/fuse_lowlevel.h:463:
+^I * option is given, this check is already done by the$

ERROR: code indent should never use tabs
#2826: FILE: tools/virtiofsd/fuse_lowlevel.h:464:
+^I * kernel before calling open() and may thus be omitted by$

ERROR: code indent should never use tabs
#2827: FILE: tools/virtiofsd/fuse_lowlevel.h:465:
+^I * the filesystem.$

ERROR: code indent should never use tabs
#2828: FILE: tools/virtiofsd/fuse_lowlevel.h:466:
+^I *$

ERROR: code indent should never use tabs
#2829: FILE: tools/virtiofsd/fuse_lowlevel.h:467:
+^I * - When writeback caching is enabled, the kernel may send$

ERROR: code indent should never use tabs
#2830: FILE: tools/virtiofsd/fuse_lowlevel.h:468:
+^I * read requests even for files opened with O_WRONLY. The$

ERROR: code indent should never use tabs
#2831: FILE: tools/virtiofsd/fuse_lowlevel.h:469:
+^I * filesystem should be prepared to handle this.$

ERROR: code indent should never use tabs
#2832: FILE: tools/virtiofsd/fuse_lowlevel.h:470:
+^I *$

ERROR: code indent should never use tabs
#2833: FILE: tools/virtiofsd/fuse_lowlevel.h:471:
+^I * - When writeback caching is disabled, the filesystem is$

ERROR: code indent should never use tabs
#2834: FILE: tools/virtiofsd/fuse_lowlevel.h:472:
+^I * expected to properly handle the O_APPEND flag and ensure$

ERROR: code indent should never use tabs
#2835: FILE: tools/virtiofsd/fuse_lowlevel.h:473:
+^I * that each write is appending to the end of the file.$

ERROR: trailing whitespace
#2836: FILE: tools/virtiofsd/fuse_lowlevel.h:474:
+^I * $

ERROR: code indent should never use tabs
#2836: FILE: tools/virtiofsd/fuse_lowlevel.h:474:
+^I * $

ERROR: code indent should never use tabs
#2838: FILE: tools/virtiofsd/fuse_lowlevel.h:476:
+^I * handle O_APPEND. However, unless all changes to the file$

ERROR: code indent should never use tabs
#2839: FILE: tools/virtiofsd/fuse_lowlevel.h:477:
+^I * come through the kernel this will not work reliably. The$

ERROR: code indent should never use tabs
#2840: FILE: tools/virtiofsd/fuse_lowlevel.h:478:
+^I * filesystem should thus either ignore the O_APPEND flag$

ERROR: code indent should never use tabs
#2841: FILE: tools/virtiofsd/fuse_lowlevel.h:479:
+^I * (and let the kernel handle it), or return an error$

ERROR: code indent should never use tabs
#2842: FILE: tools/virtiofsd/fuse_lowlevel.h:480:
+^I * (indicating that reliably O_APPEND is not available).$

ERROR: code indent should never use tabs
#2843: FILE: tools/virtiofsd/fuse_lowlevel.h:481:
+^I *$

ERROR: code indent should never use tabs
#2844: FILE: tools/virtiofsd/fuse_lowlevel.h:482:
+^I * Filesystem may store an arbitrary file handle (pointer,$

ERROR: code indent should never use tabs
#2845: FILE: tools/virtiofsd/fuse_lowlevel.h:483:
+^I * index, etc) in fi->fh, and use this in other all other file$

ERROR: code indent should never use tabs #2846: FILE: tools/virtiofsd/fuse_lowlevel.h:484:
+^I * operations (read, write, flush, release, fsync).$

ERROR: code indent should never use tabs
#2847: FILE: tools/virtiofsd/fuse_lowlevel.h:485:
+^I *$

ERROR: code indent should never use tabs
#2848: FILE: tools/virtiofsd/fuse_lowlevel.h:486:
+^I * Filesystem may also implement stateless file I/O and not store$

ERROR: code indent should never use tabs
#2849: FILE: tools/virtiofsd/fuse_lowlevel.h:487:
+^I * anything in fi->fh.$

ERROR: code indent should never use tabs
#2850: FILE: tools/virtiofsd/fuse_lowlevel.h:488:
+^I *$

ERROR: code indent should never use tabs
#2851: FILE: tools/virtiofsd/fuse_lowlevel.h:489:
+^I * There are also some flags (direct_io, keep_cache) which the$

ERROR: code indent should never use tabs
#2852: FILE: tools/virtiofsd/fuse_lowlevel.h:490:
+^I * filesystem may set in fi, to change the way the file is opened.$

ERROR: code indent should never use tabs
#2853: FILE: tools/virtiofsd/fuse_lowlevel.h:491:
+^I * See fuse_file_info structure in <fuse_common.h> for more details.$

ERROR: code indent should never use tabs
#2854: FILE: tools/virtiofsd/fuse_lowlevel.h:492:
+^I *$

ERROR: code indent should never use tabs
#2855: FILE: tools/virtiofsd/fuse_lowlevel.h:493:
+^I * If this request is answered with an error code of ENOSYS$

ERROR: code indent should never use tabs
#2856: FILE: tools/virtiofsd/fuse_lowlevel.h:494:
+^I * and FUSE_CAP_NO_OPEN_SUPPORT is set in$

ERROR: code indent should never use tabs
#2857: FILE: tools/virtiofsd/fuse_lowlevel.h:495:
+^I * fuse_conn_info.capable, this is treated as success and$

ERROR: code indent should never use tabs
#2858: FILE: tools/virtiofsd/fuse_lowlevel.h:496:
+^I * future calls to open and release will also succeed without being$

ERROR: code indent should never use tabs
#2859: FILE: tools/virtiofsd/fuse_lowlevel.h:497:
+^I * sent to the filesystem process.$

ERROR: code indent should never use tabs
#2860: FILE: tools/virtiofsd/fuse_lowlevel.h:498:
+^I *$

ERROR: code indent should never use tabs
#2861: FILE: tools/virtiofsd/fuse_lowlevel.h:499:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2862: FILE: tools/virtiofsd/fuse_lowlevel.h:500:
+^I * fuse_reply_open$

ERROR: code indent should never use tabs
#2863: FILE: tools/virtiofsd/fuse_lowlevel.h:501:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2864: FILE: tools/virtiofsd/fuse_lowlevel.h:502:
+^I *$

ERROR: code indent should never use tabs
#2865: FILE: tools/virtiofsd/fuse_lowlevel.h:503:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2866: FILE: tools/virtiofsd/fuse_lowlevel.h:504:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2867: FILE: tools/virtiofsd/fuse_lowlevel.h:505:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#2868: FILE: tools/virtiofsd/fuse_lowlevel.h:506:
+^I */$

ERROR: code indent should never use tabs
#2869: FILE: tools/virtiofsd/fuse_lowlevel.h:507:
+^Ivoid (*open) (fuse_req_t req, fuse_ino_t ino,$

ERROR: code indent should never use tabs
#2870: FILE: tools/virtiofsd/fuse_lowlevel.h:508:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2872: FILE: tools/virtiofsd/fuse_lowlevel.h:510:
+^I/**$

ERROR: code indent should never use tabs
#2873: FILE: tools/virtiofsd/fuse_lowlevel.h:511:
+^I * Read data$

ERROR: code indent should never use tabs
#2874: FILE: tools/virtiofsd/fuse_lowlevel.h:512:
+^I *$

ERROR: code indent should never use tabs
#2875: FILE: tools/virtiofsd/fuse_lowlevel.h:513:
+^I * Read should send exactly the number of bytes requested except$

ERROR: code indent should never use tabs
#2876: FILE: tools/virtiofsd/fuse_lowlevel.h:514:
+^I * on EOF or error, otherwise the rest of the data will be$

ERROR: code indent should never use tabs
#2877: FILE: tools/virtiofsd/fuse_lowlevel.h:515:
+^I * substituted with zeroes. An exception to this is when the file$

ERROR: code indent should never use tabs
#2878: FILE: tools/virtiofsd/fuse_lowlevel.h:516:
+^I * has been opened in 'direct_io' mode, in which case the return$

ERROR: code indent should never use tabs
#2879: FILE: tools/virtiofsd/fuse_lowlevel.h:517:
+^I * value of the read system call will reflect the return value of$

ERROR: code indent should never use tabs
#2880: FILE: tools/virtiofsd/fuse_lowlevel.h:518:
+^I * this operation.$

ERROR: code indent should never use tabs
#2881: FILE: tools/virtiofsd/fuse_lowlevel.h:519:
+^I *$

ERROR: code indent should never use tabs
#2882: FILE: tools/virtiofsd/fuse_lowlevel.h:520:
+^I * fi->fh will contain the value set by the open method, or will$

ERROR: code indent should never use tabs
#2883: FILE: tools/virtiofsd/fuse_lowlevel.h:521:
+^I * be undefined if the open method didn't set any value.$

ERROR: code indent should never use tabs
#2884: FILE: tools/virtiofsd/fuse_lowlevel.h:522:
+^I *$

ERROR: code indent should never use tabs
#2885: FILE: tools/virtiofsd/fuse_lowlevel.h:523:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2886: FILE: tools/virtiofsd/fuse_lowlevel.h:524:
+^I * fuse_reply_buf$

ERROR: code indent should never use tabs
#2887: FILE: tools/virtiofsd/fuse_lowlevel.h:525:
+^I * fuse_reply_iov$

ERROR: code indent should never use tabs
#2888: FILE: tools/virtiofsd/fuse_lowlevel.h:526:
+^I * fuse_reply_data$

ERROR: code indent should never use tabs
#2889: FILE: tools/virtiofsd/fuse_lowlevel.h:527:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2890: FILE: tools/virtiofsd/fuse_lowlevel.h:528:
+^I *$

ERROR: code indent should never use tabs
#2891: FILE: tools/virtiofsd/fuse_lowlevel.h:529:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2892: FILE: tools/virtiofsd/fuse_lowlevel.h:530:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2893: FILE: tools/virtiofsd/fuse_lowlevel.h:531:
+^I * @param size number of bytes to read$

ERROR: code indent should never use tabs
#2894: FILE: tools/virtiofsd/fuse_lowlevel.h:532:
+^I * @param off offset to read from$

ERROR: code indent should never use tabs
#2895: FILE: tools/virtiofsd/fuse_lowlevel.h:533:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#2896: FILE: tools/virtiofsd/fuse_lowlevel.h:534:
+^I */$

ERROR: code indent should never use tabs
#2897: FILE: tools/virtiofsd/fuse_lowlevel.h:535:
+^Ivoid (*read) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,$

ERROR: code indent should never use tabs
#2898: FILE: tools/virtiofsd/fuse_lowlevel.h:536:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2900: FILE: tools/virtiofsd/fuse_lowlevel.h:538:
+^I/**$

ERROR: code indent should never use tabs
#2901: FILE: tools/virtiofsd/fuse_lowlevel.h:539:
+^I * Write data$

ERROR: code indent should never use tabs
#2902: FILE: tools/virtiofsd/fuse_lowlevel.h:540:
+^I *$

ERROR: code indent should never use tabs
#2903: FILE: tools/virtiofsd/fuse_lowlevel.h:541:
+^I * Write should return exactly the number of bytes requested$

ERROR: code indent should never use tabs
#2904: FILE: tools/virtiofsd/fuse_lowlevel.h:542:
+^I * except on error. An exception to this is when the file has$

ERROR: code indent should never use tabs
#2905: FILE: tools/virtiofsd/fuse_lowlevel.h:543:
+^I * been opened in 'direct_io' mode, in which case the return value$

ERROR: code indent should never use tabs
#2906: FILE: tools/virtiofsd/fuse_lowlevel.h:544:
+^I * of the write system call will reflect the return value of this$

ERROR: code indent should never use tabs
#2907: FILE: tools/virtiofsd/fuse_lowlevel.h:545:
+^I * operation.$

ERROR: code indent should never use tabs
#2908: FILE: tools/virtiofsd/fuse_lowlevel.h:546:
+^I *$

ERROR: code indent should never use tabs
#2909: FILE: tools/virtiofsd/fuse_lowlevel.h:547:
+^I * Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is$

ERROR: code indent should never use tabs #2910: FILE: tools/virtiofsd/fuse_lowlevel.h:548:
+^I * expected to reset the setuid and setgid bits.$

ERROR: code indent should never use tabs
#2911: FILE: tools/virtiofsd/fuse_lowlevel.h:549:
+^I *$

ERROR: code indent should never use tabs
#2912: FILE: tools/virtiofsd/fuse_lowlevel.h:550:
+^I * fi->fh will contain the value set by the open method, or will$

ERROR: code indent should never use tabs
#2913: FILE: tools/virtiofsd/fuse_lowlevel.h:551:
+^I * be undefined if the open method didn't set any value.$

ERROR: code indent should never use tabs
#2914: FILE: tools/virtiofsd/fuse_lowlevel.h:552:
+^I *$

ERROR: code indent should never use tabs
#2915: FILE: tools/virtiofsd/fuse_lowlevel.h:553:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2916: FILE: tools/virtiofsd/fuse_lowlevel.h:554:
+^I * fuse_reply_write$

ERROR: code indent should never use tabs
#2917: FILE: tools/virtiofsd/fuse_lowlevel.h:555:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2918: FILE: tools/virtiofsd/fuse_lowlevel.h:556:
+^I *$

ERROR: code indent should never use tabs
#2919: FILE: tools/virtiofsd/fuse_lowlevel.h:557:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2920: FILE: tools/virtiofsd/fuse_lowlevel.h:558:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2921: FILE: tools/virtiofsd/fuse_lowlevel.h:559:
+^I * @param buf data to write$

ERROR: code indent should never use tabs
#2922: FILE: tools/virtiofsd/fuse_lowlevel.h:560:
+^I * @param size number of bytes to write$

ERROR: code indent should never use tabs
#2923: FILE: tools/virtiofsd/fuse_lowlevel.h:561:
+^I * @param off offset to write to$

ERROR: code indent should never use tabs
#2924: FILE: tools/virtiofsd/fuse_lowlevel.h:562:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#2925: FILE: tools/virtiofsd/fuse_lowlevel.h:563:
+^I */$

ERROR: code indent should never use tabs
#2926: FILE: tools/virtiofsd/fuse_lowlevel.h:564:
+^Ivoid (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,$

ERROR: code indent should never use tabs
#2927: FILE: tools/virtiofsd/fuse_lowlevel.h:565:
+^I^I size_t size, off_t off, struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2929: FILE: tools/virtiofsd/fuse_lowlevel.h:567:
+^I/**$

ERROR: code indent should never use tabs
#2930: FILE: tools/virtiofsd/fuse_lowlevel.h:568:
+^I * Flush method$

ERROR: code indent should never use tabs
#2931: FILE: tools/virtiofsd/fuse_lowlevel.h:569:
+^I *$

ERROR: code indent should never use tabs
#2932: FILE: tools/virtiofsd/fuse_lowlevel.h:570:
+^I * This is called on each close() of the opened file.$

ERROR: code indent should never use tabs
#2933: FILE: tools/virtiofsd/fuse_lowlevel.h:571:
+^I *$

ERROR: code indent should never use tabs
#2934: FILE: tools/virtiofsd/fuse_lowlevel.h:572:
+^I * Since file descriptors can be duplicated (dup, dup2, fork), for$

ERROR: code indent should never use tabs #2935: FILE: tools/virtiofsd/fuse_lowlevel.h:573:
+^I * one open call there may be many flush calls.$

ERROR: code indent should never use tabs
#2936: FILE: tools/virtiofsd/fuse_lowlevel.h:574:
+^I *$

ERROR: code indent should never use tabs
#2937: FILE: tools/virtiofsd/fuse_lowlevel.h:575:
+^I * Filesystems shouldn't assume that flush will always be called$

ERROR: code indent should never use tabs
#2938: FILE: tools/virtiofsd/fuse_lowlevel.h:576:
+^I * after some writes, or that if will be called at all.$

ERROR: code indent should never use tabs
#2939: FILE: tools/virtiofsd/fuse_lowlevel.h:577:
+^I *$

ERROR: code indent should never use tabs
#2940: FILE: tools/virtiofsd/fuse_lowlevel.h:578:
+^I * fi->fh will contain the value set by the open method, or will$

ERROR: code indent should never use tabs
#2941: FILE: tools/virtiofsd/fuse_lowlevel.h:579:
+^I * be undefined if the open method didn't set any value.$

ERROR: code indent should never use tabs
#2942: FILE: tools/virtiofsd/fuse_lowlevel.h:580:
+^I *$

ERROR: code indent should never use tabs
#2943: FILE: tools/virtiofsd/fuse_lowlevel.h:581:
+^I * NOTE: the name of the method is misleading, since (unlike$

ERROR: code indent should never use tabs
#2944: FILE: tools/virtiofsd/fuse_lowlevel.h:582:
+^I * fsync) the filesystem is not forced to flush pending writes.$

ERROR: code indent should never use tabs
#2945: FILE: tools/virtiofsd/fuse_lowlevel.h:583:
+^I * One reason to flush data is if the filesystem wants to return$

ERROR: code indent should never use tabs
#2946: FILE: tools/virtiofsd/fuse_lowlevel.h:584:
+^I * write errors during close. However, such use is non-portable$

ERROR: code indent should never use tabs
#2947: FILE: tools/virtiofsd/fuse_lowlevel.h:585:
+^I * because POSIX does not require [close] to wait for delayed I/O to$

ERROR: code indent should never use tabs
#2948: FILE: tools/virtiofsd/fuse_lowlevel.h:586:
+^I * complete.$

ERROR: code indent should never use tabs
#2949: FILE: tools/virtiofsd/fuse_lowlevel.h:587:
+^I *$

ERROR: code indent should never use tabs
#2950: FILE: tools/virtiofsd/fuse_lowlevel.h:588:
+^I * If the filesystem supports file locking operations (setlk,$

ERROR: code indent should never use tabs
#2951: FILE: tools/virtiofsd/fuse_lowlevel.h:589:
+^I * getlk) it should remove all locks belonging to 'fi->owner'.$

ERROR: code indent should never use tabs
#2952: FILE: tools/virtiofsd/fuse_lowlevel.h:590:
+^I *$

ERROR: code indent should never use tabs
#2953: FILE: tools/virtiofsd/fuse_lowlevel.h:591:
+^I * If this request is answered with an error code of ENOSYS,$

ERROR: code indent should never use tabs
#2954: FILE: tools/virtiofsd/fuse_lowlevel.h:592:
+^I * this is treated as success and future calls to flush() will$

ERROR: code indent should never use tabs
#2955: FILE: tools/virtiofsd/fuse_lowlevel.h:593:
+^I * succeed automatically without being send to the filesystem$

ERROR: code indent should never use tabs
#2956: FILE: tools/virtiofsd/fuse_lowlevel.h:594:
+^I * process.$

ERROR: code indent should never use tabs
#2957: FILE: tools/virtiofsd/fuse_lowlevel.h:595:
+^I *$

ERROR: code indent should never use tabs
#2958: FILE: tools/virtiofsd/fuse_lowlevel.h:596:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2959: FILE: tools/virtiofsd/fuse_lowlevel.h:597:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2960: FILE: tools/virtiofsd/fuse_lowlevel.h:598:
+^I *$

ERROR: code indent should never use tabs
#2961: FILE: tools/virtiofsd/fuse_lowlevel.h:599:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2962: FILE: tools/virtiofsd/fuse_lowlevel.h:600:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2963: FILE: tools/virtiofsd/fuse_lowlevel.h:601:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#2964: FILE: tools/virtiofsd/fuse_lowlevel.h:602:
+^I *$

WARNING: line over 80 characters
#2965: FILE: tools/virtiofsd/fuse_lowlevel.h:603:
+ * [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html

ERROR: code indent should never use tabs
#2965: FILE: tools/virtiofsd/fuse_lowlevel.h:603:
+^I * [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html$

ERROR: code indent should never use tabs
#2966: FILE: tools/virtiofsd/fuse_lowlevel.h:604:
+^I */$

ERROR: code indent should never use tabs #2967: FILE: tools/virtiofsd/fuse_lowlevel.h:605:
+^Ivoid (*flush) (fuse_req_t req, fuse_ino_t ino,$

ERROR: code indent should never use tabs
#2968: FILE: tools/virtiofsd/fuse_lowlevel.h:606:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2970: FILE: tools/virtiofsd/fuse_lowlevel.h:608:
+^I/**$

ERROR: code indent should never use tabs
#2971: FILE: tools/virtiofsd/fuse_lowlevel.h:609:
+^I * Release an open file$

ERROR: code indent should never use tabs
#2972: FILE: tools/virtiofsd/fuse_lowlevel.h:610:
+^I *$

ERROR: code indent should never use tabs
#2973: FILE: tools/virtiofsd/fuse_lowlevel.h:611:
+^I * Release is called when there are no more references to an open$

ERROR: code indent should never use tabs
#2974: FILE: tools/virtiofsd/fuse_lowlevel.h:612:
+^I * file: all file descriptors are closed and all memory mappings$

ERROR: code indent should never use tabs
#2975: FILE: tools/virtiofsd/fuse_lowlevel.h:613:
+^I * are unmapped.$

ERROR: code indent should never use tabs
#2976: FILE: tools/virtiofsd/fuse_lowlevel.h:614:
+^I *$

ERROR: code indent should never use tabs
#2977: FILE: tools/virtiofsd/fuse_lowlevel.h:615:
+^I * For every open call there will be exactly one release call (unless$

ERROR: code indent should never use tabs
#2978: FILE: tools/virtiofsd/fuse_lowlevel.h:616:
+^I * the filesystem is force-unmounted).$

ERROR: code indent should never use tabs
#2979: FILE: tools/virtiofsd/fuse_lowlevel.h:617:
+^I *$

ERROR: code indent should never use tabs
#2980: FILE: tools/virtiofsd/fuse_lowlevel.h:618:
+^I * The filesystem may reply with an error, but error values are$

ERROR: code indent should never use tabs
#2981: FILE: tools/virtiofsd/fuse_lowlevel.h:619:
+^I * not returned to close() or munmap() which triggered the$

ERROR: code indent should never use tabs
#2982: FILE: tools/virtiofsd/fuse_lowlevel.h:620:
+^I * release.$

ERROR: code indent should never use tabs
#2983: FILE: tools/virtiofsd/fuse_lowlevel.h:621:
+^I *$

ERROR: code indent should never use tabs
#2984: FILE: tools/virtiofsd/fuse_lowlevel.h:622:
+^I * fi->fh will contain the value set by the open method, or will$

ERROR: code indent should never use tabs
#2985: FILE: tools/virtiofsd/fuse_lowlevel.h:623:
+^I * be undefined if the open method didn't set any value.$

ERROR: code indent should never use tabs
#2986: FILE: tools/virtiofsd/fuse_lowlevel.h:624:
+^I * fi->flags will contain the same flags as for open.$

ERROR: code indent should never use tabs
#2987: FILE: tools/virtiofsd/fuse_lowlevel.h:625:
+^I *$

ERROR: code indent should never use tabs
#2988: FILE: tools/virtiofsd/fuse_lowlevel.h:626:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#2989: FILE: tools/virtiofsd/fuse_lowlevel.h:627:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#2990: FILE: tools/virtiofsd/fuse_lowlevel.h:628:
+^I *$

ERROR: code indent should never use tabs
#2991: FILE: tools/virtiofsd/fuse_lowlevel.h:629:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#2992: FILE: tools/virtiofsd/fuse_lowlevel.h:630:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#2993: FILE: tools/virtiofsd/fuse_lowlevel.h:631:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#2994: FILE: tools/virtiofsd/fuse_lowlevel.h:632:
+^I */$

ERROR: code indent should never use tabs #2995: FILE: tools/virtiofsd/fuse_lowlevel.h:633:
+^Ivoid (*release) (fuse_req_t req, fuse_ino_t ino,$

ERROR: code indent should never use tabs
#2996: FILE: tools/virtiofsd/fuse_lowlevel.h:634:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#2998: FILE: tools/virtiofsd/fuse_lowlevel.h:636:
+^I/**$

ERROR: code indent should never use tabs
#2999: FILE: tools/virtiofsd/fuse_lowlevel.h:637:
+^I * Synchronize file contents$

ERROR: code indent should never use tabs
#3000: FILE: tools/virtiofsd/fuse_lowlevel.h:638:
+^I *$

ERROR: code indent should never use tabs
#3001: FILE: tools/virtiofsd/fuse_lowlevel.h:639:
+^I * If the datasync parameter is non-zero, then only the user data$

ERROR: code indent should never use tabs
#3002: FILE: tools/virtiofsd/fuse_lowlevel.h:640:
+^I * should be flushed, not the meta data.$

ERROR: code indent should never use tabs
#3003: FILE: tools/virtiofsd/fuse_lowlevel.h:641:
+^I *$

ERROR: code indent should never use tabs
#3004: FILE: tools/virtiofsd/fuse_lowlevel.h:642:
+^I * If this request is answered with an error code of ENOSYS,$

ERROR: code indent should never use tabs
#3005: FILE: tools/virtiofsd/fuse_lowlevel.h:643:
+^I * this is treated as success and future calls to fsync() will$

ERROR: code indent should never use tabs
#3006: FILE: tools/virtiofsd/fuse_lowlevel.h:644:
+^I * succeed automatically without being send to the filesystem$

ERROR: code indent should never use tabs
#3007: FILE: tools/virtiofsd/fuse_lowlevel.h:645:
+^I * process.$

ERROR: code indent should never use tabs
#3008: FILE: tools/virtiofsd/fuse_lowlevel.h:646:
+^I *$

ERROR: code indent should never use tabs
#3009: FILE: tools/virtiofsd/fuse_lowlevel.h:647:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3010: FILE: tools/virtiofsd/fuse_lowlevel.h:648:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3011: FILE: tools/virtiofsd/fuse_lowlevel.h:649:
+^I *$

ERROR: code indent should never use tabs
#3012: FILE: tools/virtiofsd/fuse_lowlevel.h:650:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3013: FILE: tools/virtiofsd/fuse_lowlevel.h:651:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3014: FILE: tools/virtiofsd/fuse_lowlevel.h:652:
+^I * @param datasync flag indicating if only data should be flushed$

ERROR: code indent should never use tabs
#3015: FILE: tools/virtiofsd/fuse_lowlevel.h:653:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#3016: FILE: tools/virtiofsd/fuse_lowlevel.h:654:
+^I */$

ERROR: code indent should never use tabs
#3017: FILE: tools/virtiofsd/fuse_lowlevel.h:655:
+^Ivoid (*fsync) (fuse_req_t req, fuse_ino_t ino, int datasync,$

ERROR: code indent should never use tabs
#3018: FILE: tools/virtiofsd/fuse_lowlevel.h:656:
+^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#3020: FILE: tools/virtiofsd/fuse_lowlevel.h:658:
+^I/**$

ERROR: code indent should never use tabs
#3021: FILE: tools/virtiofsd/fuse_lowlevel.h:659:
+^I * Open a directory$

ERROR: code indent should never use tabs
#3022: FILE: tools/virtiofsd/fuse_lowlevel.h:660:
+^I *$

ERROR: code indent should never use tabs
#3023: FILE: tools/virtiofsd/fuse_lowlevel.h:661:
+^I * Filesystem may store an arbitrary file handle (pointer, index,$

ERROR: code indent should never use tabs
#3024: FILE: tools/virtiofsd/fuse_lowlevel.h:662:
+^I * etc) in fi->fh, and use this in other all other directory$

ERROR: code indent should never use tabs
#3025: FILE: tools/virtiofsd/fuse_lowlevel.h:663:
+^I * stream operations (readdir, releasedir, fsyncdir).$

ERROR: code indent should never use tabs
#3026: FILE: tools/virtiofsd/fuse_lowlevel.h:664:
+^I *$

ERROR: code indent should never use tabs
#3027: FILE: tools/virtiofsd/fuse_lowlevel.h:665:
+^I * If this request is answered with an error code of ENOSYS and$

ERROR: code indent should never use tabs
#3028: FILE: tools/virtiofsd/fuse_lowlevel.h:666:
+^I * FUSE_CAP_NO_OPENDIR_SUPPORT is set in fuse_conn_info.capable,$

ERROR: code indent should never use tabs
#3029: FILE: tools/virtiofsd/fuse_lowlevel.h:667:
+^I * this is treated as success and future calls to opendir and$

ERROR: code indent should never use tabs
#3030: FILE: tools/virtiofsd/fuse_lowlevel.h:668:
+^I * releasedir will also succeed without being sent to the filesystem$

ERROR: code indent should never use tabs
#3031: FILE: tools/virtiofsd/fuse_lowlevel.h:669:
+^I * process. In addition, the kernel will cache readdir results$

ERROR: code indent should never use tabs
#3032: FILE: tools/virtiofsd/fuse_lowlevel.h:670:
+^I * as if opendir returned FOPEN_KEEP_CACHE | FOPEN_CACHE_DIR.$

ERROR: code indent should never use tabs
#3033: FILE: tools/virtiofsd/fuse_lowlevel.h:671:
+^I *$

ERROR: code indent should never use tabs
#3034: FILE: tools/virtiofsd/fuse_lowlevel.h:672:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3035: FILE: tools/virtiofsd/fuse_lowlevel.h:673:
+^I * fuse_reply_open$

ERROR: code indent should never use tabs
#3036: FILE: tools/virtiofsd/fuse_lowlevel.h:674:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3037: FILE: tools/virtiofsd/fuse_lowlevel.h:675:
+^I *$

ERROR: code indent should never use tabs
#3038: FILE: tools/virtiofsd/fuse_lowlevel.h:676:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3039: FILE: tools/virtiofsd/fuse_lowlevel.h:677:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3040: FILE: tools/virtiofsd/fuse_lowlevel.h:678:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#3041: FILE: tools/virtiofsd/fuse_lowlevel.h:679:
+^I */$

ERROR: code indent should never use tabs #3042: FILE: tools/virtiofsd/fuse_lowlevel.h:680:
+^Ivoid (*opendir) (fuse_req_t req, fuse_ino_t ino,$

ERROR: code indent should never use tabs
#3043: FILE: tools/virtiofsd/fuse_lowlevel.h:681:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#3045: FILE: tools/virtiofsd/fuse_lowlevel.h:683:
+^I/**$

ERROR: code indent should never use tabs
#3046: FILE: tools/virtiofsd/fuse_lowlevel.h:684:
+^I * Read directory$

ERROR: code indent should never use tabs
#3047: FILE: tools/virtiofsd/fuse_lowlevel.h:685:
+^I *$

ERROR: code indent should never use tabs
#3048: FILE: tools/virtiofsd/fuse_lowlevel.h:686:
+^I * Send a buffer filled using fuse_add_direntry(), with size not$

ERROR: code indent should never use tabs
#3049: FILE: tools/virtiofsd/fuse_lowlevel.h:687:
+^I * exceeding the requested size. Send an empty buffer on end of$

ERROR: code indent should never use tabs
#3050: FILE: tools/virtiofsd/fuse_lowlevel.h:688:
+^I * stream.$

ERROR: code indent should never use tabs
#3051: FILE: tools/virtiofsd/fuse_lowlevel.h:689:
+^I *$

ERROR: code indent should never use tabs
#3052: FILE: tools/virtiofsd/fuse_lowlevel.h:690:
+^I * fi->fh will contain the value set by the opendir method, or$

ERROR: code indent should never use tabs
#3053: FILE: tools/virtiofsd/fuse_lowlevel.h:691:
+^I * will be undefined if the opendir method didn't set any value.$

ERROR: code indent should never use tabs
#3054: FILE: tools/virtiofsd/fuse_lowlevel.h:692:
+^I *$

ERROR: code indent should never use tabs
#3055: FILE: tools/virtiofsd/fuse_lowlevel.h:693:
+^I * Returning a directory entry from readdir() does not affect$

ERROR: code indent should never use tabs
#3056: FILE: tools/virtiofsd/fuse_lowlevel.h:694:
+^I * its lookup count.$

ERROR: code indent should never use tabs
#3057: FILE: tools/virtiofsd/fuse_lowlevel.h:695:
+^I *$

ERROR: code indent should never use tabs
#3059: FILE: tools/virtiofsd/fuse_lowlevel.h:697:
+^I * values that was previously returned by readdir() for the same$

ERROR: code indent should never use tabs
#3060: FILE: tools/virtiofsd/fuse_lowlevel.h:698:
+^I * directory handle. In this case, readdir() should skip over entries$

ERROR: code indent should never use tabs
#3061: FILE: tools/virtiofsd/fuse_lowlevel.h:699:
+^I * coming before the position defined by the off_t value. If entries$

WARNING: line over 80 characters
#3062: FILE: tools/virtiofsd/fuse_lowlevel.h:700:
+ * are added or removed while the directory handle is open, they filesystem

ERROR: code indent should never use tabs
#3062: FILE: tools/virtiofsd/fuse_lowlevel.h:700:
+^I * are added or removed while the directory handle is open, they filesystem$

ERROR: code indent should never use tabs
#3063: FILE: tools/virtiofsd/fuse_lowlevel.h:701:
+^I * may still include the entries that have been removed, and may not$

ERROR: code indent should never use tabs
#3064: FILE: tools/virtiofsd/fuse_lowlevel.h:702:
+^I * report the entries that have been created. However, addition or$

ERROR: code indent should never use tabs
#3065: FILE: tools/virtiofsd/fuse_lowlevel.h:703:
+^I * removal of entries must never cause readdir() to skip over unrelated$

ERROR: code indent should never use tabs
#3066: FILE: tools/virtiofsd/fuse_lowlevel.h:704:
+^I * entries or to report them more than once. This means$

ERROR: code indent should never use tabs
#3067: FILE: tools/virtiofsd/fuse_lowlevel.h:705:
+^I * that off_t can not be a simple index that enumerates the entries$

ERROR: code indent should never use tabs
#3068: FILE: tools/virtiofsd/fuse_lowlevel.h:706:
+^I * that have been returned but must contain sufficient information to$

ERROR: code indent should never use tabs
#3069: FILE: tools/virtiofsd/fuse_lowlevel.h:707:
+^I * uniquely determine the next directory entry to return even when the$

ERROR: code indent should never use tabs
#3070: FILE: tools/virtiofsd/fuse_lowlevel.h:708:
+^I * set of entries is changing.$

ERROR: code indent should never use tabs
#3071: FILE: tools/virtiofsd/fuse_lowlevel.h:709:
+^I *$

ERROR: code indent should never use tabs
#3072: FILE: tools/virtiofsd/fuse_lowlevel.h:710:
+^I * The function does not have to report the '.' and '..'$

ERROR: code indent should never use tabs
#3073: FILE: tools/virtiofsd/fuse_lowlevel.h:711:
+^I * entries, but is allowed to do so. Note that, if readdir does$

ERROR: code indent should never use tabs
#3074: FILE: tools/virtiofsd/fuse_lowlevel.h:712:
+^I * not return '.' or '..', they will not be implicitly returned,$

ERROR: code indent should never use tabs #3075: FILE: tools/virtiofsd/fuse_lowlevel.h:713:
+^I * and this behavior is observable by the caller.$

ERROR: code indent should never use tabs
#3076: FILE: tools/virtiofsd/fuse_lowlevel.h:714:
+^I *$

ERROR: code indent should never use tabs
#3077: FILE: tools/virtiofsd/fuse_lowlevel.h:715:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3078: FILE: tools/virtiofsd/fuse_lowlevel.h:716:
+^I * fuse_reply_buf$

ERROR: code indent should never use tabs
#3079: FILE: tools/virtiofsd/fuse_lowlevel.h:717:
+^I * fuse_reply_data$

ERROR: code indent should never use tabs
#3080: FILE: tools/virtiofsd/fuse_lowlevel.h:718:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3081: FILE: tools/virtiofsd/fuse_lowlevel.h:719:
+^I *$

ERROR: code indent should never use tabs
#3082: FILE: tools/virtiofsd/fuse_lowlevel.h:720:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3083: FILE: tools/virtiofsd/fuse_lowlevel.h:721:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs #3084: FILE: tools/virtiofsd/fuse_lowlevel.h:722:
+^I * @param size maximum number of bytes to send$

ERROR: code indent should never use tabs
#3085: FILE: tools/virtiofsd/fuse_lowlevel.h:723:
+^I * @param off offset to continue reading the directory stream$

ERROR: code indent should never use tabs
#3086: FILE: tools/virtiofsd/fuse_lowlevel.h:724:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#3087: FILE: tools/virtiofsd/fuse_lowlevel.h:725:
+^I */$

ERROR: code indent should never use tabs
#3088: FILE: tools/virtiofsd/fuse_lowlevel.h:726:
+^Ivoid (*readdir) (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,$

ERROR: code indent should never use tabs
#3089: FILE: tools/virtiofsd/fuse_lowlevel.h:727:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#3091: FILE: tools/virtiofsd/fuse_lowlevel.h:729:
+^I/**$

ERROR: code indent should never use tabs
#3092: FILE: tools/virtiofsd/fuse_lowlevel.h:730:
+^I * Release an open directory$

ERROR: code indent should never use tabs
#3093: FILE: tools/virtiofsd/fuse_lowlevel.h:731:
+^I *$

ERROR: code indent should never use tabs
#3094: FILE: tools/virtiofsd/fuse_lowlevel.h:732:
+^I * For every opendir call there will be exactly one releasedir$

ERROR: code indent should never use tabs #3095: FILE: tools/virtiofsd/fuse_lowlevel.h:733:
+^I * call (unless the filesystem is force-unmounted).$

ERROR: code indent should never use tabs
#3096: FILE: tools/virtiofsd/fuse_lowlevel.h:734:
+^I *$

ERROR: code indent should never use tabs
#3097: FILE: tools/virtiofsd/fuse_lowlevel.h:735:
+^I * fi->fh will contain the value set by the opendir method, or$

ERROR: code indent should never use tabs
#3098: FILE: tools/virtiofsd/fuse_lowlevel.h:736:
+^I * will be undefined if the opendir method didn't set any value.$

ERROR: code indent should never use tabs
#3099: FILE: tools/virtiofsd/fuse_lowlevel.h:737:
+^I *$

ERROR: code indent should never use tabs
#3100: FILE: tools/virtiofsd/fuse_lowlevel.h:738:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3101: FILE: tools/virtiofsd/fuse_lowlevel.h:739:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3102: FILE: tools/virtiofsd/fuse_lowlevel.h:740:
+^I *$

ERROR: code indent should never use tabs
#3103: FILE: tools/virtiofsd/fuse_lowlevel.h:741:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3104: FILE: tools/virtiofsd/fuse_lowlevel.h:742:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3105: FILE: tools/virtiofsd/fuse_lowlevel.h:743:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#3106: FILE: tools/virtiofsd/fuse_lowlevel.h:744:
+^I */$

ERROR: code indent should never use tabs #3107: FILE: tools/virtiofsd/fuse_lowlevel.h:745:
+^Ivoid (*releasedir) (fuse_req_t req, fuse_ino_t ino,$

ERROR: code indent should never use tabs
#3108: FILE: tools/virtiofsd/fuse_lowlevel.h:746:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#3110: FILE: tools/virtiofsd/fuse_lowlevel.h:748:
+^I/**$

ERROR: code indent should never use tabs
#3111: FILE: tools/virtiofsd/fuse_lowlevel.h:749:
+^I * Synchronize directory contents$

ERROR: code indent should never use tabs
#3112: FILE: tools/virtiofsd/fuse_lowlevel.h:750:
+^I *$

ERROR: code indent should never use tabs
#3113: FILE: tools/virtiofsd/fuse_lowlevel.h:751:
+^I * If the datasync parameter is non-zero, then only the directory$

ERROR: code indent should never use tabs #3114: FILE: tools/virtiofsd/fuse_lowlevel.h:752:
+^I * contents should be flushed, not the meta data.$

ERROR: code indent should never use tabs
#3115: FILE: tools/virtiofsd/fuse_lowlevel.h:753:
+^I *$

ERROR: code indent should never use tabs
#3116: FILE: tools/virtiofsd/fuse_lowlevel.h:754:
+^I * fi->fh will contain the value set by the opendir method, or$

ERROR: code indent should never use tabs
#3117: FILE: tools/virtiofsd/fuse_lowlevel.h:755:
+^I * will be undefined if the opendir method didn't set any value.$

ERROR: code indent should never use tabs
#3118: FILE: tools/virtiofsd/fuse_lowlevel.h:756:
+^I *$

ERROR: code indent should never use tabs
#3119: FILE: tools/virtiofsd/fuse_lowlevel.h:757:
+^I * If this request is answered with an error code of ENOSYS,$

ERROR: code indent should never use tabs
#3120: FILE: tools/virtiofsd/fuse_lowlevel.h:758:
+^I * this is treated as success and future calls to fsyncdir() will$

ERROR: code indent should never use tabs
#3121: FILE: tools/virtiofsd/fuse_lowlevel.h:759:
+^I * succeed automatically without being send to the filesystem$

ERROR: code indent should never use tabs
#3122: FILE: tools/virtiofsd/fuse_lowlevel.h:760:
+^I * process.$

ERROR: code indent should never use tabs
#3123: FILE: tools/virtiofsd/fuse_lowlevel.h:761:
+^I *$

ERROR: code indent should never use tabs
#3124: FILE: tools/virtiofsd/fuse_lowlevel.h:762:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3125: FILE: tools/virtiofsd/fuse_lowlevel.h:763:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3126: FILE: tools/virtiofsd/fuse_lowlevel.h:764:
+^I *$

ERROR: code indent should never use tabs
#3127: FILE: tools/virtiofsd/fuse_lowlevel.h:765:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3128: FILE: tools/virtiofsd/fuse_lowlevel.h:766:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3129: FILE: tools/virtiofsd/fuse_lowlevel.h:767:
+^I * @param datasync flag indicating if only data should be flushed$

ERROR: code indent should never use tabs
#3130: FILE: tools/virtiofsd/fuse_lowlevel.h:768:
+^I * @param fi file information$

ERROR: code indent should never use tabs
#3131: FILE: tools/virtiofsd/fuse_lowlevel.h:769:
+^I */$

ERROR: code indent should never use tabs
#3132: FILE: tools/virtiofsd/fuse_lowlevel.h:770:
+^Ivoid (*fsyncdir) (fuse_req_t req, fuse_ino_t ino, int datasync,$

ERROR: code indent should never use tabs
#3133: FILE: tools/virtiofsd/fuse_lowlevel.h:771:
+^I^I^I struct fuse_file_info *fi);$

ERROR: code indent should never use tabs
#3135: FILE: tools/virtiofsd/fuse_lowlevel.h:773:
+^I/**$

ERROR: code indent should never use tabs
#3136: FILE: tools/virtiofsd/fuse_lowlevel.h:774:
+^I * Get file system statistics$

ERROR: code indent should never use tabs
#3137: FILE: tools/virtiofsd/fuse_lowlevel.h:775:
+^I *$

ERROR: code indent should never use tabs
#3138: FILE: tools/virtiofsd/fuse_lowlevel.h:776:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3139: FILE: tools/virtiofsd/fuse_lowlevel.h:777:
+^I * fuse_reply_statfs$

ERROR: code indent should never use tabs
#3140: FILE: tools/virtiofsd/fuse_lowlevel.h:778:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3141: FILE: tools/virtiofsd/fuse_lowlevel.h:779:
+^I *$

ERROR: code indent should never use tabs
#3142: FILE: tools/virtiofsd/fuse_lowlevel.h:780:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3143: FILE: tools/virtiofsd/fuse_lowlevel.h:781:
+^I * @param ino the inode number, zero means "undefined"$

ERROR: code indent should never use tabs
#3144: FILE: tools/virtiofsd/fuse_lowlevel.h:782:
+^I */$

ERROR: code indent should never use tabs #3145: FILE: tools/virtiofsd/fuse_lowlevel.h:783:
+^Ivoid (*statfs) (fuse_req_t req, fuse_ino_t ino);$

ERROR: code indent should never use tabs
#3147: FILE: tools/virtiofsd/fuse_lowlevel.h:785:
+^I/**$

ERROR: code indent should never use tabs
#3148: FILE: tools/virtiofsd/fuse_lowlevel.h:786:
+^I * Set an extended attribute$

ERROR: code indent should never use tabs
#3149: FILE: tools/virtiofsd/fuse_lowlevel.h:787:
+^I *$

ERROR: code indent should never use tabs
#3150: FILE: tools/virtiofsd/fuse_lowlevel.h:788:
+^I * If this request is answered with an error code of ENOSYS, this is$

ERROR: code indent should never use tabs
#3151: FILE: tools/virtiofsd/fuse_lowlevel.h:789:
+^I * treated as a permanent failure with error code EOPNOTSUPP, i.e. all$

ERROR: code indent should never use tabs
#3152: FILE: tools/virtiofsd/fuse_lowlevel.h:790:
+^I * future setxattr() requests will fail with EOPNOTSUPP without being$

ERROR: code indent should never use tabs
#3153: FILE: tools/virtiofsd/fuse_lowlevel.h:791:
+^I * send to the filesystem process.$

ERROR: code indent should never use tabs
#3154: FILE: tools/virtiofsd/fuse_lowlevel.h:792:
+^I *$

ERROR: code indent should never use tabs
#3155: FILE: tools/virtiofsd/fuse_lowlevel.h:793:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3156: FILE: tools/virtiofsd/fuse_lowlevel.h:794:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3157: FILE: tools/virtiofsd/fuse_lowlevel.h:795:
+^I */$

ERROR: code indent should never use tabs
#3158: FILE: tools/virtiofsd/fuse_lowlevel.h:796:
+^Ivoid (*setxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,$

ERROR: code indent should never use tabs #3159: FILE: tools/virtiofsd/fuse_lowlevel.h:797:
+^I^I^I const char *value, size_t size, int flags);$

ERROR: code indent should never use tabs
#3161: FILE: tools/virtiofsd/fuse_lowlevel.h:799:
+^I/**$

ERROR: code indent should never use tabs
#3162: FILE: tools/virtiofsd/fuse_lowlevel.h:800:
+^I * Get an extended attribute$

ERROR: code indent should never use tabs
#3163: FILE: tools/virtiofsd/fuse_lowlevel.h:801:
+^I *$

ERROR: code indent should never use tabs
#3164: FILE: tools/virtiofsd/fuse_lowlevel.h:802:
+^I * If size is zero, the size of the value should be sent with$

ERROR: code indent should never use tabs
#3165: FILE: tools/virtiofsd/fuse_lowlevel.h:803:
+^I * fuse_reply_xattr.$

ERROR: code indent should never use tabs
#3166: FILE: tools/virtiofsd/fuse_lowlevel.h:804:
+^I *$

ERROR: code indent should never use tabs
#3167: FILE: tools/virtiofsd/fuse_lowlevel.h:805:
+^I * If the size is non-zero, and the value fits in the buffer, the$

ERROR: code indent should never use tabs
#3168: FILE: tools/virtiofsd/fuse_lowlevel.h:806:
+^I * value should be sent with fuse_reply_buf.$

ERROR: code indent should never use tabs
#3169: FILE: tools/virtiofsd/fuse_lowlevel.h:807:
+^I *$

ERROR: code indent should never use tabs
#3170: FILE: tools/virtiofsd/fuse_lowlevel.h:808:
+^I * If the size is too small for the value, the ERANGE error should$

ERROR: code indent should never use tabs
#3171: FILE: tools/virtiofsd/fuse_lowlevel.h:809:
+^I * be sent.$

ERROR: code indent should never use tabs
#3172: FILE: tools/virtiofsd/fuse_lowlevel.h:810:
+^I *$

ERROR: code indent should never use tabs
#3173: FILE: tools/virtiofsd/fuse_lowlevel.h:811:
+^I * If this request is answered with an error code of ENOSYS, this is$

ERROR: code indent should never use tabs
#3174: FILE: tools/virtiofsd/fuse_lowlevel.h:812:
+^I * treated as a permanent failure with error code EOPNOTSUPP, i.e. all$

ERROR: code indent should never use tabs
#3175: FILE: tools/virtiofsd/fuse_lowlevel.h:813:
+^I * future getxattr() requests will fail with EOPNOTSUPP without being$

ERROR: code indent should never use tabs
#3176: FILE: tools/virtiofsd/fuse_lowlevel.h:814:
+^I * send to the filesystem process.$

ERROR: code indent should never use tabs
#3177: FILE: tools/virtiofsd/fuse_lowlevel.h:815:
+^I *$

ERROR: code indent should never use tabs
#3178: FILE: tools/virtiofsd/fuse_lowlevel.h:816:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3179: FILE: tools/virtiofsd/fuse_lowlevel.h:817:
+^I * fuse_reply_buf$

ERROR: code indent should never use tabs
#3180: FILE: tools/virtiofsd/fuse_lowlevel.h:818:
+^I * fuse_reply_data$

ERROR: code indent should never use tabs
#3181: FILE: tools/virtiofsd/fuse_lowlevel.h:819:
+^I * fuse_reply_xattr$

ERROR: code indent should never use tabs
#3182: FILE: tools/virtiofsd/fuse_lowlevel.h:820:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3183: FILE: tools/virtiofsd/fuse_lowlevel.h:821:
+^I *$

ERROR: code indent should never use tabs
#3184: FILE: tools/virtiofsd/fuse_lowlevel.h:822:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3185: FILE: tools/virtiofsd/fuse_lowlevel.h:823:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3186: FILE: tools/virtiofsd/fuse_lowlevel.h:824:
+^I * @param name of the extended attribute$

ERROR: code indent should never use tabs #3187: FILE: tools/virtiofsd/fuse_lowlevel.h:825:
+^I * @param size maximum size of the value to send$

ERROR: code indent should never use tabs
#3188: FILE: tools/virtiofsd/fuse_lowlevel.h:826:
+^I */$

ERROR: code indent should never use tabs
#3189: FILE: tools/virtiofsd/fuse_lowlevel.h:827:
+^Ivoid (*getxattr) (fuse_req_t req, fuse_ino_t ino, const char *name,$

ERROR: code indent should never use tabs
#3190: FILE: tools/virtiofsd/fuse_lowlevel.h:828:
+^I^I^I size_t size);$

ERROR: code indent should never use tabs
#3192: FILE: tools/virtiofsd/fuse_lowlevel.h:830:
+^I/**$

ERROR: code indent should never use tabs
#3193: FILE: tools/virtiofsd/fuse_lowlevel.h:831:
+^I * List extended attribute names$

ERROR: code indent should never use tabs
#3194: FILE: tools/virtiofsd/fuse_lowlevel.h:832:
+^I *$

ERROR: code indent should never use tabs
#3195: FILE: tools/virtiofsd/fuse_lowlevel.h:833:
+^I * If size is zero, the total size of the attribute list should be$

ERROR: code indent should never use tabs
#3196: FILE: tools/virtiofsd/fuse_lowlevel.h:834:
+^I * sent with fuse_reply_xattr.$

ERROR: code indent should never use tabs
#3197: FILE: tools/virtiofsd/fuse_lowlevel.h:835:
+^I *$

ERROR: code indent should never use tabs
#3198: FILE: tools/virtiofsd/fuse_lowlevel.h:836:
+^I * If the size is non-zero, and the null character separated$

ERROR: code indent should never use tabs
#3199: FILE: tools/virtiofsd/fuse_lowlevel.h:837:
+^I * attribute list fits in the buffer, the list should be sent with$

ERROR: code indent should never use tabs
#3200: FILE: tools/virtiofsd/fuse_lowlevel.h:838:
+^I * fuse_reply_buf.$

ERROR: code indent should never use tabs
#3201: FILE: tools/virtiofsd/fuse_lowlevel.h:839:
+^I *$

ERROR: code indent should never use tabs
#3202: FILE: tools/virtiofsd/fuse_lowlevel.h:840:
+^I * If the size is too small for the list, the ERANGE error should$

ERROR: code indent should never use tabs
#3203: FILE: tools/virtiofsd/fuse_lowlevel.h:841:
+^I * be sent.$

ERROR: code indent should never use tabs
#3204: FILE: tools/virtiofsd/fuse_lowlevel.h:842:
+^I *$

ERROR: code indent should never use tabs
#3205: FILE: tools/virtiofsd/fuse_lowlevel.h:843:
+^I * If this request is answered with an error code of ENOSYS, this is$

ERROR: code indent should never use tabs
#3206: FILE: tools/virtiofsd/fuse_lowlevel.h:844:
+^I * treated as a permanent failure with error code EOPNOTSUPP, i.e. all$

ERROR: code indent should never use tabs
#3207: FILE: tools/virtiofsd/fuse_lowlevel.h:845:
+^I * future listxattr() requests will fail with EOPNOTSUPP without being$

ERROR: code indent should never use tabs
#3208: FILE: tools/virtiofsd/fuse_lowlevel.h:846:
+^I * send to the filesystem process.$

ERROR: code indent should never use tabs
#3209: FILE: tools/virtiofsd/fuse_lowlevel.h:847:
+^I *$

ERROR: code indent should never use tabs
#3210: FILE: tools/virtiofsd/fuse_lowlevel.h:848:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3211: FILE: tools/virtiofsd/fuse_lowlevel.h:849:
+^I * fuse_reply_buf$

ERROR: code indent should never use tabs
#3212: FILE: tools/virtiofsd/fuse_lowlevel.h:850:
+^I * fuse_reply_data$

ERROR: code indent should never use tabs
#3213: FILE: tools/virtiofsd/fuse_lowlevel.h:851:
+^I * fuse_reply_xattr$

ERROR: code indent should never use tabs
#3214: FILE: tools/virtiofsd/fuse_lowlevel.h:852:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3215: FILE: tools/virtiofsd/fuse_lowlevel.h:853:
+^I *$

ERROR: code indent should never use tabs
#3216: FILE: tools/virtiofsd/fuse_lowlevel.h:854:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3217: FILE: tools/virtiofsd/fuse_lowlevel.h:855:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs #3218: FILE: tools/virtiofsd/fuse_lowlevel.h:856:
+^I * @param size maximum size of the list to send$

ERROR: code indent should never use tabs
#3219: FILE: tools/virtiofsd/fuse_lowlevel.h:857:
+^I */$

ERROR: code indent should never use tabs
#3220: FILE: tools/virtiofsd/fuse_lowlevel.h:858:
+^Ivoid (*listxattr) (fuse_req_t req, fuse_ino_t ino, size_t size);$

ERROR: code indent should never use tabs
#3222: FILE: tools/virtiofsd/fuse_lowlevel.h:860:
+^I/**$

ERROR: code indent should never use tabs
#3223: FILE: tools/virtiofsd/fuse_lowlevel.h:861:
+^I * Remove an extended attribute$

ERROR: code indent should never use tabs
#3224: FILE: tools/virtiofsd/fuse_lowlevel.h:862:
+^I *$

ERROR: code indent should never use tabs
#3225: FILE: tools/virtiofsd/fuse_lowlevel.h:863:
+^I * If this request is answered with an error code of ENOSYS, this is$

ERROR: code indent should never use tabs
#3226: FILE: tools/virtiofsd/fuse_lowlevel.h:864:
+^I * treated as a permanent failure with error code EOPNOTSUPP, i.e. all$

ERROR: code indent should never use tabs
#3227: FILE: tools/virtiofsd/fuse_lowlevel.h:865:
+^I * future removexattr() requests will fail with EOPNOTSUPP without being$

ERROR: code indent should never use tabs
#3228: FILE: tools/virtiofsd/fuse_lowlevel.h:866:
+^I * send to the filesystem process.$

ERROR: code indent should never use tabs
#3229: FILE: tools/virtiofsd/fuse_lowlevel.h:867:
+^I *$

ERROR: code indent should never use tabs
#3230: FILE: tools/virtiofsd/fuse_lowlevel.h:868:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3231: FILE: tools/virtiofsd/fuse_lowlevel.h:869:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3232: FILE: tools/virtiofsd/fuse_lowlevel.h:870:
+^I *$

ERROR: code indent should never use tabs
#3233: FILE: tools/virtiofsd/fuse_lowlevel.h:871:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3234: FILE: tools/virtiofsd/fuse_lowlevel.h:872:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3235: FILE: tools/virtiofsd/fuse_lowlevel.h:873:
+^I * @param name of the extended attribute$

ERROR: code indent should never use tabs
#3236: FILE: tools/virtiofsd/fuse_lowlevel.h:874:
+^I */$

ERROR: code indent should never use tabs
#3237: FILE: tools/virtiofsd/fuse_lowlevel.h:875:
+^Ivoid (*removexattr) (fuse_req_t req, fuse_ino_t ino, const char *name);$

ERROR: code indent should never use tabs
#3239: FILE: tools/virtiofsd/fuse_lowlevel.h:877:
+^I/**$

ERROR: code indent should never use tabs
#3240: FILE: tools/virtiofsd/fuse_lowlevel.h:878:
+^I * Check file access permissions$

ERROR: code indent should never use tabs
#3241: FILE: tools/virtiofsd/fuse_lowlevel.h:879:
+^I *$

ERROR: code indent should never use tabs
#3242: FILE: tools/virtiofsd/fuse_lowlevel.h:880:
+^I * This will be called for the access() and chdir() system$

ERROR: code indent should never use tabs
#3243: FILE: tools/virtiofsd/fuse_lowlevel.h:881:
+^I * calls. If the 'default_permissions' mount option is given,$

ERROR: code indent should never use tabs
#3244: FILE: tools/virtiofsd/fuse_lowlevel.h:882:
+^I * this method is not called.$

ERROR: code indent should never use tabs
#3245: FILE: tools/virtiofsd/fuse_lowlevel.h:883:
+^I *$

ERROR: code indent should never use tabs
#3246: FILE: tools/virtiofsd/fuse_lowlevel.h:884:
+^I * This method is not called under Linux kernel versions 2.4.x$

ERROR: code indent should never use tabs
#3247: FILE: tools/virtiofsd/fuse_lowlevel.h:885:
+^I *$

ERROR: code indent should never use tabs
#3248: FILE: tools/virtiofsd/fuse_lowlevel.h:886:
+^I * If this request is answered with an error code of ENOSYS, this is$

ERROR: code indent should never use tabs
#3249: FILE: tools/virtiofsd/fuse_lowlevel.h:887:
+^I * treated as a permanent success, i.e. this and all future access()$

ERROR: code indent should never use tabs
#3250: FILE: tools/virtiofsd/fuse_lowlevel.h:888:
+^I * requests will succeed without being send to the filesystem process.$

ERROR: code indent should never use tabs
#3251: FILE: tools/virtiofsd/fuse_lowlevel.h:889:
+^I *$

ERROR: code indent should never use tabs
#3252: FILE: tools/virtiofsd/fuse_lowlevel.h:890:
+^I * Valid replies:$

ERROR: code indent should never use tabs
#3253: FILE: tools/virtiofsd/fuse_lowlevel.h:891:
+^I * fuse_reply_err$

ERROR: code indent should never use tabs
#3254: FILE: tools/virtiofsd/fuse_lowlevel.h:892:
+^I *$

ERROR: code indent should never use tabs
#3255: FILE: tools/virtiofsd/fuse_lowlevel.h:893:
+^I * @param req request handle$

ERROR: code indent should never use tabs
#3256: FILE: tools/virtiofsd/fuse_lowlevel.h:894:
+^I * @param ino the inode number$

ERROR: code indent should never use tabs
#3257: FILE: tools/virtiofsd/fuse_lowlevel.h:895:
+^I * @param mask requested access mode$

ERROR: code indent should never use tabs
#3258: FILE: tools/virtiofsd/fuse_lowlevel.h:896:
+^I */$

ERROR: code indent should never use tabs
#3259: FILE: tools/virtiofsd/fuse_lowlevel.h:897:
+^Ivoid (*access) (fuse_req_t req, fuse_ino_t ino, int mask);$

ERROR: code indent should never use tabs
#3261: FILE: tools/virtiofsd/fuse_lowlevel.h:899:
+^I/**$

ERROR: code indent should never use tabs
#3262: FILE: tools/virtiofsd/fuse_lowlevel.h:900:
+^I * Create and open a file$

15,254 lines not shown · raw message

Part of this message is not shown here. View the raw message.

#139 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 24 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This is a full set for virtiofsd - a daemon
that implements the user space side of virtiofs.

I've addressed most review comments from V1; we've got 95 Reviewed-by's out of 110 - I'd like to get a PULL out ASAP.

The set pulls in a big chunk of the upstream libfuse library (unmodified so that it's easy to check it really is upstream), chops all the stuff out we don't need and then adds the
new transport we need. I've formatted everything into qemu's code style - using indent and the clang tools for the files I've imported.

We can't just link with libfuse, since we have to make ABI incompatible changes for the new transport and it's quite invasive; the library is designed to be the basis for multiple filesystems, but all on the same transport.

Running this daemon is typically done with:

    ./virtiofsd --socket-path=/path/socket -o source=/path/to/fs
Quoted 7 lines

connected to a qemu that's then started with:
-chardev socket,id=char0,path=/path/socket -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs

and then in the guest mount with:
mount -t virtiofs myfs /mnt

Our development branch is: https://gitlab.com/virtio-fs/qemu/tree/virtio-fs-dev

FWIW this branch contains more than this series, because it failed to build on 32-bit:

$ make virtiofsd
  CC      tools/virtiofsd/fuse_lowlevel.o
tools/virtiofsd/fuse_lowlevel.c: In function 'do_removemapping':
tools/virtiofsd/fuse_lowlevel.c:1956:60: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Werror=format=]
             "do_removemapping: invalid in, expected %d * %ld, has %ld 
- %ld\n",
                                                            ^
tools/virtiofsd/fuse_lowlevel.c:1956:69: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
             "do_removemapping: invalid in, expected %d * %ld, has %ld 
- %ld\n",
                                                                     ^
tools/virtiofsd/fuse_lowlevel.c:1956:75: error: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t {aka unsigned int}' [-Werror=format=]
             "do_removemapping: invalid in, expected %d * %ld, has %ld 
- %ld\n",

^

And the offending patch is not included in the 109:

$ git show 62d82cfbe5a
commit 62d82cfbe5a2ad05ae3215f2461b76aa9915108d
Author: Dr. David Alan Gilbert <[email protected]>
Date:   Fri Jul 6 18:03:49 2018 +0100

DAX: virtiofsd: Add setup/remove mappings fuse commands

Consider pushing tags with version, so it is easier to diff (virtio-fs-dev got force-pushed).

We don't need libslirp/capstone/dtc but they are still built:

$ make virtiofsd
  GEN     config-host.h
make[1]: Entering directory 'slirp'
  CC      slirp/src/state.o
  CC      slirp/src/tcp_timer.o
  CC      slirp/src/dhcpv6.o
  CC      slirp/src/ip_input.o
  CC      slirp/src/ip6_icmp.o
  CC      slirp/src/bootp.o
  CC      slirp/src/ip6_input.o
  CC      slirp/src/slirp.o
  CC      slirp/src/vmstate.o
  CC      slirp/src/ip_output.o
  CC      slirp/src/ncsi.o
  CC      slirp/src/tcp_output.o
  CC      slirp/src/ndp_table.o
  CC      slirp/src/version.o
  CC      slirp/src/misc.o
  CC      slirp/src/ip6_output.o
  CC      slirp/src/mbuf.o
  CC      slirp/src/tftp.o
  CC      slirp/src/arp_table.o
  CC      slirp/src/util.o
  CC      slirp/src/socket.o
  CC      slirp/src/sbuf.o
  CC      slirp/src/stream.o
  CC      slirp/src/dnssearch.o
  CC      slirp/src/udp.o
  CC      slirp/src/tcp_input.o
  CC      slirp/src/if.o
  CC      slirp/src/cksum.o
  CC      slirp/src/tcp_subr.o
  CC      slirp/src/udp6.o
  CC      slirp/src/ip_icmp.o
  AR      slirp/libslirp.a
make[1]: Leaving directory 'slirp'
         DEP dtc/libfdt/fdt_overlay.c
         DEP dtc/libfdt/fdt_addresses.c
         DEP dtc/libfdt/fdt_empty_tree.c
         DEP dtc/libfdt/fdt_strerror.c
         DEP dtc/libfdt/fdt_rw.c
         DEP dtc/libfdt/fdt_sw.c
         DEP dtc/libfdt/fdt_wip.c
         DEP dtc/libfdt/fdt_ro.c
         DEP dtc/libfdt/fdt.c
         DEP dtc/util.c
         DEP dtc/fdtoverlay.c
         DEP dtc/fdtput.c
         DEP dtc/fdtget.c
         DEP dtc/fdtdump.c
         DEP convert-dtsv0-lexer.lex.c
         DEP dtc/srcpos.c
         BISON dtc-parser.tab.c
         DEP dtc-parser.tab.c
         LEX dtc-lexer.lex.c
         DEP dtc-lexer.lex.c
         DEP dtc/treesource.c
         DEP dtc/livetree.c
         DEP dtc/fstree.c
         DEP dtc/flattree.c
         DEP dtc/dtc.c
         DEP dtc/data.c
         DEP dtc/checks.c
         CC libfdt/fdt.o
         CC libfdt/fdt_ro.o
         CC libfdt/fdt_wip.o
         CC libfdt/fdt_sw.o
         CC libfdt/fdt_rw.o
         CC libfdt/fdt_strerror.o
         CC libfdt/fdt_empty_tree.o
         CC libfdt/fdt_addresses.o
         CC libfdt/fdt_overlay.o
         AR libfdt/libfdt.a
arm-linux-gnueabihf-ar: creating libfdt/libfdt.a
a - libfdt/fdt.o
a - libfdt/fdt_ro.o
a - libfdt/fdt_wip.o
a - libfdt/fdt_sw.o
a - libfdt/fdt_rw.o
a - libfdt/fdt_strerror.o
a - libfdt/fdt_empty_tree.o
a - libfdt/fdt_addresses.o
a - libfdt/fdt_overlay.o
  CC      cs.o
  CC      utils.o
  CC      SStream.o
  CC      MCInstrDesc.o
  CC      MCRegisterInfo.o
  CC      arch/ARM/ARMDisassembler.o
  CC      arch/ARM/ARMInstPrinter.o
  CC      arch/ARM/ARMMapping.o
  CC      arch/ARM/ARMModule.o
  CC      arch/AArch64/AArch64BaseInfo.o
  CC      arch/AArch64/AArch64Disassembler.o
  CC      arch/AArch64/AArch64InstPrinter.o
  CC      arch/AArch64/AArch64Mapping.o
  CC      arch/AArch64/AArch64Module.o
  CC      arch/Mips/MipsDisassembler.o
  CC      arch/Mips/MipsInstPrinter.o
  CC      arch/Mips/MipsMapping.o
  CC      arch/Mips/MipsModule.o
  CC      arch/PowerPC/PPCDisassembler.o
  CC      arch/PowerPC/PPCInstPrinter.o
  CC      arch/PowerPC/PPCMapping.o
  CC      arch/PowerPC/PPCModule.o
  CC      arch/Sparc/SparcDisassembler.o
  CC      arch/Sparc/SparcInstPrinter.o
  CC      arch/Sparc/SparcMapping.o
  CC      arch/Sparc/SparcModule.o
  CC      arch/SystemZ/SystemZDisassembler.o
  CC      arch/SystemZ/SystemZInstPrinter.o
  CC      arch/SystemZ/SystemZMapping.o
  CC      arch/SystemZ/SystemZModule.o
  CC      arch/SystemZ/SystemZMCTargetDesc.o
  CC      arch/X86/X86DisassemblerDecoder.o
  CC      arch/X86/X86Disassembler.o
  CC      arch/X86/X86IntelInstPrinter.o
  CC      arch/X86/X86ATTInstPrinter.o
  CC      arch/X86/X86Mapping.o
  CC      arch/X86/X86Module.o
  CC      arch/XCore/XCoreDisassembler.o
  CC      arch/XCore/XCoreInstPrinter.o
  CC      arch/XCore/XCoreMapping.o
  CC      arch/XCore/XCoreModule.o
  CC      MCInst.o
  AR      libcapstone.a
  CC      tools/virtiofsd/buffer.o
  CC      tools/virtiofsd/fuse_opt.o
  CC      tools/virtiofsd/fuse_log.o
  CC      tools/virtiofsd/fuse_lowlevel.o
  ...

FYI Paolo queued this patch, so libfdt shouldn't get compiled anymore:
https://www.mail-archive.com/[email protected]/msg671667.html

Quoted 209 lines

This code is going into tools/virtiofsd based on the previous long discussion.

Thank you to all those who have contributed code and to those who have reviewed the previous version.

Dave

Dr. David Alan Gilbert (35):
virtiofsd: Pull in upstream headers
virtiofsd: Pull in kernel's fuse.h
virtiofsd: Add auxiliary .c's
virtiofsd: Add fuse_lowlevel.c
virtiofsd: Add passthrough_ll
virtiofsd: Trim down imported files
virtiofsd: Format imported files to qemu style
virtiofsd: Fix fuse_daemonize ignored return values
virtiofsd: Fix common header and define for QEMU builds
virtiofsd: Trim out compatibility code
virtiofsd: Add options for virtio
virtiofsd: Open vhost connection instead of mounting
virtiofsd: Start wiring up vhost-user
virtiofsd: Add main virtio loop
virtiofsd: get/set features callbacks
virtiofsd: Start queue threads
virtiofsd: Poll kick_fd for queue
virtiofsd: Start reading commands from queue
virtiofsd: Send replies to messages
virtiofsd: Keep track of replies
virtiofsd: Add Makefile wiring for virtiofsd contrib
virtiofsd: Fast path for virtio read
virtiofs: Add maintainers entry
virtiofsd: Plumb fuse_bufvec through to do_write_buf
virtiofsd: Pass write iov's all the way through
virtiofsd: cap-ng helpers
docs: Add docs/tools
virtiofsd: Handle reinit
virtiofsd: Handle hard reboot
virtiofsd: Kill threads when queues are stopped
vhost-user: Print unexpected slave message types contrib/libvhost-user: Protect slave fd with mutex
virtiofsd: Clean up inodes on destroy
libvhost-user: Fix some memtable remap cases
virtiofsd: Convert lo_destroy to take the lo->mutex lock itself

Eric Ren (1):
virtiofsd: fix incorrect error handling in lo_do_lookup

Eryu Guan (3):
virtiofsd: print log only when priority is high enough
virtiofsd: convert more fprintf and perror to use fuse log infra
virtiofsd: stop all queue threads on exit in virtio_loop()

Jiufei Xue (1):
virtiofsd: support nanosecond resolution for file timestamp

Liu Bo (6):
virtiofsd: fix error handling in main()
virtiofsd: cleanup allocated resource in se
virtiofsd: fix memory leak on lo.source
virtiofsd: add helper for lo_data cleanup
virtiofsd: enable PARALLEL_DIROPS during INIT
Virtiofsd: fix memory leak on fuse queueinfo

Masayoshi Mizuma (4):
virtiofsd: Add ID to the log with FUSE_LOG_DEBUG level
virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level
virtiofsd: Prevent multiply running with same vhost_user_socket
virtiofsd: add some options to the help message

Miklos Szeredi (10):
virtiofsd: passthrough_ll: add fallback for racy ops
virtiofsd: passthrough_ll: add renameat2 support
virtiofsd: passthrough_ll: disable readdirplus on cache=never
virtiofsd: passthrough_ll: control readdirplus
virtiofsd: rename unref_inode() to unref_inode_lolocked()
virtiofsd: fail when parent inode isn't known in lo_do_lookup()
virtiofsd: extract root inode init into setup_root()
virtiofsd: passthrough_ll: clean up cache related options
virtiofsd: passthrough_ll: use hashtable
virtiofsd: passthrough_ll: fix refcounting on remove/rename

Misono Tomohiro (1):
virtiofsd: Fix data corruption with O_APPEND write in writeback mode

Peng Tao (1):
virtiofsd: do not always set FUSE_FLOCK_LOCKS

Stefan Hajnoczi (37):
virtiofsd: remove mountpoint dummy argument
virtiofsd: remove unused notify reply support
virtiofsd: add -o source=PATH to help output
virtiofsd: add --fd=FDNUM fd passing option
virtiofsd: make -f (foreground) the default
virtiofsd: add vhost-user.json file
virtiofsd: add --print-capabilities option
virtiofsd: passthrough_ll: add lo_map for ino/fh indirection
virtiofsd: passthrough_ll: add ino_map to hide lo_inode pointers
virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers
virtiofsd: passthrough_ll: add fd_map to hide file descriptors
virtiofsd: validate path components
virtiofsd: add fuse_mbuf_iter API
virtiofsd: validate input buffer sizes in do_write_buf()
virtiofsd: check input buffer size in fuse_lowlevel.c ops
virtiofsd: prevent ".." escape in lo_do_lookup()
virtiofsd: prevent ".." escape in lo_do_readdir()
virtiofsd: use /proc/self/fd/ O_PATH file descriptor
virtiofsd: sandbox mount namespace
virtiofsd: move to an empty network namespace
virtiofsd: move to a new pid namespace
virtiofsd: add seccomp whitelist
virtiofsd: set maximum RLIMIT_NOFILE limit
virtiofsd: fix libfuse information leaks
virtiofsd: add security guide document
virtiofsd: add --syslog command-line option
virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy()
virtiofsd: prevent fv_queue_thread() vs virtio_loop() races
virtiofsd: make lo_release() atomic
virtiofsd: prevent races with lo_dirp_put()
virtiofsd: rename inode->refcount to inode->nlookup
virtiofsd: add man page
virtiofsd: introduce inode refcount to prevent use-after-free
virtiofsd: process requests in a thread pool
virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races
virtiofsd: fix lo_destroy() resource leaks
virtiofsd: add --thread-pool-size=NUM option

Vivek Goyal (6):
virtiofsd: Make fsync work even if only inode is passed in
virtiofsd: passthrough_ll: create new files in caller's context
virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV
virtiofsd: Drop CAP_FSETID if client asked for it
virtiofsd: Support remote posix locks
virtiofsd: Reset O_DIRECT flag during file open

Xiao Yang (2):
vitriofsd/passthrough_ll: fix fallocate() ifdefs virtiofsd/passthrough_ll: Pass errno to fuse_reply_err()

piaojun (2):
virtiofsd: add definition of fuse_buf_writev()
virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better
performance

  .gitignore                                |    1 +
  MAINTAINERS                               |    8 +
  Makefile                                  |   27 +-
  Makefile.objs                             |    1 +
  configure                                 |   16 +
  contrib/libvhost-user/libvhost-user.c     |   57 +-
  contrib/libvhost-user/libvhost-user.h     |    6 +
  docs/index.rst                            |    1 +
  docs/interop/vhost-user.json              |    4 +-
  docs/tools/conf.py                        |   16 +
  docs/tools/index.rst                      |   14 +
  docs/tools/virtiofsd-security.rst         |  118 +
  hw/virtio/vhost-user.c                    |    2 +-
  include/standard-headers/linux/fuse.h     |  891 ++++++
  scripts/update-linux-headers.sh           |    1 +
  tools/virtiofsd/50-qemu-virtiofsd.json.in |    5 +
  tools/virtiofsd/Makefile.objs             |   12 +
  tools/virtiofsd/buffer.c                  |  351 +++
  tools/virtiofsd/fuse.h                    | 1249 +++++++++
  tools/virtiofsd/fuse_common.h             |  860 ++++++
  tools/virtiofsd/fuse_i.h                  |  115 +
  tools/virtiofsd/fuse_log.c                |   40 +
  tools/virtiofsd/fuse_log.h                |   74 +
  tools/virtiofsd/fuse_lowlevel.c           | 2779 +++++++++++++++++++
  tools/virtiofsd/fuse_lowlevel.h           | 2023 ++++++++++++++
  tools/virtiofsd/fuse_misc.h               |   60 +
  tools/virtiofsd/fuse_opt.c                |  449 +++
  tools/virtiofsd/fuse_opt.h                |  272 ++
  tools/virtiofsd/fuse_signals.c            |   97 +
  tools/virtiofsd/fuse_virtio.c             |  985 +++++++
  tools/virtiofsd/fuse_virtio.h             |   33 +
  tools/virtiofsd/helper.c                  |  349 +++
  tools/virtiofsd/passthrough_helpers.h     |   51 +
  tools/virtiofsd/passthrough_ll.c          | 3006 +++++++++++++++++++++
  tools/virtiofsd/seccomp.c                 |  164 ++
  tools/virtiofsd/seccomp.h                 |   16 +
  tools/virtiofsd/virtiofsd.texi            |  104 +
  37 files changed, 14242 insertions(+), 15 deletions(-)

create mode 100644 docs/tools/conf.py
create mode 100644 docs/tools/index.rst
create mode 100644 docs/tools/virtiofsd-security.rst create mode 100644 include/standard-headers/linux/fuse.h create mode 100644 tools/virtiofsd/50-qemu-virtiofsd.json.in create mode 100644 tools/virtiofsd/Makefile.objs create mode 100644 tools/virtiofsd/buffer.c
create mode 100644 tools/virtiofsd/fuse.h
create mode 100644 tools/virtiofsd/fuse_common.h create mode 100644 tools/virtiofsd/fuse_i.h
create mode 100644 tools/virtiofsd/fuse_log.c create mode 100644 tools/virtiofsd/fuse_log.h create mode 100644 tools/virtiofsd/fuse_lowlevel.c create mode 100644 tools/virtiofsd/fuse_lowlevel.h create mode 100644 tools/virtiofsd/fuse_misc.h create mode 100644 tools/virtiofsd/fuse_opt.c create mode 100644 tools/virtiofsd/fuse_opt.h create mode 100644 tools/virtiofsd/fuse_signals.c create mode 100644 tools/virtiofsd/fuse_virtio.c create mode 100644 tools/virtiofsd/fuse_virtio.h create mode 100644 tools/virtiofsd/helper.c
create mode 100644 tools/virtiofsd/passthrough_helpers.h create mode 100644 tools/virtiofsd/passthrough_ll.c create mode 100644 tools/virtiofsd/seccomp.c create mode 100644 tools/virtiofsd/seccomp.h create mode 100644 tools/virtiofsd/virtiofsd.texi

#140 lore raw
Quoted 28 lines · * Philippe Mathieu-Daudé ([email protected]) wrote:
Quoted 27 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This is a full set for virtiofsd - a daemon
that implements the user space side of virtiofs.

I've addressed most review comments from V1; we've got 95 Reviewed-by's out of 110 - I'd like to get a PULL out ASAP.

The set pulls in a big chunk of the upstream libfuse library (unmodified so that it's easy to check it really is upstream), chops all the stuff out we don't need and then adds the
new transport we need. I've formatted everything into qemu's code style - using indent and the clang tools for the files I've imported.

We can't just link with libfuse, since we have to make ABI incompatible changes for the new transport and it's quite invasive; the library is designed to be the basis for multiple filesystems, but all on the same transport.

Running this daemon is typically done with:

    ./virtiofsd --socket-path=/path/socket -o source=/path/to/fs

connected to a qemu that's then started with:
-chardev socket,id=char0,path=/path/socket -device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=myfs

Quoted 7 lines
Quoted 4 lines

and then in the guest mount with:
mount -t virtiofs myfs /mnt

Our development branch is: https://gitlab.com/virtio-fs/qemu/tree/virtio-fs-dev

FWIW this branch contains more than this series, because it failed to build on 32-bit:

Right; it's got a whole bunch of stuff that's not ready yet - that's why it's -dev.

Quoted 30 lines
$ make virtiofsd
  CC      tools/virtiofsd/fuse_lowlevel.o
tools/virtiofsd/fuse_lowlevel.c: In function 'do_removemapping':
tools/virtiofsd/fuse_lowlevel.c:1956:60: error: format '%ld' expects
argument of type 'long int', but argument 4 has type 'unsigned int'
[-Werror=format=]
             "do_removemapping: invalid in, expected %d * %ld, has %ld -
%ld\n",
                                                            ^
tools/virtiofsd/fuse_lowlevel.c:1956:69: error: format '%ld' expects
argument of type 'long int', but argument 5 has type 'size_t {aka unsigned
int}' [-Werror=format=]
             "do_removemapping: invalid in, expected %d * %ld, has %ld -
%ld\n",
                                                                     ^
tools/virtiofsd/fuse_lowlevel.c:1956:75: error: format '%ld' expects
argument of type 'long int', but argument 6 has type 'size_t {aka unsigned
int}' [-Werror=format=]
             "do_removemapping: invalid in, expected %d * %ld, has %ld -
%ld\n",
   ^

And the offending patch is not included in the 109:

$ git show 62d82cfbe5a
commit 62d82cfbe5a2ad05ae3215f2461b76aa9915108d
Author: Dr. David Alan Gilbert <[email protected]>
Date:   Fri Jul 6 18:03:49 2018 +0100
Quoted 4 lines

DAX: virtiofsd: Add setup/remove mappings fuse commands

Consider pushing tags with version, so it is easier to diff (virtio-fs-dev got force-pushed).

Yep, I already did; it's:

https://gitlab.com/virtio-fs/qemu/tree/virtio-fs-as-posted-2020-01-21

Quoted 2 lines

We don't need libslirp/capstone/dtc but they are still built:

Hmm now wth are those dependencies coming from....

Dave

Quoted 132 lines
$ make virtiofsd
  GEN     config-host.h
make[1]: Entering directory 'slirp'
  CC      slirp/src/state.o
  CC      slirp/src/tcp_timer.o
  CC      slirp/src/dhcpv6.o
  CC      slirp/src/ip_input.o
  CC      slirp/src/ip6_icmp.o
  CC      slirp/src/bootp.o
  CC      slirp/src/ip6_input.o
  CC      slirp/src/slirp.o
  CC      slirp/src/vmstate.o
  CC      slirp/src/ip_output.o
  CC      slirp/src/ncsi.o
  CC      slirp/src/tcp_output.o
  CC      slirp/src/ndp_table.o
  CC      slirp/src/version.o
  CC      slirp/src/misc.o
  CC      slirp/src/ip6_output.o
  CC      slirp/src/mbuf.o
  CC      slirp/src/tftp.o
  CC      slirp/src/arp_table.o
  CC      slirp/src/util.o
  CC      slirp/src/socket.o
  CC      slirp/src/sbuf.o
  CC      slirp/src/stream.o
  CC      slirp/src/dnssearch.o
  CC      slirp/src/udp.o
  CC      slirp/src/tcp_input.o
  CC      slirp/src/if.o
  CC      slirp/src/cksum.o
  CC      slirp/src/tcp_subr.o
  CC      slirp/src/udp6.o
  CC      slirp/src/ip_icmp.o
  AR      slirp/libslirp.a
make[1]: Leaving directory 'slirp'
         DEP dtc/libfdt/fdt_overlay.c
         DEP dtc/libfdt/fdt_addresses.c
         DEP dtc/libfdt/fdt_empty_tree.c
         DEP dtc/libfdt/fdt_strerror.c
         DEP dtc/libfdt/fdt_rw.c
         DEP dtc/libfdt/fdt_sw.c
         DEP dtc/libfdt/fdt_wip.c
         DEP dtc/libfdt/fdt_ro.c
         DEP dtc/libfdt/fdt.c
         DEP dtc/util.c
         DEP dtc/fdtoverlay.c
         DEP dtc/fdtput.c
         DEP dtc/fdtget.c
         DEP dtc/fdtdump.c
         DEP convert-dtsv0-lexer.lex.c
         DEP dtc/srcpos.c
         BISON dtc-parser.tab.c
         DEP dtc-parser.tab.c
         LEX dtc-lexer.lex.c
         DEP dtc-lexer.lex.c
         DEP dtc/treesource.c
         DEP dtc/livetree.c
         DEP dtc/fstree.c
         DEP dtc/flattree.c
         DEP dtc/dtc.c
         DEP dtc/data.c
         DEP dtc/checks.c
         CC libfdt/fdt.o
         CC libfdt/fdt_ro.o
         CC libfdt/fdt_wip.o
         CC libfdt/fdt_sw.o
         CC libfdt/fdt_rw.o
         CC libfdt/fdt_strerror.o
         CC libfdt/fdt_empty_tree.o
         CC libfdt/fdt_addresses.o
         CC libfdt/fdt_overlay.o
         AR libfdt/libfdt.a
arm-linux-gnueabihf-ar: creating libfdt/libfdt.a
a - libfdt/fdt.o
a - libfdt/fdt_ro.o
a - libfdt/fdt_wip.o
a - libfdt/fdt_sw.o
a - libfdt/fdt_rw.o
a - libfdt/fdt_strerror.o
a - libfdt/fdt_empty_tree.o
a - libfdt/fdt_addresses.o
a - libfdt/fdt_overlay.o
  CC      cs.o
  CC      utils.o
  CC      SStream.o
  CC      MCInstrDesc.o
  CC      MCRegisterInfo.o
  CC      arch/ARM/ARMDisassembler.o
  CC      arch/ARM/ARMInstPrinter.o
  CC      arch/ARM/ARMMapping.o
  CC      arch/ARM/ARMModule.o
  CC      arch/AArch64/AArch64BaseInfo.o
  CC      arch/AArch64/AArch64Disassembler.o
  CC      arch/AArch64/AArch64InstPrinter.o
  CC      arch/AArch64/AArch64Mapping.o
  CC      arch/AArch64/AArch64Module.o
  CC      arch/Mips/MipsDisassembler.o
  CC      arch/Mips/MipsInstPrinter.o
  CC      arch/Mips/MipsMapping.o
  CC      arch/Mips/MipsModule.o
  CC      arch/PowerPC/PPCDisassembler.o
  CC      arch/PowerPC/PPCInstPrinter.o
  CC      arch/PowerPC/PPCMapping.o
  CC      arch/PowerPC/PPCModule.o
  CC      arch/Sparc/SparcDisassembler.o
  CC      arch/Sparc/SparcInstPrinter.o
  CC      arch/Sparc/SparcMapping.o
  CC      arch/Sparc/SparcModule.o
  CC      arch/SystemZ/SystemZDisassembler.o
  CC      arch/SystemZ/SystemZInstPrinter.o
  CC      arch/SystemZ/SystemZMapping.o
  CC      arch/SystemZ/SystemZModule.o
  CC      arch/SystemZ/SystemZMCTargetDesc.o
  CC      arch/X86/X86DisassemblerDecoder.o
  CC      arch/X86/X86Disassembler.o
  CC      arch/X86/X86IntelInstPrinter.o
  CC      arch/X86/X86ATTInstPrinter.o
  CC      arch/X86/X86Mapping.o
  CC      arch/X86/X86Module.o
  CC      arch/XCore/XCoreDisassembler.o
  CC      arch/XCore/XCoreInstPrinter.o
  CC      arch/XCore/XCoreMapping.o
  CC      arch/XCore/XCoreModule.o
  CC      MCInst.o
  AR      libcapstone.a
  CC      tools/virtiofsd/buffer.o
  CC      tools/virtiofsd/fuse_opt.o
  CC      tools/virtiofsd/fuse_log.o
  CC      tools/virtiofsd/fuse_lowlevel.o
  ...
Quoted 213 lines

FYI Paolo queued this patch, so libfdt shouldn't get compiled anymore:
https://www.mail-archive.com/[email protected]/msg671667.html

Quoted 209 lines

This code is going into tools/virtiofsd based on the previous long discussion.

Thank you to all those who have contributed code and to those who have reviewed the previous version.

Dave

Dr. David Alan Gilbert (35):
virtiofsd: Pull in upstream headers
virtiofsd: Pull in kernel's fuse.h
virtiofsd: Add auxiliary .c's
virtiofsd: Add fuse_lowlevel.c
virtiofsd: Add passthrough_ll
virtiofsd: Trim down imported files
virtiofsd: Format imported files to qemu style
virtiofsd: Fix fuse_daemonize ignored return values
virtiofsd: Fix common header and define for QEMU builds
virtiofsd: Trim out compatibility code
virtiofsd: Add options for virtio
virtiofsd: Open vhost connection instead of mounting
virtiofsd: Start wiring up vhost-user
virtiofsd: Add main virtio loop
virtiofsd: get/set features callbacks
virtiofsd: Start queue threads
virtiofsd: Poll kick_fd for queue
virtiofsd: Start reading commands from queue
virtiofsd: Send replies to messages
virtiofsd: Keep track of replies
virtiofsd: Add Makefile wiring for virtiofsd contrib
virtiofsd: Fast path for virtio read
virtiofs: Add maintainers entry
virtiofsd: Plumb fuse_bufvec through to do_write_buf
virtiofsd: Pass write iov's all the way through
virtiofsd: cap-ng helpers
docs: Add docs/tools
virtiofsd: Handle reinit
virtiofsd: Handle hard reboot
virtiofsd: Kill threads when queues are stopped
vhost-user: Print unexpected slave message types contrib/libvhost-user: Protect slave fd with mutex
virtiofsd: Clean up inodes on destroy
libvhost-user: Fix some memtable remap cases
virtiofsd: Convert lo_destroy to take the lo->mutex lock itself

Eric Ren (1):
virtiofsd: fix incorrect error handling in lo_do_lookup

Eryu Guan (3):
virtiofsd: print log only when priority is high enough
virtiofsd: convert more fprintf and perror to use fuse log infra
virtiofsd: stop all queue threads on exit in virtio_loop()

Jiufei Xue (1):
virtiofsd: support nanosecond resolution for file timestamp

Liu Bo (6):
virtiofsd: fix error handling in main()
virtiofsd: cleanup allocated resource in se
virtiofsd: fix memory leak on lo.source
virtiofsd: add helper for lo_data cleanup
virtiofsd: enable PARALLEL_DIROPS during INIT
Virtiofsd: fix memory leak on fuse queueinfo

Masayoshi Mizuma (4):
virtiofsd: Add ID to the log with FUSE_LOG_DEBUG level
virtiofsd: Add timestamp to the log with FUSE_LOG_DEBUG level
virtiofsd: Prevent multiply running with same vhost_user_socket
virtiofsd: add some options to the help message

Miklos Szeredi (10):
virtiofsd: passthrough_ll: add fallback for racy ops
virtiofsd: passthrough_ll: add renameat2 support
virtiofsd: passthrough_ll: disable readdirplus on cache=never
virtiofsd: passthrough_ll: control readdirplus
virtiofsd: rename unref_inode() to unref_inode_lolocked()
virtiofsd: fail when parent inode isn't known in lo_do_lookup()
virtiofsd: extract root inode init into setup_root()
virtiofsd: passthrough_ll: clean up cache related options
virtiofsd: passthrough_ll: use hashtable
virtiofsd: passthrough_ll: fix refcounting on remove/rename

Misono Tomohiro (1):
virtiofsd: Fix data corruption with O_APPEND write in writeback mode

Peng Tao (1):
virtiofsd: do not always set FUSE_FLOCK_LOCKS

Stefan Hajnoczi (37):
virtiofsd: remove mountpoint dummy argument
virtiofsd: remove unused notify reply support
virtiofsd: add -o source=PATH to help output
virtiofsd: add --fd=FDNUM fd passing option
virtiofsd: make -f (foreground) the default
virtiofsd: add vhost-user.json file
virtiofsd: add --print-capabilities option
virtiofsd: passthrough_ll: add lo_map for ino/fh indirection
virtiofsd: passthrough_ll: add ino_map to hide lo_inode pointers
virtiofsd: passthrough_ll: add dirp_map to hide lo_dirp pointers
virtiofsd: passthrough_ll: add fd_map to hide file descriptors
virtiofsd: validate path components
virtiofsd: add fuse_mbuf_iter API
virtiofsd: validate input buffer sizes in do_write_buf()
virtiofsd: check input buffer size in fuse_lowlevel.c ops
virtiofsd: prevent ".." escape in lo_do_lookup()
virtiofsd: prevent ".." escape in lo_do_readdir()
virtiofsd: use /proc/self/fd/ O_PATH file descriptor
virtiofsd: sandbox mount namespace
virtiofsd: move to an empty network namespace
virtiofsd: move to a new pid namespace
virtiofsd: add seccomp whitelist
virtiofsd: set maximum RLIMIT_NOFILE limit
virtiofsd: fix libfuse information leaks
virtiofsd: add security guide document
virtiofsd: add --syslog command-line option
virtiofsd: use fuse_lowlevel_is_virtio() in fuse_session_destroy()
virtiofsd: prevent fv_queue_thread() vs virtio_loop() races
virtiofsd: make lo_release() atomic
virtiofsd: prevent races with lo_dirp_put()
virtiofsd: rename inode->refcount to inode->nlookup
virtiofsd: add man page
virtiofsd: introduce inode refcount to prevent use-after-free
virtiofsd: process requests in a thread pool
virtiofsd: prevent FUSE_INIT/FUSE_DESTROY races
virtiofsd: fix lo_destroy() resource leaks
virtiofsd: add --thread-pool-size=NUM option

Vivek Goyal (6):
virtiofsd: Make fsync work even if only inode is passed in
virtiofsd: passthrough_ll: create new files in caller's context
virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV
virtiofsd: Drop CAP_FSETID if client asked for it
virtiofsd: Support remote posix locks
virtiofsd: Reset O_DIRECT flag during file open

Xiao Yang (2):
vitriofsd/passthrough_ll: fix fallocate() ifdefs virtiofsd/passthrough_ll: Pass errno to fuse_reply_err()

piaojun (2):
virtiofsd: add definition of fuse_buf_writev()
virtiofsd: use fuse_buf_writev to replace fuse_buf_write for better
performance

  .gitignore                                |    1 +
  MAINTAINERS                               |    8 +
  Makefile                                  |   27 +-
  Makefile.objs                             |    1 +
  configure                                 |   16 +
  contrib/libvhost-user/libvhost-user.c     |   57 +-
  contrib/libvhost-user/libvhost-user.h     |    6 +
  docs/index.rst                            |    1 +
  docs/interop/vhost-user.json              |    4 +-
  docs/tools/conf.py                        |   16 +
  docs/tools/index.rst                      |   14 +
  docs/tools/virtiofsd-security.rst         |  118 +
  hw/virtio/vhost-user.c                    |    2 +-
  include/standard-headers/linux/fuse.h     |  891 ++++++
  scripts/update-linux-headers.sh           |    1 +
  tools/virtiofsd/50-qemu-virtiofsd.json.in |    5 +
  tools/virtiofsd/Makefile.objs             |   12 +
  tools/virtiofsd/buffer.c                  |  351 +++
  tools/virtiofsd/fuse.h                    | 1249 +++++++++
  tools/virtiofsd/fuse_common.h             |  860 ++++++
  tools/virtiofsd/fuse_i.h                  |  115 +
  tools/virtiofsd/fuse_log.c                |   40 +
  tools/virtiofsd/fuse_log.h                |   74 +
  tools/virtiofsd/fuse_lowlevel.c           | 2779 +++++++++++++++++++
  tools/virtiofsd/fuse_lowlevel.h           | 2023 ++++++++++++++
  tools/virtiofsd/fuse_misc.h               |   60 +
  tools/virtiofsd/fuse_opt.c                |  449 +++
  tools/virtiofsd/fuse_opt.h                |  272 ++
  tools/virtiofsd/fuse_signals.c            |   97 +
  tools/virtiofsd/fuse_virtio.c             |  985 +++++++
  tools/virtiofsd/fuse_virtio.h             |   33 +
  tools/virtiofsd/helper.c                  |  349 +++
  tools/virtiofsd/passthrough_helpers.h     |   51 +
  tools/virtiofsd/passthrough_ll.c          | 3006 +++++++++++++++++++++
  tools/virtiofsd/seccomp.c                 |  164 ++
  tools/virtiofsd/seccomp.h                 |   16 +
  tools/virtiofsd/virtiofsd.texi            |  104 +
  37 files changed, 14242 insertions(+), 15 deletions(-)

create mode 100644 docs/tools/conf.py
create mode 100644 docs/tools/index.rst
create mode 100644 docs/tools/virtiofsd-security.rst create mode 100644 include/standard-headers/linux/fuse.h create mode 100644 tools/virtiofsd/50-qemu-virtiofsd.json.in create mode 100644 tools/virtiofsd/Makefile.objs create mode 100644 tools/virtiofsd/buffer.c
create mode 100644 tools/virtiofsd/fuse.h
create mode 100644 tools/virtiofsd/fuse_common.h create mode 100644 tools/virtiofsd/fuse_i.h
create mode 100644 tools/virtiofsd/fuse_log.c create mode 100644 tools/virtiofsd/fuse_log.h create mode 100644 tools/virtiofsd/fuse_lowlevel.c create mode 100644 tools/virtiofsd/fuse_lowlevel.h create mode 100644 tools/virtiofsd/fuse_misc.h create mode 100644 tools/virtiofsd/fuse_opt.c create mode 100644 tools/virtiofsd/fuse_opt.h create mode 100644 tools/virtiofsd/fuse_signals.c create mode 100644 tools/virtiofsd/fuse_virtio.c create mode 100644 tools/virtiofsd/fuse_virtio.h create mode 100644 tools/virtiofsd/helper.c
create mode 100644 tools/virtiofsd/passthrough_helpers.h create mode 100644 tools/virtiofsd/passthrough_ll.c create mode 100644 tools/virtiofsd/seccomp.c create mode 100644 tools/virtiofsd/seccomp.h create mode 100644 tools/virtiofsd/virtiofsd.texi

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK