Commit 763ac0f
Update Mountpoint's semantics to enable opening a new file handle on an inode if all the existing open handles have been flushed (#1704)
Update Mountpoint's semantics to enable opening a new file handle on an
inode if **all** the existing open handles have been flushed.
This allows for the filesystem to not depend on a `release` request to
complete pending (delayed) upload and cleanup the internal state of the
inode within Mountpoint; alleviating situations where an `open` request
made immediately after a close(`flush`) request leads to a race
condition between the `release` following the close and the new `open`,
which is sometimes an issue when the upload to S3 has been delayed until
`release`.
### Does this change impact existing behavior?
The semantics continue to allow **only one writer OR one/many readers**
concurrently active for a file; however, now a new handle can be opened
which can override the current active handles (despite not being
officially released) if all the active handles are marked "flushed".
As part of opening the new handle, Mountpoint will also attempt
uploading any pending data written for the previous file handle. All the
requests to the overridden handle(s) will then start to fail or be
no-op.
Multiple concurrent writers or concurrent readers and writers are still
not allowed.
A handle is marked "flushed" when a close/`flush` is called on a file
descriptor mapped to that handle. A following `read`/`write` request
will revert that flushed state and signify that the handle is actively
in use and can not be overridden. We maintain this information at the
individual handle level and also in an inode-locked map of handles.
Breaking changes:
- Requests made to a duplicate file descriptor for a flushed file handle
will start to fail (for e.g. a `read`/`write` would fail with `EBADF:
file handle has been invalidated by a newer handle opened`) or be no-op
(for e.g. `flush`, `release`) if a new `open` has overridden the flushed
handle(s).
- A race condition can occur between a `read`/`write` request for a
duplicate file descriptor on an existing (flushed) handle and multiple
concurrent `open` requests, and any of them might succeed due to
parallel processing of FUSE requests within Mountpoint. However, only
one of them will ever succeed and there cannot be two concurrent writers
or reader+writer for the inode at any point in time.
- An `open` request for an inode might fail if the pending upload to S3
fails. This is independent of whether the file has been truncated in the
second `open`.
### Does this change need a changelog entry? Does it require a version
change?
Yes, it needs a changelog entry and update to the semantics.md. Yes it
also requires a version change.
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and I agree to the terms of
the [Developer Certificate of Origin
(DCO)](https://developercertificate.org/).
---------
Signed-off-by: Mansi Pandey <mansipnd@amazon.co.uk>
Signed-off-by: Alessandro Passaro <alexpax@amazon.co.uk>
Co-authored-by: Mansi Pandey <mansipnd@amazon.com>
Co-authored-by: Alessandro Passaro <alexpax@amazon.co.uk>1 parent 23bffa1 commit 763ac0f
22 files changed
Lines changed: 1805 additions & 491 deletions
File tree
- mountpoint-s3-client/src
- mountpoint-s3-fs
- src
- fs
- manifest
- metablock
- superblock
- tests/fuse_tests
- mountpoint-s3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| |||
0 commit comments