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

os/bluestore: use direct write in BlueStore::_write_bdev_label #48092

Merged
merged 1 commit into from Sep 27, 2022

Conversation

rosinL
Copy link
Member

@rosinL rosinL commented Sep 14, 2022

On AArch64 with kernel page size 64K, it occurs occasionally "OSD::init(): unable to read osd superblock" when deploying osd. As bluestore use direct write to write the superblock at 0x2000~1000 and BlueStore::_write_bdev_label use buffer write to write label at 0x0~1000, The OS flush the buffer write algined to page size, it will overwrite the superblock(0x2000~1000). Use driect write to avoid overwriting the superblock.

Fixes: https://tracker.ceph.com/issues/57537
Signed-off-by: luo rixin luorixin@huawei.com

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@rosinL rosinL requested a review from a team as a code owner September 14, 2022 12:20
@rosinL rosinL changed the title os/bluestore: use driect write in BlueStore::_write_bdev_label os/bluestore: use direct write in BlueStore::_write_bdev_label Sep 14, 2022
On AArch64 with kernel page size 64K, it occurs occasionally
"OSD::init(): unable to read osd superblock" when deploying osd.
As bluestore use direct write to write the superblock at 0x2000~1000
and BlueStore::_write_bdev_label use buffer write to write label at
0x0~1000, The OS flush the buffer write algined to page size, it will
overwrite the superblock(0x2000~1000). Use driect write to avoid
overwriting the superblock.

Fixes: https://tracker.ceph.com/issues/57537
Signed-off-by: luo rixin <luorixin@huawei.com>
Copy link
Contributor

@ifed01 ifed01 left a comment

Choose a reason for hiding this comment

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

Good catch!

@@ -5375,13 +5375,14 @@ int BlueStore::_write_bdev_label(CephContext *cct,
z.zero();
bl.append(std::move(z));

int fd = TEMP_FAILURE_RETRY(::open(path.c_str(), O_WRONLY|O_CLOEXEC));
int fd = TEMP_FAILURE_RETRY(::open(path.c_str(), O_WRONLY|O_CLOEXEC|O_DIRECT));
Copy link
Contributor

Choose a reason for hiding this comment

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

From https://man7.org/linux/man-pages/man2/open.2.html this flag "Try to minimize cache effects of the I/O ... but does not give the guarantees of the O_SYNC flag that data and necessary metadata are transferred"
Given that comment wouldn't be better to use O_SYNC flag and/or call fsync before closing the file descriptor?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am a bit confused. Do you advise that we should use O_SYNC here? In this func Line 5392, it does use fsync() to flush the data to device.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah.. my bad - there is fsync indeed. O_DIRECT + fsync should be sufficient then...

@ljflores
Copy link
Contributor

Rados suite review:

http://pulpito.front.sepia.ceph.com/?branch=wip-yuri3-testing-2022-09-21-0921
http://pulpito.front.sepia.ceph.com/yuriw-2022-09-26_23:41:33-rados-wip-yuri3-testing-2022-09-26-1342-distro-default-smithi/

Failures, unrealted:
1. https://tracker.ceph.com/issues/57311
2. https://tracker.ceph.com/issues/55853
3. https://tracker.ceph.com/issues/52321

Details:
1. rook: ensure CRDs are installed first - Ceph - Orchestrator
2. test_cls_rgw.sh: failures in 'cls_rgw.index_list' and 'cls_rgw.index_list_delimited` - Ceph - RGW
3. qa/tasks/rook times out: 'check osd count' reached maximum tries (90) after waiting for 900 seconds - Ceph - Orchestrator

@ifed01 ifed01 merged commit 2d88fdf into ceph:main Sep 27, 2022
@rosinL rosinL deleted the fix-57537 branch September 28, 2022 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants