From 15b8bae3002285cdce4f24ce947a89b19eda53b6 Mon Sep 17 00:00:00 2001 From: Peter Volkov Date: Sat, 11 May 2013 20:31:01 +0400 Subject: [PATCH] Start garbage collector for nilfs2 as root fs Use mount -f / to add entry to mtab. As a side effect this starts nilfs2 garbage collector as expected and documented in man mount.nilfs2. https://bugs.gentoo.org/show_bug.cgi?id=339472 --- init.d/mtab.in | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/init.d/mtab.in b/init.d/mtab.in index beee3e1..ca9aad9 100644 --- a/init.d/mtab.in +++ b/init.d/mtab.in @@ -15,20 +15,27 @@ start() if [ -L /etc/mtab ] then einfo "Skipping mtab update (mtab is a symbolic link)" + mount -f / > /dev/null 2>&1 return 0 fi ebegin "Updating /etc/mtab" if ! echo 2>/dev/null >/etc/mtab; then ewend 1 "/etc/mtab is not updateable" + mount -f / > /dev/null 2>&1 return 0 fi - # With / as tmpfs we cannot umount -at tmpfs in localmount as that - # makes / readonly and dismounts all tmpfs even if in use which is - # not good. Luckily, umount uses /etc/mtab instead of /proc/mounts - # which allows this hack to work. - grep -v "^[! ]* / tmpfs " /proc/mounts > /etc/mtab + # Add the entry for / to mtab + if $(grep -qv "^[! ]* / tmpfs " /proc/mounts); then + mount -f / > /dev/null 2>&1 + else + # With / as tmpfs we cannot umount -at tmpfs in localmount as + # that makes / readonly and dismounts all tmpfs even if in use + # which is not good. Luckily, umount uses /etc/mtab instead of + # /proc/mounts which allows this hack to work. + grep -v "^[! ]* / tmpfs " /proc/mounts > /etc/mtab + fi # Remove stale backups rm -f /etc/mtab~ /etc/mtab~~ -- 1.8.1.5