Revert gvfs hacks to known-good state.

Originally, I patched enter_chroot.sh to stop the gvfs daemons to work
around an issue where these daemons would prevent loop devices from being
unmounted. See https://bugzilla.gnome.org/show_bug.cgi?id=677648

Unfortunately, temporarily stopping gvfs daemons has a bad side effects:
other GUI applications that rely on these daemons responding start hanging.
This can be reproduced, for example, by starting 'gedit'.

To fix these hangs, I'm just reverting my patches to enter_chroot.sh and
restoring the scripts to where they were before.

This reverts the following patches:
  1. Stop gvfs daemons earlier during enter_chroot.
     This reverts commit 0079158f73.
  2. Revert "Stop the gvfsd-trash daemon during enter_chroot."
     This reverts commit 654a00bd61.
  3. Revert "Stop the automounting daemon whenever we're inside the chroot."
     This reverts commit fae0a59e8b.
  4. Revert "Clean up update_bootloaders.sh to avoid sleeping."
     This reverts commit 0103b59138.

BUG=chromium-os:23443
TEST=Trybot run.

Change-Id: Ie9ff222fe5fc7232fd1fc39af129cc18531118c6
Reviewed-on: https://gerrit.chromium.org/gerrit/26922
Reviewed-by: Chris Wolfe <cwolfe@chromium.org>
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
Reviewed-by: Brian Harring <ferringb@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
This commit is contained in:
David James 2012-07-09 08:12:26 -07:00 committed by Gerrit
parent 224817fda9
commit c9ca3dbb0e
2 changed files with 34 additions and 20 deletions

View File

@ -261,13 +261,6 @@ 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
@ -394,6 +387,22 @@ setup_env() {
warn "-- Note: modprobe fuse failed. gmergefs will not work"
fi
# Turn off automounting of external media when we enter the
# chroot; thus we don't have to worry about being able to unmount
# from inside.
if SAVED_PREF=$(gconftool-2 -g ${AUTOMOUNT_PREF} 2>/dev/null); then
if [ "${SAVED_PREF}" != "false" ]; then
if [ $(gconftool-2 -s --type=boolean ${AUTOMOUNT_PREF} false) ]; then
warn "-- Note: USB sticks may be automounted by your host OS."
warn "-- Note: If you plan to burn bootable media, you may need to"
warn "-- Note: unmount these devices manually, or run image_to_usb.sh"
warn "-- Note: outside the chroot."
fi
fi
fi
# Always write the temp file so we can read it when exiting
echo "${SAVED_PREF:-false}" > "${FLAGS_chroot}${SAVED_AUTOMOUNT_PREF_FILE}"
# 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
@ -505,6 +514,12 @@ teardown_env() {
# Remove any dups from lock file while installing new one
sort -u -n "$TMP_LOCKFILE" > "$LOCKFILE"
SAVED_PREF=$(<"${FLAGS_chroot}${SAVED_AUTOMOUNT_PREF_FILE}")
if [ "${SAVED_PREF}" != "false" ]; then
gconftool-2 -s --type=boolean ${AUTOMOUNT_PREF} ${SAVED_PREF} || \
warn "could not re-set your automount preference."
fi
if [ -s "$LOCKFILE" ]; then
debug "At least one other pid is running in the chroot, so not"
debug "tearing down env."
@ -531,10 +546,6 @@ teardown_env() {
debug "Unmounting chroot environment."
safe_umount_tree "${MOUNTED_PATH}/"
# Now that we've exited the chroot, allow automounting again.
sudo killall -CONT -r '^gvfs-gdu-volume.*$|^gvfsd-trash$' 2>/dev/null \
|| true
fi
) 200>>"$LOCKFILE" || die "teardown_env failed"
}

View File

@ -161,16 +161,19 @@ fi
ESP_FS_DIR=$(mktemp -d /tmp/esp.XXXXXX)
cleanup() {
local failed=()
if [[ -n "${ESP_FS_DIR}" ]]; then
sudo umount "${ESP_FS_DIR}" && rm -rf "${ESP_FS_DIR}" || failed+=( umount )
set +e
if ! sudo umount "${ESP_FS_DIR}"; then
# There is a race condition possible on some ubuntu setups
# with mounting and unmounting a device very quickly
# Doing a quick sleep/retry as a temporary workaround
warn "Initial unmount failed. Possibly crosbug.com/23443. Retrying"
sleep 5
sudo umount "${ESP_FS_DIR}"
fi
if [[ -n "${ESP_DEV}" && -z "${ESP_DEV//\/dev\/loop*}" ]]; then
sudo losetup -d "${ESP_DEV}" || failed+=( losetup )
fi
if [[ -n "${failed[*]}" ]]; then
die "Cleanup failed in ${failed[*]}"
sudo losetup -d "${ESP_DEV}"
fi
rm -rf "${ESP_FS_DIR}"
}
trap cleanup EXIT
sudo mount "${ESP_DEV}" "${ESP_FS_DIR}"
@ -212,9 +215,9 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then
# we cut over from rootfs booting (extlinux).
if [[ ${FLAGS_install_syslinux} -eq ${FLAGS_TRUE} ]]; then
sudo umount "${ESP_FS_DIR}"
rm -rf "${ESP_FS_DIR}"
ESP_FS_DIR=
sudo syslinux -d /syslinux "${ESP_DEV}"
# mount again for cleanup to free resource gracefully
sudo mount -o ro "${ESP_DEV}" "${ESP_FS_DIR}"
fi
elif [[ "${FLAGS_arch}" = "arm" ]]; then
# Copy u-boot script to ESP partition