all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: 29100@debbugs.gnu.org
Subject: [bug#29100] [PATCH 2/3] install: Use overlayfs instead of unionfs.
Date: Wed,  1 Nov 2017 09:39:51 +0100	[thread overview]
Message-ID: <20171101083952.5376-2-h.goebel@crazy-compilers.com> (raw)
In-Reply-To: <20171101083952.5376-1-h.goebel@crazy-compilers.com>

I dediced to keep adding /tmp as tmpfs since I was not able to trigger bug
while still using unionfs, so I could not verify whether this mount is still
needed with overlayfs.  Mapping /tmp to tmpfs does not harm, so we are on the
save side.

* gnu/system/install.scm (make-cow-store): Mount /gnu/store without additional
  read-only bind-mount, since in overlayfs the "lower" level is always
  read-only. Add work-dir required by overlayfs. No need to sleep anymore
  since now using the mount syscall. [unionfs]: remove now unused function.
  (%installation-services): Update comment.
  (installation-os)[file-systems]: Update comment.
---
 gnu/system/install.scm | 49 +++++++++++++++++++------------------------------
 1 file changed, 19 insertions(+), 30 deletions(-)

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index eb362f91a..0c771e81f 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -71,19 +71,6 @@ manual."
   "Return a gexp that makes the store copy-on-write, using TARGET as the
 backing store.  This is useful when TARGET is on a hard disk, whereas the
 current store is on a RAM disk."
-  (define (unionfs read-only read-write mount-point)
-    ;; Make MOUNT-POINT the union of READ-ONLY and READ-WRITE.
-
-    ;; Note: in the command below, READ-WRITE appears before READ-ONLY so that
-    ;; it is considered a "higher-level branch", as per unionfs-fuse(8),
-    ;; thereby allowing files existing on READ-ONLY to be copied over to
-    ;; READ-WRITE.
-    #~(fork+exec-command
-       (list (string-append #$unionfs-fuse "/bin/unionfs")
-             "-o"
-             "cow,allow_other,use_ino,max_files=65536,nonempty"
-             (string-append #$read-write "=RW:" #$read-only "=RO")
-             #$mount-point)))
 
   (define (set-store-permissions directory)
     ;; Set the right perms on DIRECTORY to use it as the store.
@@ -97,23 +84,23 @@ current store is on a RAM disk."
         (mkdir-p tmpdir)
         (mount tmpdir "/tmp" "none" MS_BIND))
 
-      (unless (file-exists? "/.ro-store")
-        (mkdir "/.ro-store")
-        (mount #$(%store-prefix) "/.ro-store" "none"
-               (logior MS_BIND MS_RDONLY)))
-
-      (let ((rw-dir (string-append target #$%backing-directory)))
+      (let* ((rw-dir (string-append target #$%backing-directory))
+             ;; FIXME: calculate work-dir from backing-directory:
+             ;; normpath(backing-directory + "../.overlayfs-workdir")
+             (work-dir (string-append target "/tmp/.overlayfs-workdir")))
         (mkdir-p rw-dir)
+        (mkdir-p work-dir)
         (mkdir-p "/.rw-store")
         #$(set-store-permissions #~rw-dir)
         #$(set-store-permissions "/.rw-store")
 
-        ;; Mount the union, then atomically make it the store.
-        (and #$(unionfs "/.ro-store" #~rw-dir "/.rw-store")
-             (begin
-               (sleep 1) ;XXX: wait for unionfs to be ready
-               (mount "/.rw-store" #$(%store-prefix) "" MS_MOVE)
-               (rmdir "/.rw-store"))))))
+        ;; Mount the overlay, then atomically make it the store.
+        (mount "none" "/.rw-store" "overlay" 0
+               (string-append "lowerdir=" #$(%store-prefix) ","
+                              "upperdir=" rw-dir ","
+                              "workdir=" work-dir))
+        (mount "/.rw-store" #$(%store-prefix) "" MS_MOVE)
+        (rmdir "/.rw-store"))))
 
 (define cow-store-service-type
   (shepherd-service-type
@@ -278,7 +265,7 @@ You have been warned.  Thanks for being so brave.
                     (allow-empty-passwords? #f)
                     (password-authentication? #t)))
 
-          ;; Since this is running on a USB stick with a unionfs as the root
+          ;; Since this is running on a USB stick with a overlayfs as the root
           ;; file system, use an appropriate cache configuration.
           (nscd-service (nscd-configuration
                          (caches %nscd-minimal-caches)))
@@ -317,10 +304,12 @@ Use Alt-F2 for documentation.
               (title 'label)
               (type "ext4"))
 
-            ;; Make /tmp a tmpfs instead of keeping the unionfs.  This is
-            ;; because FUSE creates '.fuse_hiddenXYZ' files for each open file,
-            ;; and this confuses Guix's test suite, for instance.  See
-            ;; <http://bugs.gnu.org/23056>.
+            ;; Make /tmp a tmpfs instead of keeping the overlayfs.  This
+            ;; originally was used for unionfs because FUSE creates
+            ;; '.fuse_hiddenXYZ' files for each open file, and this confuses
+            ;; Guix's test suite, for instance (see
+            ;; <http://bugs.gnu.org/23056>).  We keep this for overlayfs to be
+            ;; on the save side.
             (file-system
               (mount-point "/tmp")
               (device "none")
-- 
2.13.5

  reply	other threads:[~2017-11-01  8:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01  8:33 [bug#29100] [PATCH 0/3] Use overlayfs instead of unionfs Hartmut Goebel
2017-11-01  8:39 ` [bug#29100] [PATCH 1/3] build: " Hartmut Goebel
2017-11-01  8:39   ` Hartmut Goebel [this message]
2017-11-02 17:44     ` [bug#29100] [PATCH 2/3] install: " Danny Milosavljevic
2017-11-02 18:20       ` Hartmut Goebel
2017-11-05 21:05         ` Ludovic Courtès
2017-11-06  9:33           ` Hartmut Goebel
2017-11-01  8:39   ` [bug#29100] [PATCH 3/3] gnu: service: Update comment Hartmut Goebel
2017-11-05 21:09     ` Ludovic Courtès
2017-11-05 21:08   ` [bug#29100] [PATCH 1/3] build: Use overlayfs instead of unionfs Ludovic Courtès
2017-11-06  9:40     ` Hartmut Goebel
2017-11-06 10:30       ` Ludovic Courtès
2017-11-08 17:26 ` bug#29100: Updated, tested again and merged Hartmut Goebel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171101083952.5376-2-h.goebel@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --cc=29100@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.