Project

General

Profile

Bug #6464

libbe shouldn't mangle zfs mountpoints

Added by Alexander Pyhalov almost 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2015-11-19
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Currently, fs-minimal has the following code:

for fs in /var /var/adm /tmp; do
        readvfstab $fs < $vfstab
        if [ -n "$mountp" ]; then
                mounted $mountp $mntopts $fstype < /etc/mnttab && continue
                checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
                mountfs -O $mountp $fstype $mntopts - ||
                    exit $SMF_EXIT_ERR_FATAL
                continue
        fi
        if [ "$rootiszfs" = 1 ]; then
                mountpt=`zfs get -H -o value mountpoint $be$fs 2>/dev/null`
                if [ $? = 0 ] ; then
                        if [ "x$mountpt" = "x$fs" ] ; then
                                /sbin/zfs mount -O $be$fs
                        fi
                fi
        fi
done

If /var is a separate FS, which is a part of BE and you previously mounted BE to some temporary location, on the next boot to this BE /var will not be mounted,
as its mountpoint will be set to something like '/mnt/var' and not '/var'.
The possible fix could look like this:
for fs in /var /var/adm /tmp; do
        readvfstab $fs < $vfstab
        if [ -n "$mountp" ]; then
                mounted $mountp $mntopts $fstype < /etc/mnttab && continue
                checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
                mountfs -O $mountp $fstype $mntopts - ||
                    exit $SMF_EXIT_ERR_FATAL
                continue
        fi
        if [ "$rootiszfs" = 1 ]; then
                mountpt=`zfs get -H -o value mountpoint $be$fs 2>/dev/null`
                if [ $? = 0 ] ; then
                        if [ "x$mountpt" != "x$fs" ] ; then
                              /sbin/zfs set mountpoint=$fs $be$fs
                        fi
                        /sbin/zfs mount -O $be$fs                       
                fi
        fi
done


Related issues

Related to illumos gate - Bug #7767: 6464's call to mount() is incompleteClosed2017-01-13

Actions

History

#1

Updated by Alexander Pyhalov over 3 years ago

The following workaround to boot scripts was suggested: http://buildzone.oi-build.r61.net/6464/, however, it was noted, that real issue is not in boot scripts, but in libbe, which shouldn't change zfs mountpoint property while mounting BE.

#2

Updated by Alexander Pyhalov almost 3 years ago

  • Subject changed from /lib/svc/method/fs-minimal should correct fs mountpoints to libbe shouldn't mangle zfs mountpoints

After discussion on mailing list it was evident that root cause of the issue is default libbe behavior. Currently when it mounts boot environment, it sets zfs mountpoints of BE's filesystems to temporary location. In fact, it shouldn't touch zfs mountpoint properties of corresponding datasets and just use plain mount(2) to mount them.

#3

Updated by Electric Monk almost 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 3a8761925c0ebb25868080d8dd07b12a2cc0d0ea

commit  3a8761925c0ebb25868080d8dd07b12a2cc0d0ea
Author: Alexander Pyhalov <apyhalov@gmail.com>
Date:   2016-12-22T18:01:17.000Z

    6464 libbe shouldn't mangle zfs mountpoints
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

#4

Updated by Dan McDonald almost 3 years ago

  • Related to Bug #7767: 6464's call to mount() is incomplete added

Also available in: Atom PDF