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

Avoid manual handling of loop devices #533

Merged
merged 7 commits into from
Aug 31, 2024
Merged

Commits on Aug 5, 2024

  1. Avoid manual handling of loop devices

    Cryptsetup is since 1.3.0 capable of setting up a loop device if the
    device argument is a file.
    This has the additional benefit that those loop devices will get the
    AUTOCLEAR flag (available with Linux 2.6.25). This means those loop
    devices will be closed as soon they're unused (on luksClose).
    Narrat committed Aug 5, 2024
    Configuration menu
    Copy the full SHA
    bd79dbe View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2024

  1. umount_tomb: avoid double execution of list_tomb_binds()

    Especially directly after each other.
    Narrat committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    18830a6 View commit details
    Browse the repository at this point in the history
  2. list_tomb_mounts: simplify the function

    previously it had dedicated cases for listing all tombs and a singular
    one, which duplicated code.
    The function got reworked, that it uses a different approach for
    findmnt. Instead of filtering the general result, it now uses --source
    on the tomb specific crypsetup mapper. Those are searched via general
    globbing of the devices in /dev/mapper. This allows to combine the
    previous separate cases.
    Additionally remove the usage of _sudo for findmnt, as it is not
    necessary.
    Narrat committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    252cb30 View commit details
    Browse the repository at this point in the history
  3. list_tomb_binds: simplify function

    similar to list_tomb_mounts, rework the findmnt usage to usage of the
    actual tomb mapper device.
    Simplifies the awk usage and just only one argument needed for the
    mapper function.
    Narrat committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    68970ef View commit details
    Browse the repository at this point in the history
  4. rework handling of bind mounts

    Instead of only looking for bind mounts from within a tomb due to bind-hooks, also consider bind mounts that happenfrom the outside (example: open a tomb and manually issue a mount --bind /media/tomb some/other/location).
    Such a mount wouldn't be filtered before (only looking for an additional [/path/] added to TARGET.
    Instead look for every mount that is related to the respective /dev/mapper/ entry of a tomb and also close or list them.
    This helps to avoid to loop again against mounted tombs inside the main loop which loops over mounted tombs.
    Narrat committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    ca1674b View commit details
    Browse the repository at this point in the history
  5. slam_tomb: adjust for changes in list_tomb_mounts

    As the argument for list_tomb_mounts uses the input directly, it needs to be uniform.
    Therefore one must make sure that extraneous character like parentheses are removed from the variable.
    And those are in place in tombname for slam_tomb().
    Narrat committed Aug 6, 2024
    Configuration menu
    Copy the full SHA
    f207c9b View commit details
    Browse the repository at this point in the history

Commits on Aug 7, 2024

  1. tests: add outside bind mounts to 75_hooks

    it may happen, that someone bind mounts manually or via an immutable setup the tomb mountdir somewhere else.
    Tomb should be able to discover such mounts and close them if the tomb itself is closed.
    Narrat committed Aug 7, 2024
    Configuration menu
    Copy the full SHA
    5133d68 View commit details
    Browse the repository at this point in the history