Files
seaweedfs/weed/mount
Chris Lu 06ccd0e9fc fix(mount): flush dirty handles on Release when kernel skipped Flush (#9165)
* fix(mount): flush dirty handles on Release when kernel skipped Flush

The FUSE protocol allows the kernel to send Release without a preceding
Flush; file handles that reach Release with dirtyMetadata=true (notably
deferred creates that never saw any write) would then have their pending
filer CreateEntry dropped on the floor, leaving the mount and filer out
of sync.

Detect dirty handles in Release and call doFlush before tearing the
handle down. Skip the fallback when an async flush is already pending so
we don't double-submit. Flock-unlock Releases stay on the synchronous
path so close()-time serialization is preserved.

Adds TestReleaseFlushesDirtyCreateIfFlushWasSkipped covering the
create-without-flush path.

* address review: drop racy dirty-flag peek, let doFlush self-gate

fh.dirtyMetadata / fh.asyncFlushPending are written from the periodic
metadata flusher and async flush worker under fhLockTable, so the
unsynchronized read in Release was a data race per the reviewer.

Just call doFlush unconditionally on every Release; it already fast-
paths the clean case (dirtyPages.FlushData early-returns when hasWrites
is false, and the dirty-metadata branch short-circuits), so the extra
call after a normal Flush is cheap while the no-Flush-before-Release
path still recovers a deferred create.
2026-04-20 17:54:54 -07:00
..
2026-02-20 18:42:00 -08:00
2022-08-26 17:04:11 -07:00
2026-04-14 20:48:24 -07:00
2026-04-14 20:48:24 -07:00
2025-12-31 13:04:05 -08:00