[node-patches] Change in ovirt-node[master]: mount only files and directories listed in /etc/files

mburns at redhat.com mburns at redhat.com
Tue Oct 2 20:11:26 UTC 2012


Michael Burns has uploaded a new change for review.

Change subject: mount only files and directories listed in /etc/files
......................................................................

mount only files and directories listed in /etc/files

Previously, we scanned /config for all files and bind mounted
the files directly.  This lead to some inconsistencies between
reboots.  A file that is persisted because it's parent directory
is persisted in bind mounted directly after a reboot rather than
it's parent directory.  This causes problems with tools like
unlink or rename that can't access the file when it's bind
mounted.

Also, a directory that is persisted with no files inside would
end up not being created/bind-mounted on reboot

rhbz#860279

Change-Id: I6dce8d619b8a6a51d636974eb34141f8aac9bae7
Signed-off-by: Mike Burns <mburns at redhat.com>
---
M scripts/ovirt-functions.in
1 file changed, 5 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/17/8317/1

diff --git a/scripts/ovirt-functions.in b/scripts/ovirt-functions.in
index 0fb87b5..5ca1fff 100644
--- a/scripts/ovirt-functions.in
+++ b/scripts/ovirt-functions.in
@@ -382,15 +382,14 @@
             cp -rv --update /live/config/* /config
         fi
         # bind mount all persisted configs to rootfs
-        for f in $(find /config -type f); do
-            target=${f#/config}
-            if grep -q " $target ext[234]" /proc/mounts ; then
+        for f in $(cat /config/files); do
+            if grep -q " $f ext[234]" /proc/mounts ; then
                 # skip if already bind-mounted
                 true
             else
-                mkdir -p "$(dirname $target)"
-                touch "$target"
-                mount -n --bind $f "$target"
+                mkdir -p "$(dirname "$f")"
+                touch "$f"
+                mount -n --bind "/config/$f" "$target"
             fi
         done
 


--
To view, visit http://gerrit.ovirt.org/8317
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dce8d619b8a6a51d636974eb34141f8aac9bae7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Michael Burns <mburns at redhat.com>



More information about the node-patches mailing list