Some judgement calls were made about unnecessary wrapping. Usually they
would get resolved by removing the wrapping or returning a convenient
error, but the ones that returned results for consistency with other
functions were added to the allow list.
The error handling in the usb code had a lot of unit error types which
is now a clippy lint. This was resolved by either removing the result
entirely or returning a convenient error.
The field_reassign_with_default lint is faulty and was added to the list
of supressions. This affected virtio-wayland code.
BUG=b:179277332
TEST=cargo clippy with rustc 1.50+
Change-Id: Ie812cdeaf7c42f4f2b47b1dc87f05a7c87a60f8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2757510
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Zach Reizner <zachr@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
When the file system implements zero message open support, the file
handle is meaningless and it needs to know the inode of the
file/directory on which the ioctl was called.
BUG=b:180565632
TEST=lsattr, chattr, both work when zero message open is enabled.
Android's FileBasedEncryptionPolicyTest[0] gets ENOTTY as an error
instead of EBADF
[0]: bfbc00c20d/tests/tests/security/native/encryption/FileBasedEncryptionPolicyTest.cpp
Change-Id: Ic55ee95df928d645874dd8a9c7dc579b708927fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2706370
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: kokoro <noreply+kokoro@google.com>
Enable the ZERO_MESSAGE_{OPEN,OPENDIR} features when the cache policy is
"always". This feature allows the kernel to skip the open message after
a successful lookup, reducing the amount of work that the server does.
This is implemented by changing the file descriptors stored in the
InodeData from O_PATH fds to O_RDONLY fds for files and directories.
Other types of directory entries (symlinks, special files, etc) still
use O_PATH fds.
If the kernel sends a write request for an fd opened in read-only mode
or a read request for an fd opened in write-only mode (can happen when
creating a new file), then we open a new fd in read-write mode before
performing the read/write. This only needs to happen the first time we
get a request that doesn't match the open flags.
This change should improve performance of opening and reading many small
files. It improves the blogbench read score by ~40% but reduces the
write score by ~25%. It also reduces the work done by the virtio-fs
server when loading roblox. The first load time is reduced by
~17% (3.04 seconds -> 2.52 seconds) and non-initial load times are
reduced by 50% (0.3 seconds -> 0.15 seconds).
BUG=none
TEST=vm.Virtiofs, vm.Blogbench.virtiofs, arc.PlayStore.vm, load roblox
inside arcvm
Change-Id: I042246a2fd9f7a0feeffc0f629073c594626392a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2684066
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
This was based on an unmerged set of kernel patches that have now been
dropped from the chrome os kernel as well. Remove them here.
BUG=none
TEST=cargo test
Change-Id: Id307bb0b51879033ea82c2d360a57752728fbf3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2684065
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
From fuse/dev.c in Linux kernel[1], max_write should not include the
headers. Without this fix, the buffer returned by the FUSE device comes
with a header that fails this check.
[1] https://elixir.bootlin.com/linux/v5.11-rc7/source/fs/fuse/dev.c#L1220
BUG=chromium:1176310
TEST=large write succeeds after applying this fix
Change-Id: I321c27a0ca005de6a021bdf044b7d859b57f1cfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2685219
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
The fuzz_server interface was updated to require a Mapper; however,
fs_server fuzzer was not updated to provide one, and it does not seem
necessary since the Mapper calls don't affect control flow in the
server. Instead, just provide a no-op Mapper inside fuzz_server.
Fixes fs_server_fuzzer build.
BUG=chromium:1166742
TEST=FEATURES=test emerge-amd64-generic crosvm # --profile=asan
Change-Id: I6f2d2c7156056976a2e5dd1d7b5a29a231608150
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2629970
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Support virtio-fs's DAX (direct memory access) operation which allows the guest
to directly access file pages.
Specifically, FUSE_SETUP_MAPPING and FUSE_REMOVE_MAPPING operations are
supported.
This option can be used by specifing `dax` option when mount a file system in
the guest.
The DAX optoin improved file I/O performance in most cases.
In Fio tests, both of read and write score were improved by 1.3-14x depending on
test cases.
In Blogbench tests, which create many small files, DAX improved the write score
by 1.5x while the read score was reduced to ~25% (20391 -> 4593).
Here is an excerpt of results:
Fio
* seq_read: 10.2x (143528 -> 1464911)
* seq_write: 3.3x (61253 -> 896791)
* rand_read: 11.6x (138753 -> 1612739)
* rand_write: 14.6x (61253 -> 896791)
* surfing_read: 1.3x (98473 -> 127907)
* surfing_write: 1.3x (83309 -> 108089)
Blogbench
* read: 0.23x (20391 -> 4593)
* write: 1.50x (248 -> 373)
BUG=b:147341783
TEST=Run vm.{Blogbench, Fio} with CL:2291856
Change-Id: I4a47c601412ed32d926de6304337e1594252d258
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2108315
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This is a chromeos extension to fuse to support the O_TMPFILE flag.
BUG=b:160932094
TEST=Open a file with O_TMPFILE on a virtio-fs mount
Change-Id: I21a6390e919d5949fbd12bb304b20374b9b9172a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2520561
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
The mount API is useful especially in an environment without typical
fusermount setuid program (e.g. Android).
BUG=b:173507504
TEST=create a FUSE fs, run with cap_sys_admin, can read from the mount
point
TEST=build_test.py
Change-Id: Ibfc220e8cf59b54d55f5d030d2e4c4375d3654cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2556079
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This simplies the complexity to deal with ownership and mutability,
while considering both the virtio-fs and regular FUSE use cases.
BUG=b:168305155
TEST=./build_test
Change-Id: Ic77d8e0b922e74a5733b99eeff41946177666c8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2500944
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
The current crate still require some work to be really reusable as a
regular FUSE, i.e. with a new reader/writer against /dev/fuse. This
change intends to focus on creating the crate, without trying to find
the optimal interface, and still keep virtio/fs working.
BUG=b:168305155
TEST=./build_test
TEST=USE='asan fuzzer' emerge-hatch crosvm
Change-Id: I8b623c9262221113b720c10125a6770763f14dc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2466484
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>