[gnome-continuous] libqa: Ensure we don't hold a ref to the sysroot object
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous] libqa: Ensure we don't hold a ref to the sysroot object
- Date: Thu, 13 Aug 2015 15:29:02 +0000 (UTC)
commit 95e9910ea288d302509ca667e0d190dd89377dd5
Author: Colin Walters <walters verbum org>
Date: Thu Aug 13 11:05:27 2015 -0400
libqa: Ensure we don't hold a ref to the sysroot object
As it has an open fd. The best solution here would be some support in
gjs for predictable object destruction, but we don't have that at the
moment.
src/js/libqa.js | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/js/libqa.js b/src/js/libqa.js
index c3a0473..333b1cb 100644
--- a/src/js/libqa.js
+++ b/src/js/libqa.js
@@ -150,7 +150,7 @@ function copyDisk(srcpath, destpath, cancellable) {
destpath.get_path()], cancellable);
}
-function getSysrootAndCurrentDeployment(mntdir, osname) {
+function getCurrentDeploymentDirectory(mntdir, osname) {
let sysroot = OSTree.Sysroot.new(mntdir);
sysroot.load(null);
let deployments = sysroot.get_deployments().filter(function (deployment) {
@@ -159,12 +159,15 @@ function getSysrootAndCurrentDeployment(mntdir, osname) {
if (deployments.length == 0)
throw new Error("No deployments for " + osname + " in " + mntdir.get_path());
let current = deployments[0];
- return [sysroot, current];
+ let deployDir = sysroot.get_deployment_directory(current);
+ // Clean up the reference to the sysroot object, since it holds a fd open,
+ // and doing so may cause unmounts to fail
+ imports.system.gc();
+ return deployDir;
}
function getDeployDirs(mntdir, osname) {
- let [sysroot, current] = getSysrootAndCurrentDeployment(mntdir, osname);
- let deployDir = sysroot.get_deployment_directory(current);
+ let deployDir = getCurrentDeploymentDirectory(mntdir, osname);
return [deployDir, deployDir.get_child('etc')];
}
@@ -290,7 +293,7 @@ function _findFirstFileMatching(dir, prefix, cancellable) {
}
function _findCurrentKernel(mntdir, osname, cancellable) {
- let [sysroot, current] = getSysrootAndCurrentDeployment(mntdir, osname);
+ let deployDir = getCurrentDeploymentDirectory(mntdir, osname);
let deployBootdir = sysroot.get_deployment_directory(current).resolve_relative_path('boot');
return [_findFirstFileMatching(deployBootdir, 'vmlinuz-', cancellable),
_findFirstFileMatching(deployBootdir, 'initramfs-', cancellable)];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]