-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2545: fix(vfs) Opening in append-mode must ignore seek operations r=Hywan a=Hywan # Description When opening a file with the `append` option turned on, all `seek` operations must be ignored. As described by [`open(2)`](https://man7.org/linux/man-pages/man2/open.2.html), the `O_APPEND` option describes this behavior well: > Before each write(2), the file offset is positioned at > the end of the file, as if with lseek(2). The > modification of the file offset and the write operation > are performed as a single atomic step. > > O_APPEND may lead to corrupted files on NFS filesystems > if more than one process appends data to a file at once. > This is because NFS does not support appending to a file, > so the client kernel has to simulate it, which can't be > done without a race condition. This patch implements that behavior. Also, this patch rewind the file cursor if opened in read-mode. Co-authored-by: Ivan Enderlin <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters