rasdaemon: Fix for vendor errors are not recorded in the SQLite datab… #157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ase if some cpus are offline
Fix for vendor errors are not recorded in the SQLite database if some cpus are offline at the system start.
Issue:
This issue is reproducible by offline some cpus, run ./rasdaemon -f --record & and
inject vendor specific error supported in the rasdaemon.
Reason:
When the system starts with some of the cpus offline and then run the rasdaemon, read_ras_event_all_cpus() exit with error and switch to the multi thread way. However read() in read_ras_event() return error in threads for each of the offline CPUs and does clean up including calling ras_ns_finalize_vendor_tables(), which invokes sqlite3_finalize() on vendor tables created. Thus the vendor error data does not stored in the SQLite database when such error is reported next time.
Solution:
In ras_ns_add_vendor_tables() and ras_ns_finalize_vendor_tables() use reference count and close vendor tables which created in ras_ns_add_vendor_tables() based on the reference count.
Reported-by: Junhao He [email protected]