~ubuntu-branches/ubuntu/utopic/cloud-initramfs-tools/utopic-proposed

« back to all changes in this revision

Viewing changes to overlayroot/scripts/init-bottom/overlayroot

  • Committer: Package Import Robot
  • Author(s): dann frazier
  • Date: 2015-05-19 11:26:46 UTC
  • Revision ID: package-import@ubuntu.com-20150519112646-hizr760vr5qx6uy1
Tags: 0.25ubuntu1.14.10.1
overlayroot: use required 'workdir' option on overlayfs mount for
kernels >= 3.18 (LP: #1411294)

Show diffs side-by-side

added added

removed removed

Lines of Context:
557
557
overlayroot_driver=${overlayroot_driver:-overlayfs}
558
558
 
559
559
# settings based on overlayroot_driver
 
560
workdir=""
560
561
case "${overlayroot_driver}" in
561
562
        overlayfs)
562
563
                mount_type="overlayfs"
563
564
                mount_opts="-o lowerdir=${root_ro},upperdir=${root_rw}/${dir_prefix}"
 
565
                # 3.18+ require 'workdir=' option.
 
566
                case "$(uname -r)" in
 
567
                        2*|3.1[01234567]*|3.[0-9].*) :;;
 
568
                        *)
 
569
                                workdir="${dir_prefix%/}-workdir"
 
570
                                mount_opts="${mount_opts},workdir=${root_rw}/${workdir}";;
 
571
                esac
564
572
                mount_opts="${mount_opts} overlayroot ${ROOTMNT}"
565
573
                ;;
566
574
        aufs)
599
607
mkdir -p "${root_rw}/${dir_prefix}" ||
600
608
        fail "failed to create ${dir_prefix} on ${device}"
601
609
 
 
610
[ -z "$workdir" ] || mkdir -p "$root_rw/${workdir}" ||
 
611
        fail "failed to create workdir '$workdir' on ${device}"
 
612
 
602
613
# root is mounted on ${ROOTMNT}, move it to ${ROOT_RO}.
603
614
mount --move "${ROOTMNT}" "${root_ro}" ||
604
615
        fail "failed to move root away from ${ROOTMNT} to ${root_ro}"
609
620
# errors and leave the system in a wired state. 
610
621
 
611
622
# mount virtual fs ${ROOTMNT} with rw-fs ${root_rw} on top or ro-fs ${root_ro}.
 
623
debug mount -t "$mount_type" $mount_opts
612
624
mount -t "$mount_type" $mount_opts
613
625
if [ $? -ne 0 ]; then
614
626
        log_fail "failed to create new ro/rw layered ${ROOTMNT}"
 
627
        log_fail "mount command was: mount -t $mount_type $mount_opts"
615
628
        # do recovery and try resoring the mount for ${ROOTMNT}
616
629
        mount --move ${root_ro} ${ROOTMNT}
617
630
        if [ $? -ne 0 ]; then