61 lines
2.8 KiB
Diff
61 lines
2.8 KiB
Diff
From: Dan Nicholson <nicholson@endlessm.com>
|
|
Date: Wed, 11 Oct 2017 14:03:10 +0000
|
|
Subject: lib/deploy: Ignore FIFREEZE/FITHAW errors when already in state
|
|
|
|
If the filesystem is already frozen, FIFREEZE returns EBUSY, and if the
|
|
filesystem is already thawed, FITHAW returns EINVAL. It's very unlikely
|
|
these issues would arise on a real ostree system since the sysroot would
|
|
be locked during the freeze/thaw cycle.
|
|
|
|
However, when multiple fake sysroots are used during the test suite (run
|
|
as root), the tests could race to run the freeze/thaw cycle without
|
|
locking. Furthermore, there's no reason why an independent process might
|
|
be trying to freeze the filesystem while ostree was deploying. Ignore
|
|
but warn for these errors since there's not much ostree can do about it,
|
|
anyways.
|
|
|
|
Closes: #1260
|
|
Approved by: cgwalters
|
|
Origin: upstream, 2017.13, commit:a5b7660c940a200adac1a7d217e4a1cd72719021
|
|
---
|
|
src/libostree/ostree-sysroot-deploy.c | 16 +++++++++++++---
|
|
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
|
|
index a89711f..e37db39 100644
|
|
--- a/src/libostree/ostree-sysroot-deploy.c
|
|
+++ b/src/libostree/ostree-sysroot-deploy.c
|
|
@@ -1321,11 +1321,15 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
|
|
/* Do a freeze/thaw cycle; TODO add a FIFREEZETHAW ioctl */
|
|
if (ioctl (rootfs_dfd, FIFREEZE, 0) != 0)
|
|
{
|
|
- /* Not supported, or we're running in the unit tests (as non-root)?
|
|
+ /* Not supported, we're running in the unit tests (as non-root), or
|
|
+ * the filesystem is already frozen (EBUSY).
|
|
* OK, let's just do a syncfs.
|
|
*/
|
|
- if (G_IN_SET (errno, EOPNOTSUPP, EPERM))
|
|
+ if (G_IN_SET (errno, EOPNOTSUPP, EPERM, EBUSY))
|
|
{
|
|
+ /* Warn if the filesystem was already frozen */
|
|
+ if (errno == EBUSY)
|
|
+ g_debug ("Filesystem already frozen, falling back to syncfs");
|
|
if (TEMP_FAILURE_RETRY (syncfs (rootfs_dfd)) != 0)
|
|
return glnx_throw_errno_prefix (error, "syncfs");
|
|
/* Write the completion, and return */
|
|
@@ -1338,7 +1342,13 @@ fsfreeze_thaw_cycle (OstreeSysroot *self,
|
|
}
|
|
/* And finally thaw, then signal our completion to the watchdog */
|
|
if (TEMP_FAILURE_RETRY (ioctl (rootfs_dfd, FITHAW, 0)) != 0)
|
|
- return glnx_throw_errno_prefix (error, "ioctl(FITHAW)");
|
|
+ {
|
|
+ /* Warn but don't error if the filesystem was already thawed */
|
|
+ if (errno == EINVAL)
|
|
+ g_debug ("Filesystem already thawed");
|
|
+ else
|
|
+ return glnx_throw_errno_prefix (error, "ioctl(FITHAW)");
|
|
+ }
|
|
if (write (sock_parent, &c, sizeof (c)) != sizeof (c))
|
|
return glnx_throw_errno_prefix (error, "write(watchdog FITHAW complete)");
|
|
}
|