Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-13996 pool: Fix invalid D_FREE in pool_glance #12683

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

liw
Copy link
Contributor

@liw liw commented Jul 21, 2023

pool_glance should only free map_buf if ds_pool_svc_load returns zero. The segfault might be triggered because ds_pool_svc_load returned DER_UNINIT; it is unknown that what actually happened. This patch fixes the D_FREE logic.

ds_pool_svc_load does not need to free map_buf in any case. It is likely a merge error. This patch removes the unnecessary D_FREE in ds_pool_svc_load.

Required-githooks: true

Before requesting gatekeeper:

  • Two review approvals and any prior change requests have been resolved.
  • Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
  • Features: (or Test-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.
  • Commit messages follows the guidelines outlined here.
  • Any tests skipped by the ticket being addressed have been run and passed in the PR.

Gatekeeper:

  • You are the appropriate gatekeeper to be landing the patch.
  • The PR has 2 reviews by people familiar with the code, including appropriate watchers.
  • Githooks were used. If not, request that user install them and check copyright dates.
  • Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
  • All builds have passed. Check non-required builds for any new compiler warnings.
  • Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
  • If applicable, the PR has addressed any potential version compatibility issues.
  • Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
  • Extra checks if forced landing is requested
    • Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
    • No new NLT or valgrind warnings. Check the classic view.
    • Quick-build or Quick-functional is not used.
  • Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.

pool_glance should only free map_buf if ds_pool_svc_load returns zero.
The segfault might be triggered because ds_pool_svc_load returned
DER_UNINIT; it is unknown that what actually happened. This patch fixes
the D_FREE logic.

ds_pool_svc_load does not need to free map_buf in any case. It is likely
a merge error. This patch removes the unnecessary D_FREE in
ds_pool_svc_load.

Signed-off-by: Li Wei <[email protected]>
Required-githooks: true
@github-actions
Copy link

github-actions bot commented Jul 21, 2023

Bug-tracker data:
Ticket title is 'DRAM corruption inside pool_glance'
Status is 'In Progress'
https://daosio.atlassian.net/browse/DAOS-13996

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@daosbuild1
Copy link
Collaborator

daosbuild1 commented Jul 21, 2023

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12683/1/execution/node/1259/log

DAOS-13931

@daosbuild1
Copy link
Collaborator

daosbuild1 commented Jul 21, 2023

Test stage Functional Hardware Medium completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12683/1/execution/node/1286/log

DAOS-13998

@liw liw marked this pull request as ready for review July 24, 2023 04:22
@liw liw requested review from liuxuezhao and Nasf-Fan July 24, 2023 04:25
@@ -1540,8 +1540,6 @@ ds_pool_svc_load(struct rdb_tx *tx, uuid_t uuid, rdb_path_t *root, uint32_t *glo
*global_version_out = global_version;
*map_buf_out = map_buf;
*map_version_out = map_version;
if (rc != 0)
D_FREE(map_buf);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Note] This is probably caused by previous merged with master.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or set "*map_version_out = NULL" at above L1519 (rc != 0) case, seems in that case the map_buf ptr in stack possibly not init.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liuxuezhao, it is intentional that ds_pool_svc_load changes *map_version_out only when returning zero. Callers shall only expect an output in *map_version_out if ds_pool_svc_load returns zero.

if (rc == DER_UNINIT) {
if (rc == 0) {
D_FREE(map_buf);
} else if (rc == DER_UNINIT) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to know why ds_pool_svc_load() return positive number for empty pool map instead of "-DER_UNINIT"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that is a important, non-error scenario that will almost 100% happen during the creation of a PS, and I was afraid that functions called by ds_pool_svc_load may return -DER_UNINIT for other unrelated scenarios. Hence, I chose a positive return value many years ago.

If I were to make the same choice again today, I might prefer defining an enum with a positive value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that is a important, non-error scenario that will almost 100% happen during the creation of a PS, and I was afraid that functions called by ds_pool_svc_load may return -DER_UNINIT for other unrelated scenarios. Hence, I chose a positive return value many years ago.

If I were to make the same choice again today, I might prefer defining an enum with a positive value.

I think you can do that in master independently.

@Nasf-Fan Nasf-Fan self-requested a review July 24, 2023 04:37
@@ -1540,8 +1540,6 @@ ds_pool_svc_load(struct rdb_tx *tx, uuid_t uuid, rdb_path_t *root, uint32_t *glo
*global_version_out = global_version;
*map_buf_out = map_buf;
*map_version_out = map_version;
if (rc != 0)
D_FREE(map_buf);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or set "*map_version_out = NULL" at above L1519 (rc != 0) case, seems in that case the map_buf ptr in stack possibly not init.

@liw
Copy link
Contributor Author

liw commented Jul 24, 2023

Thanks to the reviewers for the quick responses!

Copy link
Collaborator

@daosbuild1 daosbuild1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No errors found by checkpatch.

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium completed with status UNSTABLE. https://build.hpdd.intel.com/job/daos-stack/job/daos//view/change-requests/job/PR-12683/2/testReport/

@daosbuild1
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-12683/2/execution/node/1283/log

@Nasf-Fan
Copy link
Contributor

@liw , what is the next step for this patch? Do you need more reviewer or any further investigation? The patch will be helpful for CR tests on CI. Thanks!

@liw
Copy link
Contributor Author

liw commented Jul 28, 2023

@Nasf-Fan, this PR is hitting CR and non-CR test failures. If those test failures don't go away, how does this PR proceed?

@Nasf-Fan
Copy link
Contributor

@Nasf-Fan, this PR is hitting CR and non-CR test failures. If those test failures don't go away, how does this PR proceed?

I did not want to push the landing with break regular land process.
I hit DAOS-13996 corruption many times during both CR CI test and manual test, so just to make sure the gatekeeper can be aware of the land requirement in time since quite busy recently.

@liw
Copy link
Contributor Author

liw commented Jul 31, 2023

The rebuild_simple failure is unrelated to this PR; the pool_list_consolidation failure involves multiple problems that are likely unrelated to this PR. We need to investigate the latter.

@liw
Copy link
Contributor Author

liw commented Jul 31, 2023

Discussed with Fan Yong the situation. We think the pool_list_consolidation is first a test issue (a ticket will be created in a minute) and unrelated to this PR.

@liw liw requested a review from a team July 31, 2023 02:29
@liw liw added forced-landing The PR has known failures or has intentionally reduced testing, but should still be landed. CR Catastrophic Recovery Feature labels Jul 31, 2023
@gnailzenh gnailzenh merged commit 02a43c1 into feature/cat_recovery Jul 31, 2023
@gnailzenh gnailzenh deleted the liw/fix-map_buf-free branch July 31, 2023 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR Catastrophic Recovery Feature forced-landing The PR has known failures or has intentionally reduced testing, but should still be landed.
Development

Successfully merging this pull request may close these issues.

5 participants