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
This commit is contained in:
Ehmry - 2018-05-04 11:16:41 +02:00 committed by Christian Helmuth
parent a9082eb162
commit e005d966b4
2 changed files with 2 additions and 16 deletions

View File

@ -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

View File

@ -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();
}