git: b6e19aabce32 - stable/14 - autofs: media: Always use sync option for fat*

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 04 Jun 2024 11:37:31 UTC
The branch stable/14 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=b6e19aabce32d8699786dc377d71a2af89c40db9

commit b6e19aabce32d8699786dc377d71a2af89c40db9
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-12-01 09:27:59 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-06-04 11:37:07 +0000

    autofs: media: Always use sync option for fat*
    
    Users of autofs for removable media expect to be able to copy files and
    directly remove the media without having the need to call sync(8) or umount(8).
    Only do that for fat/ntfs filesystems.
    
    Sponsored by: Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D42494
    Reviewed by:    rew (older version)
    
    (cherry picked from commit 094abb6fb41c07c0266a5cae84a7439289a978e9)
---
 usr.sbin/autofs/autofs/special_media | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/autofs/autofs/special_media b/usr.sbin/autofs/autofs/special_media
index 33fa4544d028..b397a8889623 100755
--- a/usr.sbin/autofs/autofs/special_media
+++ b/usr.sbin/autofs/autofs/special_media
@@ -40,7 +40,7 @@ print_map_entry() {
 	case "${_fstype}" in
 	"exfat")
 		if [ -f "/usr/local/sbin/mount.exfat" ]; then
-			echo "-mountprog=/usr/local/sbin/mount.exfat,fstype=${_fstype}	:/dev/${_p}"
+			echo "-mountprog=/usr/local/sbin/mount.exfat,fstype=${_fstype},sync	:/dev/${_p}"
 		else
 			/usr/bin/logger -p info -t "special_media[$$]" \
 			    "Cannot mount ${_fstype} formatted device /dev/${_p}: Install sysutils/fusefs-exfat first"
@@ -49,14 +49,17 @@ print_map_entry() {
 		;;
 	"ntfs")
 		if [ -f "/usr/local/bin/ntfs-3g" ]; then
-			echo "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype}	:/dev/${_p}"
+			echo "-mountprog=/usr/local/bin/ntfs-3g,fstype=${_fstype},sync	:/dev/${_p}"
 		else
 			/usr/bin/logger -p info -t "special_media[$$]" \
 			    "Cannot mount ${_fstype} formatted device /dev/${_p}: Install sysutils/fusefs-ntfs first"
 			exit 1
 		fi
 		;;
-	"ext2fs" | "msdosfs")
+	"msdosfs")
+		echo "-fstype=${_fstype},sync	:/dev/${_p}"
+		;;
+	"ext2fs")
 		echo "-fstype=${_fstype},async	:/dev/${_p}"
 		;;
 	*)