From 7699384b0c0ee9a7322b201cbd4ba2284a44c0c9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 16 Aug 2022 10:38:28 -0400 Subject: [PATCH] daemon: Add a workaround for bug 2111817 So about a month ago we merged https://github.com/openshift/machine-config-operator/pull/3239/commits/0bcb4d205d7343436ffdc482f8ede73bc429552a which dropped all the old workarounds we had for rpm-ostree bugs. I'm sure you are all shocked that less than a month later, we have a new one to add in this section. Actually though one of those previous bugs was arguably really a systemd bug provoked by rpm-ostree...and that's the case again here. This is all covered in https://bugzilla.redhat.com/show_bug.cgi?id=2104619 and https://github.com/coreos/rpm-ostree/pull/3939/commits/21c82ffe36dff61b2be8778634c571cb177a24e9 but TL;DR systemd's implementation of `InaccessiblePaths` has quadratic behavior in number of mounts, and so of course we only discover this when we're testing heavily loaded OCP clusters. The fix to rpm-ostree is inbound. But...adding this workaround which has the MCD dynamically reconfigure the system to drop that config will help unstick clusters so they can get the real fix. --- pkg/daemon/rpm-ostree.go | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/rpm-ostree.go b/pkg/daemon/rpm-ostree.go index 708db4bca5..e64cf96dda 100644 --- a/pkg/daemon/rpm-ostree.go +++ b/pkg/daemon/rpm-ostree.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "os/exec" + "path/filepath" "strings" "time" @@ -105,8 +106,35 @@ func (r *RpmOstreeClient) loadStatus() (*rpmOstreeState, error) { return &rosState, nil } +// See https://bugzilla.redhat.com/show_bug.cgi?id=2111817 +func bug2111817Workaround() error { + targetUnit := "/run/systemd/system/rpm-ostreed.service.d/bug2111817.conf" + // Do nothing if the file exists + if _, err := os.Stat(targetUnit); err == nil { + return nil + } + err := os.MkdirAll(filepath.Dir(targetUnit), 0o755) + if err != nil { + return err + } + dropin := `[Service] +InaccessiblePaths= +` + if err := writeFileAtomicallyWithDefaults(targetUnit, []byte(dropin)); err != nil { + return err + } + if err := runCmdSync("systemctl", "daemon-reload"); err != nil { + return err + } + glog.Infof("Enabled workaround for bug 2111817") + return nil +} + func (r *RpmOstreeClient) Initialize() error { - // This used to have some workarounds for rpm-ostree bugs, but we no longer need those. + if err := bug2111817Workaround(); err != nil { + return err + } + return nil }