acelyc111 commented on code in PR #1487:
URL:
https://github.com/apache/incubator-pegasus/pull/1487#discussion_r1206195471
##########
src/common/fs_manager.cpp:
##########
@@ -341,17 +337,16 @@ bool fs_manager::for_each_dir_node(const
std::function<bool(const dir_node &)> &
return true;
}
-void fs_manager::update_disk_stat(bool check_status_changed)
+void fs_manager::update_disk_stat()
{
+ zauto_read_lock l(_lock);
Review Comment:
It should be a write lock.
Because there is a gap between reset_disk_stat() and the follwoing updating.
If a reader get the disks info in the gap, zeros which are incorrect will be
returned.
##########
src/common/fs_manager.cpp:
##########
@@ -341,17 +337,16 @@ bool fs_manager::for_each_dir_node(const
std::function<bool(const dir_node &)> &
return true;
}
-void fs_manager::update_disk_stat(bool check_status_changed)
+void fs_manager::update_disk_stat()
{
+ zauto_read_lock l(_lock);
Review Comment:
It should be a write lock, updated.
Because there is a gap between reset_disk_stat() and the follwoing updating.
If a reader get the disks info in the gap, zeros which are incorrect will be
returned.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]