SDSTOR-24056: hold lock when updating superblk of raft_repl_dev#898
Conversation
bba74a0 to
251056c
Compare
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## stable/v7.x #898 +/- ##
==============================================
Coverage ? 48.23%
==============================================
Files ? 110
Lines ? 12965
Branches ? 6231
==============================================
Hits ? 6254
Misses ? 2578
Partials ? 4133 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xiaoxichen
left a comment
There was a problem hiding this comment.
I dont get the context of this fix in both jira and commit message...
251056c to
3ac8cbd
Compare
in this PR : 2 the key logic change in this PR is in RaftReplDev::leave(), where a lock is added before updating the superblk of raft_repl_dev, this is the part the reviewer should pay more attention: the reason we need to add this lock is that many threads will try to update m_rd_sb concurrently, for example, RaftReplDev::cp_flush will update it in cp flush thread. if we update it without a lock, when coming to so, if the input data buffer is changed by another thread after the first crc calculation , then crc mismatch will occur. the lock here is used to protect to data buffer not to be changed until update_sub_sb is completed. also, we can see the lock is hold before m_rd_sb.write() in other places in homestore code, but missed in RaftReplDev::leave(), so just add it here. |
Uh oh!
There was an error while loading. Please reload this page.