summaryrefslogtreecommitdiffstats
path: root/contrib/initramfs
diff options
context:
space:
mode:
authorRichard Laager <[email protected]>2017-11-23 23:08:02 -0600
committerBrian Behlendorf <[email protected]>2017-11-28 09:38:13 -0800
commit48ac22d8559313b2a33a80b9690aeea9acb9976c (patch)
tree31cf78a7eb99897f6882f6d5ac2edf50c9329cab /contrib/initramfs
parentbd2958dea02f1126c4e907ab55c385ef24431f15 (diff)
initramfs: Honor canmount=off
The initramfs script was not honoring canmount=off. With this change, it does. If the administrator has asked that a filesystem not be mounted, that should be honored. As an exception, the initramfs script ignores canmount=off on the rootfs. The rootfs should not have canmount=off set either. However, mounting it anyway seems harmless because it is being asked for explicitly. The point of this exception is to avoid the risk of breaking existing systems, just in case someone has canmount=off set on their rootfs. The initramfs still mounts filesystems with canmount=noauto. This is necessary because it is typical to set that on the rootfs so that it can be cloned. Without canmount=noauto, the clones' duplicate mountpoints would conflict. This is the remainder of the fix for: https://github.com/zfsonlinux/pkg-zfs/issues/221 Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Richard Laager <[email protected]> Closes #6897
Diffstat (limited to 'contrib/initramfs')
-rw-r--r--contrib/initramfs/scripts/zfs.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/initramfs/scripts/zfs.in b/contrib/initramfs/scripts/zfs.in
index 52098cc14..d51ae1ea0 100644
--- a/contrib/initramfs/scripts/zfs.in
+++ b/contrib/initramfs/scripts/zfs.in
@@ -317,6 +317,14 @@ mount_fs()
"${ZFS}" list -oname -tfilesystem -H "${fs}" > /dev/null 2>&1
[ "$?" -ne 0 ] && return 1
+ # Skip filesystems with canmount=off. The root fs should not have
+ # canmount=off, but ignore it for backwards compatibility just in case.
+ if [ "$fs" != "${ZFS_BOOTFS}" ]
+ then
+ canmount=$(get_fs_value "$fs" canmount)
+ [ "$canmount" = "off" ] && return 0
+ fi
+
# Need the _original_ datasets mountpoint!
mountpoint=$(get_fs_value "$fs" mountpoint)
if [ "$mountpoint" = "legacy" -o "$mountpoint" = "none" ]; then