Skip to content

Commit 0540c4d

Browse files
committed
Add a note about fsync
1 parent eba4b25 commit 0540c4d

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,37 @@ reported in the log in the following way:
189189
main.WARNING File xxx/yyy is deleted or resized remotely, discarding local changes
190190
```
191191

192+
## Asynchronous Write Errors
193+
194+
GeeseFS buffers updates in memory (or disk cache, if enabled) and flushes them asynchronously,
195+
so writers don't get an error from an unsuccessful write. When an error occurs, GeeseFS keeps
196+
modifications in the cache and retries to flush them to the server later. GeeseFS tries to
197+
flush the data forever until success or until you stop GeeseFS mount process. If there is
198+
too much changed data and memory limit is reached during write, write request hangs until
199+
some data is flushed to the server to make it possible to free some memory.
200+
201+
### fsync
202+
203+
If you want to make sure that your changes are actually persisted to the server you have to
204+
call [fsync](https://man7.org/linux/man-pages/man2/fsync.2.html) on a file or directory.
205+
Calling `fsync` on a directory makes GeeseFS flush all changes inside it. It's stricter than
206+
Linux and POSIX behaviour where fsync-ing a directory only flushes directory entries
207+
(i.e., renamed files) in it.
208+
209+
If a server or network error occurs during `fsync`, the caller receives an error code.
210+
211+
Example of calling `fsync`. Note that both directories and files should be opened as files:
212+
213+
```
214+
#!/usr/bin/python
215+
216+
import sys, os
217+
os.fsync(os.open(sys.argv[1], os.O_RDONLY))
218+
```
219+
220+
Command-line `sync` utility and [syncfs](https://man7.org/linux/man-pages/man2/syncfs.2.html) syscall
221+
don't work with GeeseFS because they aren't wired up in FUSE at all.
222+
192223
## Troubleshooting
193224

194225
If you experience any problems with GeeseFS - if it crashes, hangs or does something else nasty:

0 commit comments

Comments
 (0)