Comment 17 for bug 688541

James Hunt (jamesodhunt) wrote :

After discussion with Scott, the best short-term solution would seem to be:

1) Modify /etc/init.d/umountfs to call the following in do_stop before calling umount/swapoff:

     "initctl emit unmount-filesystem"

2) Modify /etc/init.d/umountroot to call the following in do_stop before calling umount:

     "initctl emit unmount-root-filesystem"

3) Modify all upstart configs for services which are "slow" to stop such that they "stop on unmount-filesystem",
    rather than "stop on runlevel [016]".

4) Test!

The overall effect of this being that when /etc/init.d/umountfs emits the unmount-filesystem event, it will block until any Upstart jobs which "stop on" those events have completed. Thus, /etc/init.d/umountfs will wait for the mysql Upstart job to finish before unmounting its filesystems.