141 Commits
Author SHA1 Message Date
Jinmou LiandAndrei Vagin d459bb3372 Add FUSE umount support
This change implements Release for the FUSE filesystem
and expected behaviors of the FUSE devices.
It includes several checks for aborted connection
in the path for making a request and a function
to abort all the ongoing FUSE requests in order.
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin 4edc56d3e9 Fix FUSE_RELEASE protocol reply processing
This commit fixes the potential unexpected errors
of original handling of FUSE_RELEASE responses while
keep the same behavior (ignoring any reply).
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin 826a685a95 Improve FUSE async/noreply call logic
This change adds bookkeeping variables for the
FUSE request. With them, old insecure confusing
code we used to process async requests is replaced
by new clear compiling ones. Future code can take
advantage of them to have better control of each
requests.
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin f1219ec5f1 Refactor FUSE connection for readability and structure
This change decouples the code that is weakly
tied to the connection struct from connection.go,
rename variables and files with more meaningful choices,
adds detailed comments, explains lock orders,
and adds other minor improvement to make
the existing FUSE code more readable and
more organized.

Purpose is to avoid too much code in one file
and provide better structure for the
future commits.
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin bf8efe8cdf 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 4181e8c974 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
Jinmou LiandAndrei Vagin 98faed55e6 Implement FUSE_WRITE
This commit adds basic write(2) support for FUSE.
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 18f1e1c91b 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
Jinmou LiandAndrei Vagin 7ed4e46a71 FUSE device: clean up readLocked
This change removes the unnecessary loop and avoids
the recursive call. It also fixes minor bugs in this
function.
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin e91c026672 Downgrade FUSE minor version support and clarify comments 2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 1d8029022e fuse: remove unused marshalling functions
This commit removes unused marshalling functions in linux abi package
and moves self-defined FUSEInitRes wrapper to fuse package.

Updates #3707
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 449986264f Support multiple FUSE kernel versions of FUSE_INIT response struct
The fuse_init_out struct changes in different FUSE kernel versions. A
FUSE server may implement older versions of fuse_init_out, but they
share common attributes from the beginning. Implement variable-length
marshallable interface to support older versions of ABI.

Fixes #3707
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 983e30c016 Implementing inode.Getlink
kernfs uses inode.Getlink to resolve symlink when look up paths.

Updates #3452
2020-09-16 12:19:30 -07:00
Craig ChiandAndrei Vagin 21cac9dd04 Fix FUSE_READDIR offset issue
According to readdir(3), the offset attribute in struct dirent is the
offset to the next dirent instead of the offset of itself. Send the
successive FUSE_READDIR requests with the offset retrieved from the last
entry.

Updates #3255
2020-09-16 12:19:30 -07:00
Ridwan SharifandAndrei Vagin d51ddcefdc fuse: use safe go_marshal API for FUSE
Until #3698 is resolved, this change is needed to ensure we're not
corrupting memory anywhere.
2020-09-16 12:19:30 -07:00
4a5857d644 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 <craigchi@google.com>
2020-09-16 12:19:30 -07:00
bc07df8887 Implement FUSE_RMDIR
Fixes #3587

Co-authored-by: Craig Chi <craigchi@google.com>
2020-09-16 12:19:30 -07:00
Jinmou LiandAndrei Vagin 713400d6b0 Implement FUSE_READ
Fixes #3206
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 4d26c9929d Implement FUSE_MKDIR
Fixes #3392
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 733d013f97 Implement FUSE_READLINK
Fixes #3316
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin b50c03b571 Implement FUSE_SYMLINK
Fixes #3452
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin b53e10f391 Implement FUSE_MKNOD
Fixes #3492
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 947088e10a Implement FUSE_RELEASE/RELEASEDIR
Fixes #3314
2020-09-16 12:19:30 -07:00
Boyuan HeandAndrei Vagin 32044f94e9 Implement FUSE_OPEN/OPENDIR
Fixes #3174
2020-09-16 12:19:30 -07:00
d6ee3ae6d7 Implement FUSE_LOOKUP
Fixes #3231

Co-authored-by: Boyuan He <heboyuan@google.com>
2020-09-16 12:19:30 -07:00