From e005d966b4eb3ec96c3d90d333bd98638f20d334 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 4 May 2018 11:16:41 +0200 Subject: [PATCH] Ram_fs: immediate directory notifications Do not mark and defer notification for directories when a file is created or removed, mark and immediately queue a notification. Fix #2808 --- repos/os/src/server/ram_fs/directory.h | 2 ++ repos/os/src/server/ram_fs/main.cc | 16 ---------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/repos/os/src/server/ram_fs/directory.h b/repos/os/src/server/ram_fs/directory.h index 00be1f414c..ff580f5485 100644 --- a/repos/os/src/server/ram_fs/directory.h +++ b/repos/os/src/server/ram_fs/directory.h @@ -62,6 +62,7 @@ class Ram_fs::Directory : public Node _num_entries++; mark_as_updated(); + notify_listeners(); } void discard(Node *node) override @@ -70,6 +71,7 @@ class Ram_fs::Directory : public Node _num_entries--; mark_as_updated(); + notify_listeners(); } Node *lookup(char const *path, bool return_parent = false) override diff --git a/repos/os/src/server/ram_fs/main.cc b/repos/os/src/server/ram_fs/main.cc index d940c9ed75..23bb097d52 100644 --- a/repos/os/src/server/ram_fs/main.cc +++ b/repos/os/src/server/ram_fs/main.cc @@ -256,7 +256,6 @@ class Ram_fs::Session_component : public File_system::Session_rpc_object File(_alloc, name.string()); dir->adopt_unsynchronized(file); - open_node.mark_as_written(); } catch (Allocator::Out_of_memory) { throw No_space(); } } @@ -444,7 +443,6 @@ class Ram_fs::Session_component : public File_system::Session_rpc_object dir->discard(node); destroy(_alloc, node); - open_node.mark_as_written(); }; try { @@ -508,20 +506,6 @@ class Ram_fs::Session_component : public File_system::Session_rpc_object from_dir->discard(node); to_dir->adopt_unsynchronized(node); - /* - * If the file was moved from one directory to another we - * need to inform the new directory 'to_dir'. The original - * directory 'from_dir' will always get notified (i.e., - * when just the file name was changed) below. - */ - to_dir->mark_as_updated(); - open_to_dir_node.mark_as_written(); - to_dir->notify_listeners(); - - from_dir->mark_as_updated(); - open_from_dir_node.mark_as_written(); - from_dir->notify_listeners(); - node->mark_as_updated(); node->notify_listeners(); }