From 0079158f737167d2a97b7899e6f58133f7602c17 Mon Sep 17 00:00:00 2001 From: David James Date: Thu, 28 Jun 2012 16:57:19 -0700 Subject: [PATCH] Stop gvfs daemons earlier during enter_chroot. The killall commands for stopping gvfs weren't working consistently for two reasons: 1) They ran too late, after it already picked up the mounts in cros_sdk. 2) killall sometimes can only access the first 15 characters of a process name, so we should only match on these characters. BUG=chromium-os:23443 TEST=Verify gvfs is properly stopped when entering the chroot on precise systems. Change-Id: I16aff4b0d9ac101083b63e06e55d50869479a152 Reviewed-on: https://gerrit.chromium.org/gerrit/26369 Reviewed-by: Pawel Osciak Reviewed-by: Mike Frysinger Commit-Ready: David James Tested-by: David James --- sdk_lib/enter_chroot.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh index d6ef7c4a2c..6683004832 100755 --- a/sdk_lib/enter_chroot.sh +++ b/sdk_lib/enter_chroot.sh @@ -261,6 +261,13 @@ setup_env() { disown $! fi + # Turn off automounting of external media when we enter the chroot by + # stopping the gvfs-gdu-volume-monitor and gvfsd-trash daemons. This is + # currently the most reliable way to disable automounting. + # See https://bugzilla.gnome.org/show_bug.cgi?id=677648 + sudo killall -STOP -r '^gvfs-gdu-volume.*$|^gvfsd-trash$' 2>/dev/null \ + || true + debug "Mounting chroot environment." MOUNT_CACHE=$(echo $(awk '{print $2}' /proc/mounts)) mount_queue_init @@ -387,12 +394,6 @@ setup_env() { warn "-- Note: modprobe fuse failed. gmergefs will not work" fi - # Turn off automounting of external media when we enter the chroot by - # stopping the gvfs-gdu-volume-monitor and gvfsd-trash daemons. This is - # currently the most reliable way to disable automounting. - # See https://bugzilla.gnome.org/show_bug.cgi?id=677648 - sudo killall -STOP gvfs-gdu-volume-monitor gvfsd-trash 2>/dev/null || true - # Fix permissions on ccache tree. If this is a fresh chroot, then they # might not be set up yet. Or if the user manually `rm -rf`-ed things, # we need to reset it. Otherwise, gcc itself takes care of fixing things @@ -532,7 +533,8 @@ teardown_env() { safe_umount_tree "${MOUNTED_PATH}/" # Now that we've exited the chroot, allow automounting again. - sudo killall -CONT gvfs-gdu-volume-monitor gvfsd-trash 2>/dev/null || true + sudo killall -CONT -r '^gvfs-gdu-volume.*$|^gvfsd-trash$' 2>/dev/null \ + || true fi ) 200>>"$LOCKFILE" || die "teardown_env failed" }