comparison sbin/ftjail @ 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 82a98db83a13
children e8fc5856a9af
comparison
equal deleted inserted replaced
662:bc418b122fc9 663:83ec66c64f47
1052 [ "${_opt_old_origin}" != "${_root_origin}" ] && farray_append _errors "origin mismatch" 1052 [ "${_opt_old_origin}" != "${_root_origin}" ] && farray_append _errors "origin mismatch"
1053 else 1053 else
1054 [ "${_root_origin}" = '-' ] && farray_append _errors "the root dataset is not a ZFS clone" 1054 [ "${_root_origin}" = '-' ] && farray_append _errors "the root dataset is not a ZFS clone"
1055 fi 1055 fi
1056 # 1056 #
1057 # Check for open files on all the mounted filesystems. 1057 # 1. Check for open files on all the mounted filesystems.
1058 # If snapshots are requested check that they are related somehow to 1058 # 2. Check for mounted filesystems that cannot re-mounted successfuly
1059 # mounted filesystems. 1059 # because the fstab does not contain all the needed informations
1060 # (e.g. unionfs).
1061 # 3. If snapshots are requested check that they are related somehow to
1062 # mounted filesystems.
1060 # 1063 #
1061 _sn_ds_related='' 1064 _sn_ds_related=''
1062 while IFS=$'\t' read -r _mnt_device _mnt_mountpoint _mnt_type _mnt_options _line; do 1065 while IFS=$'\t' read -r _mnt_device _mnt_mountpoint _mnt_type _mnt_options _line; do
1063 if ! _check_no_open_files_on_filesystem "${_mnt_mountpoint}" ; then 1066 if ! _check_no_open_files_on_filesystem "${_mnt_mountpoint}" ; then
1064 farray_append _errors "There are open files or memory mapping on file system \`${_mnt_mountpoint}'" 1067 farray_append _errors "There are open files or memory mapping on file system \`${_mnt_mountpoint}'"
1065 fi 1068 fi
1069 case "${_mnt_type}" in
1070 unionfs)
1071 farray_append _errors "A \`${_mnt_type}' filesystem is mounted at \`${_mnt_mountpoint}' which cannot re-mounted properly"
1072 ;;
1073 *)
1074 true
1075 ;;
1076 esac
1066 _idx=1 1077 _idx=1
1067 while falist_tryget_key_at_index _sn_ds _opt_snapshots ${_idx}; do 1078 while falist_tryget_key_at_index _sn_ds _opt_snapshots ${_idx}; do
1068 case "${_mnt_device}" in 1079 case "${_mnt_device}" in
1069 "${_sn_ds}") 1080 "${_sn_ds}")
1070 _sn_ds_related="yes" 1081 _sn_ds_related="yes"
1254 [ "${_opt_old_origin}" != "${_root_origin}" ] && { echo "ERROR: origin mismatch" 1>&2; return 1; } 1265 [ "${_opt_old_origin}" != "${_root_origin}" ] && { echo "ERROR: origin mismatch" 1>&2; return 1; }
1255 else 1266 else
1256 [ "${_root_origin}" = '-' ] && { echo "ERROR: the root dataset is not a ZFS clone" 1>&2; return 1; } 1267 [ "${_root_origin}" = '-' ] && { echo "ERROR: the root dataset is not a ZFS clone" 1>&2; return 1; }
1257 fi 1268 fi
1258 # 1269 #
1259 # Check for open files on all the mounted filesystems 1270 # 1. Check for open files on all the mounted filesystems.
1271 # 2. Check for mounted filesystems that cannot re-mounted successfuly
1272 # because the fstab does not contain all the needed informations
1273 # (e.g. unionfs).
1260 # 1274 #
1261 while IFS=$'\t' read -r _mnt_device _mnt_mountpoint _mnt_type _mnt_options _line; do 1275 while IFS=$'\t' read -r _mnt_device _mnt_mountpoint _mnt_type _mnt_options _line; do
1262 if ! _check_no_open_files_on_filesystem "${_mnt_mountpoint}" ; then 1276 if ! _check_no_open_files_on_filesystem "${_mnt_mountpoint}" ; then
1263 err "There are open files or memory mapping on file system \`${_mnt_mountpoint}'" 1277 err "There are open files or memory mapping on file system \`${_mnt_mountpoint}'"
1264 return 1 1278 return 1
1265 fi 1279 fi
1280 case "${_mnt_type}" in
1281 unionfs)
1282 err "A \`${_mnt_type}' filesystem is mounted at \`${_mnt_mountpoint}' which cannot re-mounted properly"
1283 return 1
1284 ;;
1285 *)
1286 true
1287 ;;
1288 esac
1266 done <<EOF4tHGCAASLfafbf1b5 1289 done <<EOF4tHGCAASLfafbf1b5
1267 ${_dir_mounts} 1290 ${_dir_mounts}
1268 EOF4tHGCAASLfafbf1b5 1291 EOF4tHGCAASLfafbf1b5
1269 1292
1270 # Determine we need to clone with a custom (non inherited) "mountpoint" 1293 # Determine we need to clone with a custom (non inherited) "mountpoint"