mail archive of the rauc mailing list
 help / color / mirror / Atom feed
From: Ladislav Michl <ladis@linux-mips.org>
To: rauc@pengutronix.de
Cc: Trent Piepho <tpiepho@impinj.com>
Subject: [RAUC] [PATCH 3/3] Bind mount seed slot
Date: Fri, 10 May 2019 11:49:43 +0200	[thread overview]
Message-ID: <20190510094943.GD29451@lenoch> (raw)
In-Reply-To: <20190510094803.GA29451@lenoch>

See that FIXME...
---
 src/update_handler.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/update_handler.c b/src/update_handler.c
index b8d044f..6f490d0 100644
--- a/src/update_handler.c
+++ b/src/update_handler.c
@@ -1,6 +1,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <gio/gunixoutputstream.h>
+#include <glib/gstdio.h>
 #include <mtd/ubi-user.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -251,13 +252,33 @@ static gboolean casync_extract_image(RaucImage *image, gchar *dest, GError **err
 		 * path to allow seeding. E.g. using mount path '/' for the
 		 * rootfs slot seed is inaproppriate as it contains virtual
 		 * file systems, additional mounts, etc. */
+		/* FIXME: r_mount_slot should be fixed instead to handle bind mounts
+		 * as well as "nodev" mounts */
 		if (!seedslot->mount_point) {
 			g_debug("Mounting %s to use as seed", seedslot->device);
-			res = r_mount_slot(seedslot, &ierror);
-			if (!res) {
-				g_warning("Failed mounting for seeding: %s", ierror->message);
-				g_clear_error(&ierror);
-				goto extract;
+			if (seedslot->ext_mount_point) {
+				gchar *mount_point = r_create_mount_point(seedslot->name, &ierror);
+				if (!mount_point) {
+					g_warning("Failed creating bind mount point for seeding: %s", ierror->message);
+					g_clear_error(&ierror);
+					goto extract;
+				}
+				res = r_mount_full(seedslot->ext_mount_point, mount_point, NULL, 0, "bind", &ierror);
+				if (!res) {
+					g_warning("Failed bind mounting for seeding: %s", ierror->message);
+					g_clear_error(&ierror);
+					g_rmdir(mount_point);
+					g_free(mount_point);
+					goto extract;
+				}
+				seedslot->mount_point = mount_point;
+			} else {
+				res = r_mount_slot(seedslot, &ierror);
+				if (!res) {
+					g_warning("Failed mounting for seeding: %s", ierror->message);
+					g_clear_error(&ierror);
+					goto extract;
+				}
 			}
 			seed_mounted = TRUE;
 		}
-- 
2.20.1


_______________________________________________
RAUC mailing list

      parent reply	other threads:[~2019-05-10  9:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10  9:48 [RAUC] [RFC 0/3] Fix slots with nodev mounts Ladislav Michl
2019-05-10  9:48 ` [RAUC] [PATCH 1/3] Normalize device names to find mounted slots (2) Ladislav Michl
2019-05-10  9:49 ` [RAUC] [PATCH 2/3] Try harder to determine slot state (preview) Ladislav Michl
2019-05-10  9:49 ` Ladislav Michl [this message]

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=20190510094943.GD29451@lenoch \
    --to=ladis@linux-mips.org \
    --cc=rauc@pengutronix.de \
    --cc=tpiepho@impinj.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox