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

bluestore/NVMEDevice: do not deference a dangling pointer #19067

Merged
merged 1 commit into from Nov 22, 2017

Conversation

tchaikov
Copy link
Contributor

  • pass coremask_arg to the working thread by value.
    after 81249ab, get_val<>() returns a temporary variables instead of a
    reference to the variant held by config. so calling string::c_str(), and
    passing the returned const char* to a thread is not advisable. instead
    we should pass a string by value. since spdk_env_init() will copy the
    settings passed in by opt. it's safe even to destruct the coremask_arg
    afterward.
  • use ffsll() to find the LSB. it's not a bottleneck, but it's easier
    and simpler, and probably improves the readability.
  • refactor the NVMEManager::try_get() method: to define the variables
    when they are used for the first time.

Signed-off-by: Kefu Chai kchai@redhat.com

* pass coremask_arg to the working thread by value.
  after 81249ab, get_val<>() returns a temporary variables instead of a
  reference to the variant held by config. so calling string::c_str(), and
  passing the returned `const char*` to a thread is not advisable. instead
  we should pass a string by value. since spdk_env_init() will copy the
  settings passed in by opt. it's safe even to destruct the coremask_arg
  afterward.
* use ffsll() to find the LSB. it's not a bottleneck, but it's easier
  and simpler, and probably improves the readability.
* refactor the NVMEManager::try_get() method: to define the variables
  when they are used for the first time.

Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov
Copy link
Contributor Author

@liu-chunmei could you help review it?

@tchaikov tchaikov changed the title bluestore/NVMEDevice: do not deference a dangled pointer bluestore/NVMEDevice: do not deference a dangling pointer Nov 21, 2017
@tchaikov tchaikov merged commit 8723353 into ceph:master Nov 22, 2017
@tchaikov tchaikov deleted the wip-nvme-mgr-fixes branch November 22, 2017 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants