etc/dists/scripts/set_ugid_quota.sh: try to fix /etc/mtab harder

In case vzctl-3.0.28 or 3.0.28.1 (i.e. the one with commit e324b0ade8
but without commit bfe59a28b) was used on a container with quotaugidlimit,
the CT might end up with an incorrect /etc/mtab file having simfs in fs field.

The fix introduced later is correct, but it's not checking for the broken
case like the one above. This case is fixed by this patch, which just blindly
symlinks /etc/mtab -> /proc/mounts, in a hope that kernel will provide correct
flags and fs field (and all modern stable OpenVZ kernels do).

Now, in case it's an old kernel (no usrquota/grpquota flags for /), we create
/etc/mtab as a file, putting the correct info there.

Should fix
http://bugzilla.openvz.org/2004

For big picture, see
http://bugzilla.openvz.org/1904

PS Note there's no need to have this kludge in other scripts
(i.e. {gentoo,arch,slackware}-set_ugid_quota.sh) because those were never
modified to have simfs in fs field.

Reported-by: Maxim Shchelokov <maks3004@inbox.ru>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed