From 4009239328bbc8ddd40d6e7c3fdd2737d4a93720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Wed, 10 Jan 2018 13:27:31 +0100 Subject: [PATCH] vfs: skip synced file systems in complete_sync Fixes #2606. --- repos/os/include/vfs/dir_file_system.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/repos/os/include/vfs/dir_file_system.h b/repos/os/include/vfs/dir_file_system.h index b16b8ef042..dc9b5d990d 100644 --- a/repos/os/include/vfs/dir_file_system.h +++ b/repos/os/include/vfs/dir_file_system.h @@ -55,6 +55,8 @@ class Vfs::Dir_file_system : public File_system struct Subdir_handle_element : Subdir_handle_registry::Element { + bool synced { false }; + Vfs_handle &vfs_handle; Subdir_handle_element(Subdir_handle_registry ®istry, Vfs_handle &vfs_handle) @@ -865,6 +867,7 @@ class Vfs::Dir_file_system : public File_system auto f = [&result, dir_vfs_handle] (Dir_vfs_handle::Subdir_handle_element &e) { /* forward the handle context */ e.vfs_handle.context = dir_vfs_handle->context; + e.synced = false; if (!e.vfs_handle.fs().queue_sync(&e.vfs_handle)) { result = false; @@ -884,9 +887,14 @@ class Vfs::Dir_file_system : public File_system static_cast(vfs_handle); auto f = [&result, dir_vfs_handle] (Dir_vfs_handle::Subdir_handle_element &e) { + if (e.synced) + return; + Sync_result r = e.vfs_handle.fs().complete_sync(&e.vfs_handle); if (r != SYNC_OK) result = r; + else + e.synced = true; }; dir_vfs_handle->subdir_handle_registry.for_each(f);