ram_fs: unmark modification from nodes that have been synced

Removed the modified mark from handles that have been written to when
they are synced, otherwise a notification would be sent again when the
handle is closed.

Ref #2839
This commit is contained in:
Ehmry - 2018-06-07 23:06:05 +02:00 committed by Norman Feske
parent 7e126f7fb6
commit 366913c146
3 changed files with 10 additions and 9 deletions

View File

@ -53,8 +53,7 @@ namespace File_system {
{ }
/*
* Called on close of written files, on sync, or on arrival
* of a client's CONTENT_CHANGED packet.
* Called on close of written files
*/
void notify(Version curr_version)
{
@ -66,11 +65,11 @@ namespace File_system {
if (curr_version.value == _notified_version.value)
return;
if (_sink.ready_to_ack())
if (_sink.ready_to_ack()) {
_sink.acknowledge_packet(Packet_descriptor(
_handle, Packet_descriptor::CONTENT_CHANGED));
_notified_version = curr_version;
_notified_version = curr_version;
}
}
/*

View File

@ -73,9 +73,9 @@ class File_system::Open_node : public File_system::Node
/*
* Notify remaining listeners about the changed file
*/
if (_was_written)
if (node.valid())
node->notify_listeners();
if (_was_written && node.valid()) {
node->notify_listeners();
}
}
Genode::Weak_ptr<NODE>&node() { return _node; }
@ -109,7 +109,8 @@ class File_system::Open_node : public File_system::Node
}
}
void mark_as_written() { _was_written = true; }
void mark_as_written() { _was_written = true; }
void unmark_as_written() { _was_written = false; }
};
#endif /* _OPEN_NODE_H_ */

View File

@ -123,6 +123,7 @@ class Ram_fs::Session_component : public File_system::Session_rpc_object
if (!node.valid())
break;
node->notify_listeners();
open_node.unmark_as_written();
succeeded = true;
break;
}