Comments (3)
Honestly, I've become less and less convinced over the years that its worth serializing the truncation in this fashion because you have to deal with paging I/O beyond EOF anyway.
There are race conditions between paging I/O and file size changes and the way NTFS (and FAT) deal with this is to return STATUS_SUCCESS with a write length of zero. So what's the benefit of serialization down this path then?
from winfsp.
@fsgeek thank you for your comments. Your expertise in these matters is invaluable.
When I was first designing the WinFsp locking model, I struggled to understand the roles of MainResource and PagingIoResource by studying the FastFat source code. I eventually developed a mental model of how FastFast does things, but by that time I had already implemented most of WinFsp using a different locking model where the PagingIoResource is taken whenever the WinFsp FSD reaches out to the user mode file system.
However in the current WinFsp state, I believe that every time the PagingIoResource is acquired, the MainResource has already been acquired. This makes acquiring the PagingIoResource on top of the MainResource useless.
I logged this issue for two reasons:
-
To see if it was possible to emulate in WinFsp how FastFat handles locking.
-
To eliminate use of the PagingIoResource if I was not successful at (1).
Your comments suggest that even if (1) is possible, it may not be worthwhile. I have come to similar conclusions.
from winfsp.
FastFat's locking was never intended to support highly parallel activity and the locking interface, such as it is, reflects the increasingly nuanced handling of locking. For example, the callbacks for Mm actually provide you with a high water mark, so you don't have to guarantee no truncation, just no truncation below a certain threshold.
The real issue for the paging I/O resource is the risk of performing allocation in the paging write path, since allocation could involve performing potentially complex operations. So they split it into two separate steps: allocation and then writing. If you can handle doing allocation in the paging write path, you're fine.
Hence how NTFS (and FAT) end up dealing with this situation: if you are doing paging I/O then you don't extend the file because it means that it's been truncated since it was extended. The one exception there might be for the lazy writer thread, though even there it probably doesn't matter.
In some of the work I've done in the past (in an isolation filter) we didn't hold locks across calls to the underlying file system and what we found is that "just deal with it" is a viable approach to an area in which there are already inherent race conditions.
Note, by "locking interface" I mean the mish-mash of calls inherent in the fast I/O interface, the Cc callbacks, and the default rules around grabbing ERESOURCE locks inside the common header (which is not good engineering practice!)
NTFS (for example) actually registers filter callbacks (!) because it provides more nuanced control and the ability to reject file mapping requests. NTFS is not, however, a filter. Then again, we see all sorts of OS components calling Filter Manager to resolve names as well. The encapsulation module for the functionality was insufficiently broad, but since it's available, people call it anyway.
from winfsp.
Related Issues (20)
- [FUSE API] drive letters in symlinks are not handled correctly HOT 2
- [FUSE] Add ENOTSUP to `ntstatus_from_errno` mapping HOT 2
- BSOD on W10 using rclone for mounting nextcloud HOT 11
- Suspected memory leak in kernel driver when used with virtio-fs HOT 1
- Create drive as a global drive failed with winfsp memfs-fuse sample HOT 1
- Minimum sample FS in C# HOT 1
- Passthrough FS missing some file properties HOT 2
- BSOD on copying files within drive HOT 4
- FileName Obfuscate HOT 1
- Node.js Library?
- Please include also `memfs-fuse3` *binaries* in the developer installer HOT 4
- Using FusePy on Windows with winfsp rmdir does not get called HOT 3
- Return STATUS_PENDING in Create Callback. HOT 5
- Windows try to open files, even they are marked FileAttributes.Offline for preview HOT 5
- Concurrency during asynchronous Read and Write operations HOT 1
- [FUSE API] Add getpath to fuse3 HOT 2
- Firefox can't save a file to the root of a MEMFS mount. HOT 3
- Why are symbols in `fuse3/fuse.h` prefixed with `fuse3`? HOT 2
- Copy files from 99% to 100% will take a long time HOT 4
- how to make a drive using memfs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from winfsp.