-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fix casync seed slot mounting of already-ro-mounted slots #774
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed it and functionally I had no complaints. I only found few formatting changes based on defined coding style.
This was my first review on RAUC. I would appreciate if someone else would review this aswell.
src/slot.c
Outdated
|
||
for (GList *l = g_unix_mounts_get(NULL); l != NULL; l = l->next) { | ||
GUnixMountEntry *m = (GUnixMountEntry*)l->data; | ||
if (g_strcmp0(g_unix_mount_get_device_path(m),slot->device) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very much nitpicking, but I would change this to early-continue like used elsewhere in the code:
if (g_strcmp0(g_unix_mount_get_device_path(m),slot->device) != 0)
continue;
if (g_unix_mount_is_readonly(m)) {
....
src/update_handler.c
Outdated
if (!res) { | ||
g_propagate_prefixed_error(error, ierror, "Failed unmounting seed slot: "); | ||
goto out; | ||
g_message("Unmounting ext4 seed slot %s", seedslot->device); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is again nitpicking. I would format the code to conform to the coding style used and decrease the depth of this scope:
/* Unmount seed if needed */
if (!seed_mounted)
return res;
g_message("Unmounting ext4 seed slot %s", seedslot->device);
ierror = NULL; /* any previous error was propagated already */
if(r_umount_slot(seedslot, &ierror))
return res;
if (error && *error) {
/* the previous error is more relevant here */
g_warning("Ignoring umount error after previous error: %s", ierror->message);
g_clear_error(&ierror);
} else {
g_propagate_error(error, ierror);
}
return FALSE;
Codecov ReportBase: 71.23% // Head: 69.82% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #774 +/- ##
==========================================
- Coverage 71.23% 69.82% -1.42%
==========================================
Files 34 31 -3
Lines 11562 10793 -769
==========================================
- Hits 8236 7536 -700
+ Misses 3326 3257 -69
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
src/update_handler.c
Outdated
@@ -323,6 +323,7 @@ static gboolean casync_extract_image(RaucImage *image, gchar *dest, int out_fd, | |||
* file systems, additional mounts, etc. */ | |||
if (!seedslot->mount_point) { | |||
g_debug("Mounting %s to use as seed", seedslot->device); | |||
seedslot->extra_mount_opts = r_get_slot_current_mount_options(seedslot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't just replace extra_mount_opts
here. Also, we should just use read-only mounts for seeding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is now extended instead of being replaced.
As it accepted read-write slots before and we cannot easily determine what is actually readwrite and what is not (e.g. readonly file systems) I have left this untouched for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant is that extra_mount_opts
is configuration, so we can't change it here. Also we don't need to check if the slot is currently mounted read-only, as an additional read-only mount should always work.
I have now rebased this on #957 and reworked it to give it a chance to get merged. Things I changed:
|
This adapts casync seed slot unmount handling to what is done in archive_to_*_hanlder() for slot unmount handling already. Signed-off-by: Jonas Licht <[email protected]> Signed-off-by: Enrico Jorns <[email protected]>
Re-mounting a ro (readonly) slot rw (readwrite) will cause an error or a fallback with a warning, depending on the mount version/veriant used. Also mounting an rw slot as ro will fail. Thus make sure we use the same option when remounting the slot for seeding that the original mount already had. Fixes rauc#773 Signed-off-by: Jonas Licht <[email protected]> Signed-off-by: Enrico Jorns <[email protected]>
I've rebased it on master after the merge of #957 to make it easier to review. |
We've split off the simple fix as #977. When that is merged, only the seed slot handling remains. At that point, we should probably change it to use |
Check mount options of the seed slot.
Unmount seed slot on casync failure too.