[Bug 276876] [fusefs] sysutils/fusefs-exfat FUSE protocol violation (direct_io) and illegal UTF-8 sequence

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 07 Feb 2024 21:45:14 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276876

            Bug ID: 276876
           Summary: [fusefs] sysutils/fusefs-exfat FUSE protocol violation
                    (direct_io) and illegal UTF-8 sequence
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: samm@FreeBSD.org
          Reporter: jakub_lach@mailplus.pl
             Flags: maintainer-feedback?(samm@FreeBSD.org)
          Assignee: samm@FreeBSD.org

I have installed sysutils/exfat-utils and sysutils/fusefs-exfat, attempting to
backup MBR fat32 (/mnt/) card to larger one (exFAT GPT /media/ to future proof
it).

I have used following procedure -

# sudo gpart destroy -F /dev/da0
# sudo gpart create -s gpt /dev/da0
# sudo gpart add -t ms-basic-data -b 1m -a 1m da0
# sudo mkexfatfs /dev/da0p1

# kldload fusefs
# sudo mount.exfat /dev/da0p1 /media/
# sudo mount_msdosfs /dev/da1s1 /mnt/

# sudo cp -r -p /mnt/ /media

After approximately 30GB and 1h, the following message appeared -

Feb  7 18:50:54 Thinkpad kernel: WARNING: FUSE protocol violation for server
mounted at /media: cache incoherent!  To prevent data corruption, disable the
data cache by mounting with -o direct_io, or as directed otherwise by your FUSE
server's documentation.  This warning will not be repeated.

I presume it may be mitigated by -

# sudo mount.exfat -o direct_io /dev/da0p1 /media/

That was first letdown though, as the default "should work". 

Another thing that surprised me was that writing to /media/ was allowed without
sudo. It appears it is a generic property with fuse, as it was the case also
with NTFS (using mkntfs -vf).

Unfortunately, about 3/4 in the following appeared -

Feb  7 20:14:17 Thinkpad mount.exfat[43704]: illegal UTF-8 sequence
Feb  7 20:14:17 Thinkpad syslogd: last message repeated 1 times
Feb  7 20:16:10 Thinkpad syslogd: last message repeated 6 times
Feb  7 20:17:46 Thinkpad syslogd: last message repeated 18 times

This I find the most strange, as the files which were copied resided at /mnt/
where fat32 MBR was mounted. cp printed the problematic files, which sure
enough contained some ΓΌ or similar. But somehow fat32 didn't have problem with
them?

After the cp exited, I've ran the following at /mnt/ at /media/ -

# find . -type f | sort > ~/list

It appeared the files with problematic names were missing. Moreover, the
overall size of /mnt/ and /media/ (reported by du) is different (not so sure if
this is a matter of corruption or just missing files). 

The second error would explain the difference (but is quite unexplainable as
/mnt/ was fat32), but the first one, speaking of corruption - is the most
worrying. 

Overall I'm not confident that exFAT can be confidently used for backup. I have
previously successfully tested the same procedure for fat32 GPT backup (same
hardware)

-- 
You are receiving this mail because:
You are the assignee for the bug.