Delete unnecessary -d options from umount

The -d option to umount is unnecessary in cases where the original
mount was created with '-o loop' (it says so in the man page).
Moreover, there's a demonstrable bug when using 'umount -d' in this
case:  umount complains that it's unable to delete the loop device
in this case.  This change silences those messages.

The demonstrated bug in umount is a plausible explanation for build
failures characterized by unexpected failures of 'mount -o loop';
see the BUG, below.

BUG=chromium-os:24975
TEST=run the changed commands, see no loopback devices leaked

Change-Id: I1df9f60b40eabd279164b79ee66994ff9f644ee9
Reviewed-on: https://gerrit.chromium.org/gerrit/15998
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
This commit is contained in:
J. Richard Barnette 2012-02-15 17:34:04 -08:00 committed by Gerrit
parent 7293bd8524
commit 8a7aa3e502
3 changed files with 8 additions and 8 deletions

View File

@ -150,8 +150,8 @@ dd if="${SRC_IMAGE}" of="${TEMP_PMBR}" bs=512 count=1
TEMP_MNT=$(mktemp -d)
TEMP_ESP_MNT=$(mktemp -d)
cleanup() {
sudo umount -d "${TEMP_MNT}"
sudo umount -d "${TEMP_ESP_MNT}"
sudo umount "${TEMP_MNT}"
sudo umount "${TEMP_ESP_MNT}"
rmdir "${TEMP_MNT}" "${TEMP_ESP_MNT}"
}
trap cleanup INT TERM EXIT

View File

@ -77,7 +77,7 @@ get_install_vblock() {
sudo cp "$stateful_mnt/vmlinuz_hd.vblock" "$out"
sudo chown $USER "$out"
sudo umount -d "$stateful_mnt"
sudo umount "$stateful_mnt"
rmdir "$stateful_mnt"
set -e
echo "$out"
@ -243,7 +243,7 @@ install_recovery_kernel() {
local esp_mnt=$(mktemp -d)
sudo mount -o loop,offset=$((esp_offset * 512)) "$RECOVERY_IMAGE" "$esp_mnt"
sudo cp "$vmlinuz" "$esp_mnt/syslinux/vmlinuz.A" || failed=1
sudo umount -d "$esp_mnt"
sudo umount "$esp_mnt"
rmdir "$esp_mnt"
set -e
fi
@ -323,7 +323,7 @@ maybe_resize_stateful() {
sudo mount -o loop $small_stateful $new_stateful_mnt
sudo cp "$INSTALL_VBLOCK" "$new_stateful_mnt/vmlinuz_hd.vblock"
sudo mkdir "$new_stateful_mnt/var"
sudo umount -d "$new_stateful_mnt"
sudo umount "$new_stateful_mnt"
rmdir "$new_stateful_mnt"
set -e

View File

@ -86,10 +86,10 @@ function unmount_image() {
sudo umount "${FLAGS_rootfs_mountpt}/usr/local"
sudo umount "${FLAGS_rootfs_mountpt}/var"
if [[ -n "${FLAGS_esp_mountpt}" ]]; then
sudo umount -d "${FLAGS_esp_mountpt}"
sudo umount "${FLAGS_esp_mountpt}"
fi
sudo umount -d "${FLAGS_stateful_mountpt}"
sudo umount -d "${FLAGS_rootfs_mountpt}"
sudo umount "${FLAGS_stateful_mountpt}"
sudo umount "${FLAGS_rootfs_mountpt}"
set -e
}