Skip to content

crimson/os/seastore: write "seastore block device" signature in write_superblock#64333

Merged
Matan-B merged 1 commit intoceph:mainfrom
mohit84:seastore_magic
Jul 14, 2025
Merged

crimson/os/seastore: write "seastore block device" signature in write_superblock#64333
Matan-B merged 1 commit intoceph:mainfrom
mohit84:seastore_magic

Conversation

@mohit84
Copy link
Contributor

@mohit84 mohit84 commented Jul 3, 2025

To validate the seastore device by cephadm write a signature "seastore block device" during superblock creation.

Fixes: https://tracker.ceph.com/issues/71954

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

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

@mohit84 mohit84 requested a review from a team as a code owner July 3, 2025 12:30
@mohit84 mohit84 requested review from Matan-B and cyx1231st July 3, 2025 12:31
@mohit84
Copy link
Contributor Author

mohit84 commented Jul 3, 2025

jenkins test make check

Copy link
Contributor

@Matan-B Matan-B left a comment

Choose a reason for hiding this comment

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

This seems like the correct approach. Left few suggestions and let's wait for @cyx1231st approval.

Probably worth mentioning that this comes to help ceph volume's has_seastore_label helper.

[=, &device](auto &bp)
{
bufferlist bl;
bl.append(SUPERBLOCK_MAGIC);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason not to move this into block_sm_superblock_t encode/decode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no specific reason

Copy link
Member

Choose a reason for hiding this comment

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

Agree with matan, this should be part of block_sm_superblock_t, then the change will affect the other tools relying on block_sm_superblock_t immediately, which is actually better.

see #63604

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cyx1231st I have updated the note why can;t we add signature via DENC.

Comment on lines +121 to +125
constexpr const char* SUPERBLOCK_MAGIC = "seastore block device\n";
constexpr size_t SUPERBLOCK_MAGIC_LEN = strlen(SUPERBLOCK_MAGIC);

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can we name this label instead of magic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Matan-B Matan-B added this to Crimson Jul 3, 2025
@Matan-B Matan-B moved this to Awaits review in Crimson Jul 3, 2025
Copy link
Member

@cyx1231st cyx1231st left a comment

Choose a reason for hiding this comment

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

The change is straightforward.

If we are not going to support seastore label in the other 2 superblocks in this PR, for completeness, please add TODO comments to them to clarify that they won't be compatible to (which) related features.

[=, &device](auto &bp)
{
bufferlist bl;
bl.append(SUPERBLOCK_MAGIC);
Copy link
Member

Choose a reason for hiding this comment

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

Agree with matan, this should be part of block_sm_superblock_t, then the change will affect the other tools relying on block_sm_superblock_t immediately, which is actually better.

see #63604

@Matan-B Matan-B moved this from Awaits review to In Progress in Crimson Jul 6, 2025
@mohit84
Copy link
Contributor Author

mohit84 commented Jul 7, 2025

jenkins test make check

1 << (std::numeric_limits<device_id_t>::digits - 1);

constexpr const char* SEASTORE_SUPERBLOCK_SIGN = "seastore block device\n";
constexpr size_t SEASTORE_SUPERBLOCK_SIGN_LEN = strlen(SEASTORE_SUPERBLOCK_SIGN);
Copy link
Contributor

Choose a reason for hiding this comment

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

/home/jenkins-build/build/workspace/ceph-pull-requests/src/crimson/os/seastore/seastore_types.h:122:18: error: constexpr variable 'SEASTORE_SUPERBLOCK_SIGN_LEN' must be initialized by a constant expression
  122 | constexpr size_t SEASTORE_SUPERBLOCK_SIGN_LEN = strlen(SEASTORE_SUPERBLOCK_SIGN);
      |                  ^                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/jenkins-build/build/workspace/ceph-pull-requests/src/crimson/os/seastore/seastore_types.h:122:49: note: non-constexpr function 'strlen' cannot be used in a constant expression

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines +296 to +302
// Write the SEASTORE_SUPERBLOCK_SIGN at offset 0 before
// encoding the superblock. If the signature is added inside
// the block_sm_superblock_t structure (via DENC), it won't be
// written at offset 0 because DENC encoding add some metadata.
// Therefore prepend the signature to the bufferlist before
// encoding the superblock sothat signature always appears at the
// start of the written data.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This sections here would probably better fit in the commit message.
We can add a more specific comment here such as:
// encode SEASTORE_SUPERBLOCK_SIGN at offset 0 before encoding anything else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

// Write the SEASTORE_SUPERBLOCK_SIGN at offset 0 before
// encoding the superblock. If the signature is added inside
// the block_sm_superblock_t structure (via DENC), it won't be
// written at offset 0 because DENC encoding add some metadata.
Copy link
Contributor

Choose a reason for hiding this comment

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

If DENC encodes additional data, can we use encode/decode instead so that we could move this into encode/decode?
As @cyx1231st mentioned earlier encoding additional data without properly decoding it might break future users (i.e objectstore-tool).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had already discussed with @cyx1231st he agreed with patch.

Copy link
Member

Choose a reason for hiding this comment

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

As disscussed, it's simpler to place SEASTORE_SUPERBLOCK_SIGN directly at the start of the device without headers, like bluestore.

We can switch to encode/decode if possible.

@mohit84
Copy link
Contributor Author

mohit84 commented Jul 7, 2025

jenkins test make check

Copy link
Member

@cyx1231st cyx1231st left a comment

Choose a reason for hiding this comment

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

LGTM otherwise.

// Write the SEASTORE_SUPERBLOCK_SIGN at offset 0 before
// encoding the superblock. If the signature is added inside
// the block_sm_superblock_t structure (via DENC), it won't be
// written at offset 0 because DENC encoding add some metadata.
Copy link
Member

Choose a reason for hiding this comment

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

As disscussed, it's simpler to place SEASTORE_SUPERBLOCK_SIGN directly at the start of the device without headers, like bluestore.

We can switch to encode/decode if possible.

@cyx1231st cyx1231st changed the title seastore: Write "seastore block device" signature in write_superblock crimson/os/seastore: write "seastore block device" signature in write_superblock Jul 8, 2025
@cyx1231st
Copy link
Member

^ can you fix the commit title as well?

Also better to explain why we need this PR in the commit message (the requirement, e.g. ceph-volume).

@mohit84
Copy link
Contributor Author

mohit84 commented Jul 10, 2025

^ can you fix the commit title as well?

Also better to explain why we need this PR in the commit message (the requirement, e.g. ceph-volume).

done

@mohit84
Copy link
Contributor Author

mohit84 commented Jul 10, 2025

jenkins test make check

Write the SEASTORE_SUPERBLOCK_SIGN at offset 0 before
encoding the superblock. If the signature is added inside
the block_sm_superblock_t structure (via DENC), it won't be
written at offset 0 because DENC encoding add some metadata.
Therefore prepend the signature to the bufferlist before
encoding the superblock sothat signature always appears at the
start of the written data

Fixes: https://tracker.ceph.com/issues/71954
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
@mohit84
Copy link
Contributor Author

mohit84 commented Jul 10, 2025

jenkins test make check

@cyx1231st cyx1231st moved this from In Progress to Needs QA in Crimson Jul 10, 2025
@mohit84
Copy link
Contributor Author

mohit84 commented Jul 11, 2025

@mohit84
Copy link
Contributor Author

mohit84 commented Jul 14, 2025

@Matan-B
Copy link
Contributor

Matan-B commented Jul 14, 2025

https://pulpito.ceph.com/moagrawa-2025-07-14_01:47:30-crimson-rados-wip-moagrawa-crimson-only-seastore_magic-distro-crimson-debug-smithi/

Hey Mohit, can you please review the run to verify that all the failures are known?

@Matan-B
Copy link
Contributor

Matan-B commented Jul 14, 2025

jenkins test api

@Matan-B
Copy link
Contributor

Matan-B commented Jul 14, 2025

jenkins test make check

@mohit84
Copy link
Contributor Author

mohit84 commented Jul 14, 2025

https://pulpito.ceph.com/moagrawa-2025-07-14_01:47:30-crimson-rados-wip-moagrawa-crimson-only-seastore_magic-distro-crimson-debug-smithi/

Hey Mohit, can you please review the run to verify that all the failures are known?

There are total two types of failure

  1. During tear down the test case test_aio_mirror_image_create_snapshot is failing for below job IDs
    8384759 8384770 8384817 8384826 8384874 8384883
  2. ceph_test_cls_cmpomap failed for noexist test for below Job IDs
    8384719 8384777 8384834

I have checked the failures were specific to the ceph branch version, on latest main branch these failures are resolved so we can say it is ok.

@Matan-B
Copy link
Contributor

Matan-B commented Jul 14, 2025

https://pulpito.ceph.com/moagrawa-2025-07-14_01:47:30-crimson-rados-wip-moagrawa-crimson-only-seastore_magic-distro-crimson-debug-smithi/

Hey Mohit, can you please review the run to verify that all the failures are known?

There are total two types of failure

  1. During tear down the test case test_aio_mirror_image_create_snapshot is failing for below job IDs
    8384759 8384770 8384817 8384826 8384874 8384883
  2. ceph_test_cls_cmpomap failed for noexist test for below Job IDs
    8384719 8384777 8384834

I have checked the failures were specific to the ceph branch version, on latest main branch these failures are resolved so we can say it is ok.

For 1, it's probably due to the branch being a bit outdated - I'm ok with merging since the issue also appeared in bluestore which is not affected by this PR (and most of the test did pass).
For 2, The qa dir used was of main which included the fix while the build didn't.

@Matan-B Matan-B merged commit 5267745 into ceph:main Jul 14, 2025
13 checks passed
@Matan-B Matan-B moved this from Needs QA to Merged (Main) in Crimson Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Main)

Development

Successfully merging this pull request may close these issues.

3 participants