Skip to content

Commit

Permalink
Merge pull request #91162 from symphorien/backport-btrfs-scrub-success
Browse files Browse the repository at this point in the history
[20.03] backport: nixos/btrfs autoScrub: don't fail when scrub finishes successfully
  • Loading branch information
timokau committed Jul 21, 2020
2 parents cbf3cb5 + 154c3f3 commit 9ea61f7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nixos/modules/tasks/filesystems/btrfs.nix
Expand Up @@ -128,7 +128,10 @@ in
Nice = 19;
IOSchedulingClass = "idle";
ExecStart = "${pkgs.btrfs-progs}/bin/btrfs scrub start -B ${fs}";
ExecStop = "${pkgs.btrfs-progs}/bin/btrfs scrub cancel ${fs}";
# if the service is stopped before scrub end, cancel it
ExecStop = pkgs.writeShellScript "btrfs-scrub-maybe-cancel" ''
(${pkgs.btrfs-progs}/bin/btrfs scrub status ${fs} | ${pkgs.gnugrep}/bin/grep finished) || ${pkgs.btrfs-progs}/bin/btrfs scrub cancel ${fs}
'';
};
};
in listToAttrs (map scrubService cfgScrub.fileSystems);
Expand Down

0 comments on commit 9ea61f7

Please sign in to comment.