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
1=== modified file 'bin/casper-snapshot'
2--- bin/casper-snapshot 2009-06-12 11:46:49 +0000
3+++ bin/casper-snapshot 2010-11-29 12:38:25 +0000
4@@ -215,7 +215,7 @@
5 fi
6 else
7 if [ -b "${dev}" ] ; then
8- try_mount "${dev}" "${MOUNTP}" rw
9+ try_mount "${dev}" "${MOUNTP}" rw || panic "failed to mount ${dev}"
10 fi
11 fi
12 }
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2010-11-29 12:36:32 +0000
16+++ debian/changelog 2010-11-29 12:38:25 +0000
17@@ -1,3 +1,4 @@
18+<<<<<<< TREE
19 casper (1.249) UNRELEASED; urgency=low
20
21 * Add universal access preferences taskbar icon in all accessibility
22@@ -67,6 +68,16 @@
23
24 -- Jonathan Riddell <jriddell@ubuntu.com> Mon, 06 Sep 2010 14:20:54 +0100
25
26+=======
27+casper (1.241ubuntu1) maverick; urgency=low
28+
29+ * change scripts/casper-helpers:try_mount() to not panic when regular
30+ mounts fail. Instead, return an error code so the caller can decide.
31+ (LP: #624632)
32+
33+ -- Serge Hallyn <serge.hallyn@canonical.com> Fri, 03 Sep 2010 15:00:44 -0500
34+
35+>>>>>>> MERGE-SOURCE
36 casper (1.241) maverick; urgency=low
37
38 [ Mathieu Trudel-Lapierre ]
39
40=== modified file 'scripts/casper-helpers'
41--- scripts/casper-helpers 2010-09-06 15:52:21 +0000
42+++ scripts/casper-helpers 2010-11-29 12:38:25 +0000
43@@ -164,6 +164,9 @@
44 fi
45 }
46
47+# Returns 0 on success
48+# panics if remount- or bind-mount fails
49+# returns 1 on failure otherwise
50 try_mount ()
51 {
52 dev="${1}"
53@@ -171,12 +174,20 @@
54 opts="${3}"
55
56 if where_is_mounted ${dev} > /dev/null; then
57- if [ "${opts}" != "ro" ]; then
58- mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed"
59- fi
60+ if [ "${opts}" != "ro" ]; then
61+ mount -o remount,"${opts}" ${dev} $(where_is_mounted ${dev}) || panic "Remounting failed"
62+ return 0
63+ fi
64 mount -o bind $(where_is_mounted ${dev}) ${mountp} || panic "Cannot bind-mount"
65+ return 0
66 else
67- mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}"
68+ mount -t $(get_fstype "${dev}") -o "${opts}" "${dev}" "${mountp}"
69+ ret=$?
70+ if [ $ret -ne 0 ]; then
71+ log_warning_msg "Cannot mount ${dev} on ${mountp}"
72+ return 1
73+ fi
74+ return 0
75 fi
76 }
77
78@@ -202,9 +213,15 @@
79 # where filesystems are in use by hibernated operating systems.
80 elif [ "$(get_fstype ${devname})" = "vfat" ]; then
81 mkdir -p "${cow_backing}"
82+<<<<<<< TREE
83 try_mount "${devname}" "${cow_backing}" "rw"
84 if [ -e "${pers_fpath}" ]; then
85 echo $(setup_loop "${pers_fpath}" "loop" "/sys/block/loop*")
86+=======
87+ try_mount "${devname}" "${cow_backing}" "rw" || continue
88+ if [ -e "${cow_backing}/${pers_label}" ]; then
89+ echo $(setup_loop "${cow_backing}/${pers_label}" "loop" "/sys/block/loop*")
90+>>>>>>> MERGE-SOURCE
91 return 0
92 else
93 umount ${cow_backing}
94@@ -226,7 +243,7 @@
95 devfstype="$(get_fstype ${devname})"
96 if [ "${devfstype}" = "vfat" ] || [ "${devfstype}" = "ext2" ] ; then # FIXME: all supported block devices should be scanned
97 mkdir -p "${snap_backing}"
98- try_mount "${devname}" "${snap_backing}" "ro"
99+ try_mount "${devname}" "${snap_backing}" "ro" || continue
100 for filename in ${filenames}; do
101 if [ -e "${snap_backing}/${filename}" ]; then
102 echo "${devname} ${snap_backing} ${filename}"

Subscribers

People subscribed via source and target branches

to all changes: