# KDE Frameworks 6.32 finally fixes 15-year KIO copy bug for USB and network filesystems

> **Key takeaway:** KIO now uses sync_file_range() with an adaptive writeback window to show accurate progress and ensure data is actually written before reporting completion, fixing a bug where copies to slow devices appeared finished while data remained in page cache.

**Published:** 2026-10-27T00:00:01+00:00 
**Source:** KDE Blogs 
**Category:** foss-apps 
**Canonical URL:** https://fosswire.org/news/kde-frameworks-632-finally-fixes-15-year-kio-copy-bug-for-us.html 

## Summary
KDE's I/O framework KIO will ship a fix in Frameworks 6.32 for bug 281270, a 15-year-old issue where file copies to USB sticks and network filesystems reported completion while data still sat in kernel page cache. The problem stemmed from write() returning once data reached memory, with actual device writes deferred by the kernel; on a USB 2.0 stick writing at 2.3 MB/s, a 128 MiB file could show as copied for over a minute before physical writeback finished, risking data loss if the device was removed. Network filesystems suffered related symptoms, with SMB directory listings blocking 15-20 seconds during large copies due to cache=strict behavior.

The fix required four merge requests: MR 2506 identifies removable devices via mount table and sysfs without querying slow servers; MR 2517 and MR 2518 add end-of-copy device flushing through a new worker command; and MR 2283 implements an adaptive writeback window using sync_file_range(). Earlier attempts in 2024 failed because the worker waited for writeback of the chunk just written rather than the previous window. Supporting infrastructure in KIO 6.30 and 6.32 made mount lookups roughly 700 times faster and eliminated 15-second timeouts on unresponsive network servers.

## How the writeback window and flush architecture work
- **sync_file_range() with adaptive window:** KIO now bounds in-flight dirty data by calling sync_file_range() on the previous written window rather than the current chunk, ensuring actual writeback progress without the full-device stall of fsync() after every write.
- **Removable device detection without round trips:** MR 2506 reads mount properties from /proc/self/mountinfo and sysfs; MR 2326 (KIO 6.30) caches lookups by mount ID from statx() since Linux 6.8, and MR 2487 (KIO 6.32) uses statmount() to avoid path walks, dropping unresponsive server lookups from 15+ seconds to ~1 ms.
- **End-of-operation flush signaling:** Since file workers process one file per command and do not know which is last, MR 2517 and MR 2518 add a new worker command and notification path so CopyJob in the application can trigger device flush only after the entire transfer completes.
- **Dropped metadata bug fixed:** The developer discovered that FileCopyJob was discarding worker-sent metadata, preventing CopyJob from ever seeing flush-needed indicators; this latent bug had to be resolved before the flush signaling could function.
- **Adaptive window sizing:** The writeback window adjusts to destination speed, with progress bar behavior kept monotonic when the window shrinks, avoiding the false completion that previously showed memory-fill rate as copy speed.

## Why it matters
For Linux desktop users and distributions shipping KDE Plasma, this eliminates a long-standing data integrity risk where users could lose files by removing USB drives that appeared finished copying, and removes the SMB directory listing freezes that made network file management unusable during transfers. The fix also demonstrates how resolving deep storage-stack bugs requires coordinated kernel API evolution, framework-level caching improvements, and careful attention to asynchronous worker architectures that span multiple processes.