Commit Graph
34 Commits
Author SHA1 Message Date
Rahat MahmoodandgVisor bot 0fb93a3804 Fix error handling on fusefs mount.
Don't propagate arbitrary golang errors up from fusefs because errors
that don't map to an errno result in a sentry panic.

Reported-by: [email protected]
PiperOrigin-RevId: 346220306
2020-12-07 18:00:54 -08:00
Howard Zhang 5e05e65032 ARM64:fuse:alian stat struct order on multiarch
fields order in stat struct is different from
x86 to arm64. Please refer to
x86_64-linux-gnu/bits/stat.h
aarch64-linux-gnu/bits/stat.h

Signed-off-by: Howard Zhang <[email protected]>
2020-11-03 10:35:28 +08:00
Jinmou Li 4fcf6978be Fix kernfs unlinkat and rmdirat incorrect resolved path name 2020-09-17 21:07:12 +00:00
gVisor bot 28615147ce Merge pull request #3934 from avagin:feature/fuse
PiperOrigin-RevId: 332122081
2020-09-16 17:12:57 -07:00
Jinmou LiandAndrei Vagin 428f79cd85 FUSE readdir test fix ino initialization 2020-09-16 12:22:17 -07:00
Andrei Vagin cb190293d4 test/fuse: use the getdents syscall instead of opendir/readdir
opendir() is a libc wrapper. Different libc-s can implement it
differently.
2020-09-16 12:22:17 -07:00
Andrei VaginandAndrei Vagin eea7979844 test/fuse: clean up 2020-09-16 12:22:17 -07:00
Andrei VaginandAndrei Vagin f3d3db8e54 fuse: fix a compile time error
readdir_test.cc:134:24: error: variable length arrays are a C99 feature [-Werror,-Wvla-extension]
  char readdir_payload[readdir_payload_size];
2020-09-16 12:22:17 -07:00
Boyuan HeandAndrei Vagin c740986acd Implement FUSE_UNLINK
Fixes #3696
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 841bd4fa2e Implement FUSE_SETATTR
This commit implements FUSE_SETATTR command. When a system call modifies
the metadata of a regular file or a folder by chown(2), chmod(2),
truncate(2), utime(2), or utimes(2), they should be translated to
corresponding FUSE_SETATTR command and sent to the FUSE server.

Fixes #3332
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 9a758a8846 Add fh support for revise attr and fstat(2) test
According to Linux 4.4's FUSE behavior, the flags and fh attributes in
FUSE_GETATTR are only used in read, write, and lseek. fstat(2) doesn't
use them either. Add tests to ensure the requests sent from FUSE module
are consistent with Linux's.

Updates #3655
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 2322c266bb Add fuse_fd_util library to include common fuse fd test functions 2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 571a451c4e Add default attr in fuse_util
fuse_util provides utilities for fuse testing. Add a function to return
a stub fuse_attr struct with specified mode and nodeid.
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin 4015d3c193 Implement FUSE_WRITE
This commit adds basic write(2) support for FUSE.
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 412dee599f Implement FUSE_CREATE
FUSE_CREATE is called when issuing creat(2) or open(2) with O_CREAT. It
creates a new file on the FUSE filesystem.

Fixes #3825
2020-09-16 12:19:30 -07:00
f8a9e6fb3f fuse: Implement IterDirents for directory file description
Fixes #3255.

This change adds support for IterDirents. You can now use `ls` in
the FUSE sandbox.

Co-authored-by: Craig Chi <[email protected]>
2020-09-16 12:19:30 -07:00
d3830021b5 Implement FUSE_RMDIR
Fixes #3587

Co-authored-by: Craig Chi <[email protected]>
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin 83ebae0684 Implement FUSE_READ
Fixes #3206
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 394fba31a7 Implement FUSE_MKDIR
Fixes #3392
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin d68aefce94 Implement FUSE_READLINK
Fixes #3316
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin e7dada4569 Implement FUSE_SYMLINK
Fixes #3452
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 8eaaa03c68 Implement FUSE_MKNOD
Fixes #3492
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 2a7e93158f Implement FUSE_RELEASE/RELEASEDIR
Fixes #3314
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin fa559f2361 Implement FUSE_OPEN/OPENDIR
Fixes #3174
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 241ba6dfaf Add function to create a fake inode in FUSE integration test
Adds a function for the testing thread to set up a fake inode with a
specific path under mount point. After this function is called, each
subsequent FUSE_LOOKUP request with the same path will be served with
the fixed stub response.

Fixes #3539
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 56937e782e Add function generating array of iovec with different FUSE structs
This commit adds a function in the newly created fuse_util library,
which accepts a variable number of arguments and data structures.

Fixes #3609
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin dcdda6ff58 Add functions in FUSE integration test to get metrics from FUSE server
This commit adds 3 utility functions to ensure all received requests
and preset responses are consumed.

1. Get number of unconsumed requests (received by the FUSE server but
   not consumed by the testing thread).
2. Get number of unsent responses (set by the testing thread but not
   processed by the FUSE server).
3. Get total bytes of the received requests (to ensure some operations
   don't trigger FUSE requests).

Fixes #3607
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 6e3fbc91ba Extend integration test to test sequence of FUSE operation
Original FUSE integration test has limited capabilities. To test more
situations, the new integration test framework introduces a protocol
to communicate between testing thread and the FUSE server. In summary,
this change includes:

1. Remove CompareResult() and break SetExpected() into
   SetServerResponse() and GetServerActualRequest(). We no longer set
   up an expected request because we want to retrieve the actual FUSE
   request made to the FUSE server and check in the testing thread.

2. Declare a serial buffer data structure to save the received requests
   and expected responses sequentially. The data structure contains a
   cursor to indicate the progress of accessing. This change makes
   sequential SetServerResponse() and GetServerActualRequest() possible.

3. Replace 2 single directional pipes with 1 bi-directional socketpair.
   A protocol which starts with FuseTestCmd is used between the testing
   thread and the FUSE server to provide various functionality.

Fixes #3405
2020-09-16 12:19:30 -07:00
gVisor bot f45159b87f Merge pull request #3250 from craig08:fuse-getattr
PiperOrigin-RevId: 326313858
2020-08-12 14:36:04 -07:00
Craig Chi 9cf1550d81 Implement FUSE_GETATTR
FUSE_GETATTR is called when a stat(2), fstat(2), or lstat(2) is issued
from VFS2 layer to a FUSE filesystem.

Fixes #3175
2020-08-10 18:15:32 -07:00
gVisor bot fd797ffae3 Merge pull request #3502 from craig08:fuse-integration-test-fix-connection-refused
PiperOrigin-RevId: 325080329
2020-08-05 12:47:55 -07:00
Craig Chi 6a78e6bf16 Fix FUSE integration test failed with ECONNREFUSED
The newer version of FUSE_INIT checks the response from the FUSE server
if its major number is equal to 7. If it's not, then FUSE_INIT fails and
further filesystem operations will get ECONNREFUSED. To mitigate this
issue, we can send back a response with major version equals to 7 when
consuming the first FUSE_INIT request.

Fixes #3500
2020-08-04 14:48:37 -07:00
gVisor bot 2d08b18d3a Merge pull request #3320 from craig08:fuse-integration-test
PiperOrigin-RevId: 324877577
2020-08-04 13:25:40 -07:00
Craig Chi 8ff38234fa Add FUSE integration test
This commit adds an integration test framework for FUSE support. Please
refer to the test example and test/fuse/README.md for further details.

Fixes #3098
2020-08-04 12:27:55 -07:00