git: 094abb6fb41c - main - autofs: media: Always use sync option for fat*

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Mon, 04 Dec 2023 06:51:47 UTC
The branch main has been updated by manu:

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

commit 094abb6fb41c07c0266a5cae84a7439289a978e9
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-12-01 09:27:59 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-12-04 06:51:33 +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)
---
 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}"
 		;;
 	*)