stored: fix crash when using jit reservation with no matching device; fix reservation error#2141
Merged
BareosBot merged 3 commits intobareos:masterfrom Feb 24, 2025
Conversation
sebsura
commented
Jan 28, 2025
6cb6f14 to
7bb4eb9
Compare
florian-at-bareos
approved these changes
Feb 7, 2025
Contributor
There was a problem hiding this comment.
Nice work!
The DoAppendData method is incredibly difficult to understand for me because it has so many logical branches with the ok variable. I'm having a very hard time figuring out which code in the method was actually executed if something didn't work and the okvariable was set to false in the middle of the method.
If you understand this method and think it's not to hard to change up this method maybe you could do that, if not just leave it like it is.
I was thinking of changing
something went wrong...
debug messages...
ok = false;
break;
rest of the function still executes...
to
something went wrong...
debug messages...
call clean up functions...
return false;
Contributor
Author
|
We should definitely rework the logic of that function, but as we want to backport these changes to earlier versions, i would not do so in this pr. |
Currently, if jit reservation is used but no device could be found, we break out of the backup loop. Afterwards the sd tries to destroy the dcr if it exists, which includes releasing the acquired device. This is done even if no device was attached to the dcr.
All jobs reserve a viable volume to use when they reserve a device. Sadly some code paths ignored this and instead just used the currently mounted device for writing regardless of whether it was reserved by somebody else or not. This caused weird `Volume X wanted by Device Y is in use by device Z` error messages as device Y actually reserved volume X, but device Z simply decided to use it as it was currently mounted, which ultimately cause an operator message to be sent out. As volumes that are currently mounted in the device are preferred for reservation anyways, we simply remove the `IsSuitableVolumeMounted()` code paths. If this becomes a problem in the future we can simply try to reserve the currently mounted volume and use it if it worked.
decf9aa to
8fcdb7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, if jit reservation is used but no device could be found, we break out of the backup loop. Afterwards the sd tries to destroy the dcr if it exists, which includes releasing the acquired device. This is done even if no device was attached to the dcr.
See #2139 and #2140
Also fixes a reservation related issue, see: bareos/internal#92
Thank you for contributing to the Bareos Project!
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality