[Bug 237397] 'zfs mount -a' mounts filesystems in incorrect order
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Fri Apr 19 22:54:48 UTC 2019
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=237397
Bug ID: 237397
Summary: 'zfs mount -a' mounts filesystems in incorrect order
Product: Base System
Version: 12.0-STABLE
Hardware: amd64
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: kern
Assignee: bugs at FreeBSD.org
Reporter: freebsd-bugzilla at umpquanet.com
I have a system that boots from ZFS. I recently upgraded it from
FreeBSD 11.2-STABLE to 12.0-STABLE.
FreeBSD electron 12.0-STABLE FreeBSD 12.0-STABLE r346293 GENERIC amd64
I upgraded source, and rebooted into the new 12-STABLE kernel with no
problems. After installworld and mergemaster, I discovered that certain
ZFS filesystems were not auto-mounting in the correct sequence,
"correct" meaning that /a mounts before /a/b mounts before /a/b/c.
Here are the mountable filesystems on that machine (canmount != off):
electron : 15:36:37 /root# zfs get -Hrt filesystem canmount | grep -vw off |
while read FS b; do echo $FS; done | xargs zfs list -o
name,canmount,mounted,mountpoint
NAME CANMOUNT MOUNTED MOUNTPOINT
electron on no none
electron/data on no /data
electron/data/backup on no /data/backup
electron/data/backup/jimsdesk on no /data/backup/jimsdesk
electron/system on no none
electron/system/ROOT on no none
electron/system/ROOT/default on yes /
electron/system/home on yes /home
electron/system/tmp on yes /tmp
electron/system/usr on yes /usr
electron/system/usr/local on yes /usr/local
electron/system/var on yes /var
The easiest tree to demonstrate with is electron/data and children, although
this problem is also happening with electron/system/usr and children.
I have not found any way to query the ZFS stack as to what it thinks the
correct mount order should be, and thus demonstrate whether the
automatic mounting order is correct. However, I have fashioned this
test script to highlight the observable differences between a correct,
manual mounting, and the incorrect mount order used by zfs mount -a:
--snip--
#!/usr/bin/env bash
# correct mount ordering:
MANUAL="
zfs mount electron/data
zfs mount electron/data/backup
zfs mount electron/data/backup/jimsdesk
"
# automatic mount ordering:
AUTO="
zfs mount -va
"
case $1
in
manual)
MOUNT="$MANUAL"
;;
auto)
MOUNT="$AUTO"
;;
*)
exit
esac
cat << EOF | sh -v
zfs mount | grep '/data'
mkdir /data
find /data
$MOUNT
zfs mount | grep '/data'
find /data | head -3000000 | wc -l
zfs umount /data/backup/jimsdesk
zfs umount /data/backup
zfs umount /data
rmdir /data
find /data
EOF
--snip--
Here's a run of that script using the manual mounting order. The
mountpoint /data is created fresh at the start. When the filesystems
are correctly mounted, there are over 3 million files under /data.
After unmounting, /data is empty, and can be rmdir'ed.
--snip--
electron : 12:26:00 /root# ./zfs-mount-test.sh manual
zfs mount | grep '/data'
mkdir /data
find /data
/data
zfs mount electron/data
zfs mount electron/data/backup
zfs mount electron/data/backup/jimsdesk
zfs mount | grep '/data'
electron/data /data
electron/data/backup /data/backup
electron/data/backup/jimsdesk /data/backup/jimsdesk
find /data | head -3000000 | wc -l
3000000
zfs umount /data/backup/jimsdesk
zfs umount /data/backup
zfs umount /data
rmdir /data
find /data
find: /data: No such file or directory
--snip--
Here's a run of that script using the automatic mounting order. When
the filesystems are automatically mounted, fewer than 1.5 million files
are present under /data. Unmounting everything generates an error
message, /data is not clean, and rmdir returns an error.
--snip--
electron : 12:26:17 /root# ./zfs-mount-test.sh auto
zfs mount | grep '/data'
mkdir /data
find /data
/data
zfs mount -va
zfs mount | grep '/data'
electron/data /data
electron/data/backup /data/backup
electron/data/backup/jimsdesk /data/backup/jimsdesk
find /data | head -3000000 | wc -l
1481445
zfs umount /data/backup/jimsdesk
zfs umount /data/backup
cannot unmount '/data/backup': not a mountpoint
zfs umount /data
rmdir /data
rmdir: /data: Directory not empty
find /data
/data
/data/backup
--snip--
Please let me know how I can provide additional information or testing.
Thank you!
Jim
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list