diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-12-12 15:03:35 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-12-12 15:03:35 +0100 |
commit | 302a84a593e4be417d739caf4e5385df536e3943 (patch) | |
tree | 3e9e908e52e3d4a141552d8fda9a7fbe2d41637c /gnu/build | |
parent | 3677b97030e5954fa26bdb435e0d3379a1a4ec43 (diff) | |
parent | 6dbdb5fcf5640c126ac65479b835aba83aea2a6d (diff) |
Merge branch 'version-1.4.0'
Diffstat (limited to 'gnu/build')
-rw-r--r-- | gnu/build/install.scm | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gnu/build/install.scm b/gnu/build/install.scm index 33a9616c0d..d4982650c1 100644 --- a/gnu/build/install.scm +++ b/gnu/build/install.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2013-2020, 2022 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com> ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; @@ -282,12 +282,31 @@ disk." (mount "/.rw-store" (%store-directory) "" MS_MOVE) (rmdir "/.rw-store"))) +(define (umount* directory) + "Unmount DIRECTORY, but retry a few times upon EBUSY." + (let loop ((attempts 5)) + (catch 'system-error + (lambda () + (umount directory)) + (lambda args + (if (and (= EBUSY (system-error-errno args)) + (> attempts 0)) + (begin + (sleep 1) + (loop (- attempts 1))) + (apply throw args)))))) + (define (unmount-cow-store target backing-directory) "Unmount copy-on-write store." (let ((tmp-dir "/remove")) (mkdir-p tmp-dir) (mount (%store-directory) tmp-dir "" MS_MOVE) - (umount tmp-dir) + + ;; We might get EBUSY at this point, possibly because of lingering + ;; processes with open file descriptors. Use 'umount*' to retry upon + ;; EBUSY, leaving a bit of time. See <https://issues.guix.gnu.org/59884>. + (umount* tmp-dir) + (rmdir tmp-dir) (delete-file-recursively (string-append target backing-directory)))) |