changeset 663:83ec66c64f47

ftjail: Also check in {check-}freebsd-update that no "unionfs" type filesystems are mounted. "unionfs"-type filesystems can not automatically re-mounted properly because there is not enough information for a proper mount in the requested fstab.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 29 Sep 2024 17:22:52 +0200
parents bc418b122fc9
children 83e6237350e4
files sbin/ftjail
diffstat 1 files changed, 27 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/ftjail	Sun Sep 29 16:27:22 2024 +0200
+++ b/sbin/ftjail	Sun Sep 29 17:22:52 2024 +0200
@@ -1054,15 +1054,26 @@
             [ "${_root_origin}" = '-' ] &&  farray_append _errors "the root dataset is not a ZFS clone"
         fi
         #
-        # Check for open files on all the mounted filesystems.
-        # If snapshots are requested check that they are related somehow to
-        # mounted filesystems.
+        # 1. Check for open files on all the mounted filesystems.
+        # 2. Check for mounted filesystems that cannot re-mounted successfuly
+        #    because the fstab does not contain all the needed informations
+        #    (e.g. unionfs).
+        # 3. If snapshots are requested check that they are related somehow to
+        #    mounted filesystems.
         #
         _sn_ds_related=''
         while IFS=$'\t' read -r _mnt_device _mnt_mountpoint _mnt_type _mnt_options _line; do
             if ! _check_no_open_files_on_filesystem "${_mnt_mountpoint}" ; then
                 farray_append _errors "There are open files or memory mapping on file system \`${_mnt_mountpoint}'"
             fi
+            case "${_mnt_type}" in
+                unionfs)
+                    farray_append _errors "A \`${_mnt_type}' filesystem is mounted at \`${_mnt_mountpoint}' which cannot re-mounted properly"
+                    ;;
+                *)
+                    true
+                    ;;
+            esac
             _idx=1
             while falist_tryget_key_at_index _sn_ds _opt_snapshots ${_idx}; do
                 case "${_mnt_device}" in
@@ -1256,13 +1267,25 @@
         [ "${_root_origin}" = '-' ] &&  { echo "ERROR: the root dataset is not a ZFS clone" 1>&2; return 1; }
     fi
     #
-    # Check for open files on all the mounted filesystems
+    # 1. Check for open files on all the mounted filesystems.
+    # 2. Check for mounted filesystems that cannot re-mounted successfuly
+    #    because the fstab does not contain all the needed informations
+    #    (e.g. unionfs).
     #
     while IFS=$'\t' read -r _mnt_device _mnt_mountpoint _mnt_type _mnt_options _line; do
         if ! _check_no_open_files_on_filesystem "${_mnt_mountpoint}" ; then
             err "There are open files or memory mapping on file system \`${_mnt_mountpoint}'"
             return 1
         fi
+        case "${_mnt_type}" in
+            unionfs)
+                err "A \`${_mnt_type}' filesystem is mounted at \`${_mnt_mountpoint}' which cannot re-mounted properly"
+                return 1
+                ;;
+            *)
+                true
+                ;;
+        esac
     done <<EOF4tHGCAASLfafbf1b5
 ${_dir_mounts}
 EOF4tHGCAASLfafbf1b5