-
Notifications
You must be signed in to change notification settings - Fork 304
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
Conversation
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
Bug-tracker data: |
There was a problem hiding this 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.
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 |
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 |
@@ -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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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"?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@@ -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); |
There was a problem hiding this comment.
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.
Thanks to the reviewers for the quick responses! |
Required-githooks: true
There was a problem hiding this 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.
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/ |
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 |
@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! |
@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. |
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. |
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. |
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:
Features:
(orTest-tag*
) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.Gatekeeper: