Changeset c031385


Ignore:
Timestamp:
01/30/14 06:50:11 (11 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
c088725, e868526
Parents:
8f9a239
Message:

Fix two bugs:

  • Set proper perms on /dev/* entries inside PBI container
  • Add some locking when doing nullfs mounts, since doing two at once seems to deadlock the system
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pbi-manager/pbime/pbimount

    rf8d250a rc031385  
    22 
    33NULLFS="/usr/pbi/.mount_nullfs" 
    4  
     4MNTLOCK="/usr/pbi/.mntLock" 
    55MNTSLEEP="sleep 0.2" 
    66 
    77is_mounted() { 
    88   if [ ! -d "${1}" ] ; then return 1; fi 
    9    # Slow down the pace of nullfs mounts, this seems to fix the odd panic / hang 
    109   mount | grep -q "on ${1} ("  
    1110   return $? 
     
    5857} 
    5958 
     59do_mount_lock() { 
     60 
     61   # At this point we have waited 15 seconds, if another mount still hasn't finished 
     62   # by now then there are other serious problems 
     63   if [ $1 -gt 10 ] ; then 
     64      exit 1 
     65   fi 
     66 
     67   # Check if we have another mount going now 
     68   if [ -e "${MNTLOCK}" ] ; then 
     69      pgrep -qF ${MNTLOCK} 2>/dev/null 
     70      if [ $? -ne 0 ] ; then 
     71         # Expired run it seems 
     72         rm -f ${MNTLOCK} 2>/dev/null 
     73      else 
     74         # Another mount is running, wait a bit for it to finish 
     75         sleep 1.5 
     76         do_mount_lock "`expr $1 + 1`" 
     77         return 
     78      fi 
     79   fi 
     80 
     81   echo "$$" > ${MNTLOCK} 
     82} 
     83 
     84undo_mount_lock() { 
     85  rm -f ${MNTLOCK} >/dev/null 2>/dev/null 
     86} 
     87 
    6088mount_dirs() { 
     89 
     90   do_mount_lock "1" 
    6191 
    6292   # Check some of the common items to mount into the PBI container 
     
    94124   fi 
    95125 
     126   undo_mount_lock 
     127 
    96128   sync 
    97129 
     
    106138   cp /usr/pbi/.ldconfig "${pDir}/virtbase/var/run/ldconfig" 
    107139   chroot "${pDir}/virtbase" /var/run/ldconfig start >/dev/null 2>/dev/null 
     140 
     141   # Start devfs to ensure /dev/* get proper permissions 
     142   chroot "${pDir}/virtbase" /etc/rc.d/devfs start >/dev/null 2>/dev/null 
    108143 
    109144   sync 
Note: See TracChangeset for help on using the changeset viewer.