Skip to content

storage daemon: fix crash on volume swap#1356

Merged
pstorz merged 6 commits intobareos:masterfrom
arogge:dev/arogge/master/sd-reservation-crash
Jan 25, 2023
Merged

storage daemon: fix crash on volume swap#1356
pstorz merged 6 commits intobareos:masterfrom
arogge:dev/arogge/master/sd-reservation-crash

Conversation

@arogge
Copy link
Member

@arogge arogge commented Jan 17, 2023

Fix a problem introduced in Bareos 22 with PR #1271 where the SD would crash on a volume swap.

This PR also introduces a testing backend to make it easier to test autochangers. However, a change in the Device interface is required for this (so we shouldn't backport that).

Thank you for contributing to the Bareos Project!

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

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)

General
  • PR name is meaningful
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Check backport line
  • Is the PR title usable as CHANGELOG entry?
  • Separate commit for CHANGELOG.md ("update CHANGELOG.md"). The PR number is correct.
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
  • bareos-check-sources --since-merge does not report any problems
Tests
  • Decision taken that a test is required (if not, then remove this paragraph)
  • The choice of the type of test (unit test or systemtest) is reasonable
  • Testname matches exactly what is being tested
  • On a fail, output of the test leads quickly to the origin of the fault

@arogge arogge force-pushed the dev/arogge/master/sd-reservation-crash branch 3 times, most recently from d8776b6 to 1c71841 Compare January 18, 2023 08:57
@arogge arogge marked this pull request as draft January 18, 2023 09:15
@arogge arogge marked this pull request as ready for review January 18, 2023 11:00
@arogge arogge force-pushed the dev/arogge/master/sd-reservation-crash branch from 1c71841 to c1de9e1 Compare January 18, 2023 11:01
@pstorz pstorz self-requested a review January 18, 2023 11:02
Copy link
Member

@pstorz pstorz left a comment

Choose a reason for hiding this comment

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

Good work! Impressive, how simple now it is to add a new backend device.

@pstorz pstorz changed the title Fix crash on volume swap storage daemon: fix crash on volume swap Jan 19, 2023
@pstorz pstorz self-requested a review January 19, 2023 15:08
Copy link
Member

@pstorz pstorz left a comment

Choose a reason for hiding this comment

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

Good work!

@arogge arogge force-pushed the dev/arogge/master/sd-reservation-crash branch 2 times, most recently from aba1ad7 to 4d01d4e Compare January 23, 2023 14:56
Allow each backend to decide if it is a tape or not. Previously only a
backend named "tape" would be considered a tape.
With this change we can now add new backends that are also treated like
a tape.
Duplicate the file backend and pretend it is a tape. This is meant for
testing purposes only and will allow developers to run
autochanger-related tests without the need for an autochanger or a full
emulator (like mhvtl).
Add test system:file-autochanger:swapdev to track the broken volume
swapping behaviour introduced in Bareos 22.0.0.
This also adds a virtual file-based autochanger that can be used for
other kinds of tests.
Fix a problem introduced in Bareos 22 with commit
6c265ec replace volatile device pointers with actual variable

Due to an oversight in a refactoring, a swap would no longer move the
volume to another device, but switch over to use the device that had the
desired volume loaded.
As that device was not reserved, but was unreserved during acquire, the
storage daemon would eventually crash in this case.
Instead of setting the POSITION_INDEPENDENT_CODE flag on individual
targets, we simply enable it for everything in core/
Also, by utilizing PIE (Position Independent Executable) support in
CMake we make sure all our executables are build with PIE enabled if the
toolchain supports it.
@arogge arogge force-pushed the dev/arogge/master/sd-reservation-crash branch from 4d01d4e to 5243294 Compare January 23, 2023 15:21
@pstorz pstorz merged commit f88427d into bareos:master Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants