Merge lp:~serge-hallyn/ubuntu/maverick/casper/no-panic-on-mount-fail into lp:ubuntu/natty/casper

Proposed by Colin Watson
Status: Merged
Merged at revision: 843
Proposed branch: lp:~serge-hallyn/ubuntu/maverick/casper/no-panic-on-mount-fail
Merge into: lp:ubuntu/natty/casper
Diff against target: 102 lines (+34/-6) (has conflicts)
3 files modified
bin/casper-snapshot (+1/-1)
debian/changelog (+11/-0)
scripts/casper-helpers (+22/-5)
Text conflict in debian/changelog
Text conflict in scripts/casper-helpers
To merge this branch: bzr merge lp:~serge-hallyn/ubuntu/maverick/casper/no-panic-on-mount-fail
Reviewer Review Type Date Requested Status
Ubuntu Sponsors Pending
Review via email: mp+42099@code.launchpad.net

This proposal supersedes a proposal from 2010-09-03.

Description of the change

If trying to mount a block device while aimlessly snooping around,
don't panic if it fails. The reason that is problematic is that
multipath may hold /dev/sd?? busy. Casper can proceed just fine
without snooping on the busy disks, but panics on mount failure
(with -EBUSY) anyway.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote : Posted in a previous version of this proposal

Resubmitting against natty.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/casper-snapshot'
--- bin/casper-snapshot 2009-06-12 11:46:49 +0000
+++ bin/casper-snapshot 2010-11-29 12:38:25 +0000
@@ -215,7 +215,7 @@
215 fi215 fi
216 else216 else
217 if [ -b "${dev}" ] ; then217 if [ -b "${dev}" ] ; then
218 try_mount "${dev}" "${MOUNTP}" rw218 try_mount "${dev}" "${MOUNTP}" rw || panic "failed to mount ${dev}"
219 fi219 fi
220 fi220 fi
221}221}
222222
=== modified file 'debian/changelog'
--- debian/changelog 2010-11-29 12:36:32 +0000
+++ debian/changelog 2010-11-29 12:38:25 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
1casper (1.249) UNRELEASED; urgency=low2casper (1.249) UNRELEASED; urgency=low
23
3 * Add universal access preferences taskbar icon in all accessibility4 * Add universal access preferences taskbar icon in all accessibility
@@ -67,6 +68,16 @@
6768
68 -- Jonathan Riddell <jriddell@ubuntu.com> Mon, 06 Sep 2010 14:20:54 +010069 -- Jonathan Riddell <jriddell@ubuntu.com> Mon, 06 Sep 2010 14:20:54 +0100
6970
71=======
72casper (1.241ubuntu1) maverick; urgency=low
73
74 * change scripts/casper-helpers:try_mount() to not panic when regular
75 mounts fail. Instead, return an error code so the caller can decide.
76 (LP: #624632)
77
78 -- Serge Hallyn <serge.hallyn@canonical.com> Fri, 03 Sep 2010 15:00:44 -0500
79
80>>>>>>> MERGE-SOURCE
70casper (1.241) maverick; urgency=low81casper (1.241) maverick; urgency=low
7182
72 [ Mathieu Trudel-Lapierre ]83 [ Mathieu Trudel-Lapierre ]
7384
=== modified file 'scripts/casper-helpers'
--- scripts/casper-helpers 2010-09-06 15:52:21 +0000
+++ scripts/casper-helpers 2010-11-29 12:38:25 +0000
@@ -164,6 +164,9 @@
164 fi164 fi
165}165}
166166
167# Returns 0 on success
168# panics if remount- or bind-mount fails
169# returns 1 on failure otherwise
167try_mount ()170try_mount ()
168{171{
169 dev="${1}"172 dev="${1}"
@@ -171,12 +174,20 @@
171 opts="${3}"174 opts="${3}"
172175
173 if where_is_mounted ${dev} > /dev/null; then176 if where_is_mounted ${dev} > /dev/null; then
174 if [ "${opts}" != "ro" ]; then177 if [ "${opts}" != "ro" ]; then
175 mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed"178 mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed"
176 fi179 return 0
180 fi
177 mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount"181 mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount"
182 return 0
178 else183 else
179 mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}"184 mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}"
185 ret=$?
186 if [ $ret -ne 0 ]; then
187 log_warning_msg "Cannot mount ${dev} on ${mountp}"
188 return 1
189 fi
190 return 0
180 fi191 fi
181}192}
182193
@@ -202,9 +213,15 @@
202 # where filesystems are in use by hibernated operating systems.213 # where filesystems are in use by hibernated operating systems.
203 elif [ "$(get_fstype ${devname})" = "vfat" ]; then214 elif [ "$(get_fstype ${devname})" = "vfat" ]; then
204 mkdir -p "${cow_backing}"215 mkdir -p "${cow_backing}"
216<<<<<<< TREE
205 try_mount "${devname}" "${cow_backing}" "rw"217 try_mount "${devname}" "${cow_backing}" "rw"
206 if [ -e "${pers_fpath}" ]; then218 if [ -e "${pers_fpath}" ]; then
207 echo $(setup_loop "${pers_fpath}" "loop" "/sys/block/loop*")219 echo $(setup_loop "${pers_fpath}" "loop" "/sys/block/loop*")
220=======
221 try_mount "${devname}" "${cow_backing}" "rw" || continue
222 if [ -e "${cow_backing}/${pers_label}" ]; then
223 echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*")
224>>>>>>> MERGE-SOURCE
208 return 0225 return 0
209 else226 else
210 umount ${cow_backing}227 umount ${cow_backing}
@@ -226,7 +243,7 @@
226 devfstype="$(get_fstype ${devname})"243 devfstype="$(get_fstype ${devname})"
227 if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] ; then # FIXME: all supported block devices should be scanned244 if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] ; then # FIXME: all supported block devices should be scanned
228 mkdir -p "${snap_backing}"245 mkdir -p "${snap_backing}"
229 try_mount "${devname}" "${snap_backing}" "ro"246 try_mount "${devname}" "${snap_backing}" "ro" || continue
230 for filename in ${filenames}; do247 for filename in ${filenames}; do
231 if [ -e "${snap_backing}/${filename}" ]; then248 if [ -e "${snap_backing}/${filename}" ]; then
232 echo "${devname} ${snap_backing} ${filename}"249 echo "${devname} ${snap_backing} ${filename}"

Subscribers

People subscribed via source and target branches

to all changes: