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

Tasleson read bda signature #1440

Closed

Conversation

mulkieran
Copy link
Member

@mulkieran mulkieran commented Feb 25, 2019

The first three commits just get rid of stray formatting changes.

The next three are straightforward tidies.

The last just adds more precision to setup() function specification.

There are also two review comments.

@mulkieran mulkieran self-assigned this Feb 25, 2019
/// Return None if the static header's magic does not match for *both* copies.
/// Return None if it's not a Stratis device.
/// Return an Err if the metadata seems to indicate that the device is
/// a Stratis device, but no well-formed signature block could be read.
Copy link
Member Author

@mulkieran mulkieran Feb 25, 2019

Choose a reason for hiding this comment

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

This returns an error in two situations:

  • If the metadata seems to indicate that the device is a Stratis deivce, but no well-formed signature could be found.
  • If a well-formed signature was found but an error occurred during the repair of a second, ill-formed, old, or unreadable signature.

I think it is right to return an error in the first case, but I think the second should possibly be handled differently. I think a good option is to enrich the return type to
StratisResult<Option<StaticHeader>, Option<some error thing if repair fails>>.
Alternatively, it is fine to open an issue to address this question in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

New issue: #1443

Ok(Some(loc_2))
(Err(_), Err(_)) => {
let err_str =
"Appeared to be a Stratis device, but no valid sigblock found";
Copy link
Member Author

@mulkieran mulkieran Feb 25, 2019

Choose a reason for hiding this comment

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

Might as well enhance this error message. The contents of both buffers are available, so they might as well be included. Actually, better to include both errors, and improve the error messages in the errors returned from sigblock_from_buf. I'ld say that it makes sense to file an issue for improving sigblock_from_buf error messages rather than address that in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

New issue: #1444

@mulkieran
Copy link
Member Author

Jenkins error is just the udevadm error.

Change signature to return
(io::Result<[u8; SECTOR_SIZE]>, io::Result<[u8; SECTOR_SIZE]>) so
that we can distinguish the difference from an IO error and a
device that simply has nothing but zeros.

Addresses: stratis-storage#1016

Signed-off-by: Tony Asleson <[email protected]>
Signed-off-by: mulhern <[email protected]>
@mulkieran mulkieran force-pushed the tasleson-read_bda_signature branch 2 times, most recently from 8c09d1d to 19d8431 Compare February 26, 2019 18:39
If the sigblocks differ but the initialization times agree return an error
There is no good explanation for why this should happen, and no way to
know how to repair.

Return an error if unable to read data at either sigblock location.
This preserves previous behavior and seems more correct to me.

Signed-off-by: mulhern <[email protected]>
@mulkieran mulkieran force-pushed the tasleson-read_bda_signature branch from 19d8431 to 700ac15 Compare February 26, 2019 18:40
} else if loc_1.initialization_time == loc_2.initialization_time {
// Inexplicable disagreement among static headers
let err_str = "Appeared to be a Stratis device, but signature blocks disagree.";
Err(StratisError::Engine(ErrorEnum::Invalid, err_str.into()))
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO this would be extremely unlikely, but if it did happen I would like to have the contents of each super blocks dumped to the logs.

@@ -373,7 +383,8 @@ impl StaticHeader {
}
(Err(_), Err(_)) => {
// Unable to read the device at all.
Ok(None)
let err_str = "Unable to read data at sigblock locations.";
Err(StratisError::Engine(ErrorEnum::Invalid, err_str.into()))
Copy link
Contributor

@tasleson tasleson Feb 26, 2019

Choose a reason for hiding this comment

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

Returning None was the previous behavior. scratch that, if we got a read error from both we would have bubbled up the read error from the first one.

@mulkieran
Copy link
Member Author

Merged into #1439 .

@mulkieran mulkieran closed this Feb 28, 2019
@mulkieran mulkieran deleted the tasleson-read_bda_signature branch February 28, 2019 17:13
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.

2 participants