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

Restrain rafs v6 mount if its configuration has digest_validate #576

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

changweige
Copy link
Contributor

@changweige changweige commented Jul 8, 2022

Rafs v6 chunk has no digest recorded yet, so it can't perform data validation and necessary method used for validation causes panic. So we enforce rafs v6 mount the rule that no digest_validate is configured.

In addition, we have to avoid call as_base for rafs v6 chunk info, otherwise it panics

Rafs v6 does not take chunk digest, so storage subsystem can't
validate chunk data.

thread 'nydus_storage_worker_0' panicked at 'BlobMetaChunk doesn't support `chunk_id()`', storage/src/meta/mod.rs:740:9
stack backtrace:
thread 'nydus_storage_worker_3' panicked at 'BlobMetaChunk doesn't support `chunk_id()`', storage/src/meta/mod.rs:740:9
thread 'nydus_storage_worker_1' panicked at 'BlobMetaChunk doesn't support `chunk_id()`', storage/src/meta/mod.rs:740:9
   0: std::panicking::begin_panic
   1: <nydus_storage::meta::BlobMetaChunk as nydus_storage::device::BlobChunkInfo>::chunk_id
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:

Signed-off-by: Changewei Ge <gechangwei@bytedance.com>
@yqleng1987
Copy link
Contributor

@changweige , a new test job has been submitted. Please wait in patience.

@yqleng1987
Copy link
Contributor

@changweige , The CI test is completed, please check result:

Test CaseTest Result
merge-target-branch✅SUCCESS
build-docker-image✅SUCCESS
compile-nydus✅SUCCESS
compile-ctr-remote✅SUCCESS
compile-nydus-snapshotter✅SUCCESS
start-nydus-snapshotter-config-containerd✅SUCCESS
run-container-with-nydus-image✅SUCCESS

Congratulations, your test job passed!

@@ -719,6 +719,9 @@ impl BlobMetaState {
}

/// A fake `BlobChunkInfo` object created from blob metadata.
/// It represents a chunk within memory mapped chunk maps, which
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please help to add a blank line above, so the generated doc looks better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

@@ -402,10 +402,18 @@ pub trait BlobChunkInfo: Any + Sync + Send {
}

/// An enumeration to encapsulate different [BlobChunkInfo] implementations for [BlobIoDesc].
/// This helps to feed unified IO description to storage subsystem from both rafs v6 and v5 since
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please help to add a blank line above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Address(u32, u32),
// TODO: `Address` is is always converted to `Base` for v6, it is a little confusing.
Copy link
Collaborator

Choose a reason for hiding this comment

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

For rafs v6, the chunk info may be stored in the data blob instead of bootstrap blob. So only the blob reader from the storage subsystem could convert Address into BlobChunkInfo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I am thinking about removing Base(dyn BlobChunkinfo) out from BlobIoChunk. We can define BlobIoChunk as a medium type defining how this IO requesting backend storage data varies on v5 and v6(without decompression control info). Then trait BlobChunkinfo is the core structure in storage sub-system related to a single backend chunk IO. Then we don't have nested type conversion any more. storage subsystem should be capable to generate dyn BlobChunkinfo from BlobIoChunk

}

fn blob_index(&self) -> u32 {
self.as_base().blob_index()
}

fn compress_offset(&self) -> u64 {
self.as_base().compress_offset()
match self {
Self::Address(_, _) => 0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Which code could path trigger the panic?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Aha, got it. Debug may trigger the panic.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please help to add a comments for it? Otherwise the code smells badly:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

`BlobIoDesc` implements `Debug`, but the method called from fmt()
is calling its methods which panic.

Signed-off-by: Changewei Ge <gechangwei@bytedance.com>
@yqleng1987
Copy link
Contributor

@changweige , your pull request has been updated. A new test job will be submitted. Please wait in patience.

@yqleng1987
Copy link
Contributor

@changweige , your test job has passed, and no need to test again.

self.as_base().id()
// BlobIoChunk::Address is a medium type to pass chunk IO description
// for rafs v6. It can't implement BlobChunkInfo and calling `as_base`
// causes panic. So this is a workaround to avoid panic.
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it panic too in all the other methods that also calls self.as_base()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. other methods are also calling as_base(), however, they are not required and called by BlobIoDesc(). So they will not cause program panic now. My thought is to refactor the code a bit in the future in Rafs layer and to solve the panic problem for once and all.

@imeoer imeoer merged commit a9112e8 into dragonflyoss:master Jul 11, 2022
@changweige changweige deleted the v6-no-digest branch August 12, 2022 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants