Hi Tobias,
We have exact same problem but never really found the underlying issue and
whether it's a cephfs bug, a samba bug or only related to vfs_fruit. We did
a lot of digging and found that the issue occurs when macOS Finder is copying
files to a samba file share backed by CephFS. When copying starts, Finder writes
the hex sequence 'brokMACS' into a part of the xattr named
'user.DosStream.AFP_AfpInfo' to indicate that the file is being copied
and displayed as grayed out by Finder. When copying is done, it's rather
random whether Finder are able to overwrite the bytes back to original state,
hence some files remain grayed out.
If anyone are able to shed some more light upon why this happens or how to
prevent this it would be most welcome!
Our "solution" to this problem is to remove the offending xattr bytes
at regular intervals. It's possible to workaround the problem with
streams_depot but for us it's not optimal as it generates a lot of i/o and
extraneous files.
We have written the following bash script that takes a file as argument and
overwrites the xattr bytes in question so the files are not grayed out.
Furthermore we have coupled this with a cronjob that scans for new files every
minute.
--thomas
----
#!/bin/bash
# remove_brokMACS_xattr.sh
AFP_XATTR_HEX=$( getfattr -e hex -n 'user.DosStream.AFP_AfpInfo:$DATA'
"$1" 2>/dev/null )
if [ $? -eq "0" ]
then
echo "$AFP_XATTR_HEX" | grep -q "62726f6b4d414353" -
if [ $? -eq "0" ]
then
TIMESTAMP=$(date -R)
NEW_XATTR_HEX=$( echo "$AFP_XATTR_HEX" | sed -n
's/.*AFP_AfpInfo:\$DATA=\(.*\)$/\1/p' | sed
's/62726f6b4d414353/0000000000000000/g' )
setfattr -n 'user.DosStream.AFP_AfpInfo:$DATA' -v $NEW_XATTR_HEX
"$1"
if [ $? -eq "0" ]
then
echo -e "$TIMESTAMP INFO: Removed FinderInfo parameter brokMACS
xattr from $1"
exit 0
else
echo -e "$TIMESTAMP ERROR: Removing FinderInfo parameter
brokMACS xattr from $1"
exit 1
fi
fi
fi
exit 0
----
#crontab *
* * * * * find /mnt/cephfs/storage -type f -exec /root/remove_brokMACS_xattr.sh
'{}' \; exit 0 >> /var/log/brokmacs.log
----
* It should be noted that scanning all files every minute do not scale very well
if there's a lot of files. In production we use a custom python script that
look at the special cephfs xattr ceph.dir.rctime to find recently changed
directories and only scan for new files in those dirs. However I'm not able
to share that python script publicly...
9. mai 2023 kl. 12:13 skrev Tobias Hachmer via samba <samba at
lists.samba.org>:
Hi list,
we have migrated a single node Samba server from Ubuntu Trusty to a 3-node CTDB
Cluster on Debian Bullseye with Sernet packages. Storage is CephFS. We are
running Samba in Standalone Mode with LDAP Backend.
Samba Version: sernet-samba 99:4.18.2-2debian11
I don't know if it is relevant here's how we have mounted CephFS on the
samba nodes:
(fstab):/samba /srv/samba ceph name=samba,_netdev 0 0
Client caps:
client.samba
key: ...
caps: [mds] allow rw fsname=cephfs path=/samba
caps: [mon] allow r fsname=cephfs
caps: [osd] allow rw tag cephfs data=cephfs
After the migration everything seems fine but we experience problems with MacOS
Clients. We have ~97% MacOS Clients here.
Problem description:
Many files are greyed out in the Finder and appear to be read only. Documents
can't be opened or copied. In case of pictures the preview works but the
pics can't be opened by any application.
Which files are greyed out seems random.
We have tested with several fruit options. If we set "fruit:metadata"
to default (netatalk) the greyed out files are accessible again.
We're unsure which fruit options are the best for a 97% MacOS environment.
We have first use the config described in [1].
Our Samba Configuration: pastebin.com/4zbzezZk
Would be great if someone can explain what fruit options are best or why the
files are greyed out with "fruit:metadata = stream".
Thanks and kind regards
Tobias
[1] knowledgebase.45drives.com/kb/macos-samba-optimization
--
To unsubscribe from this list go to the following URL and read the
instructions: lists.samba.org/mailman/options/samba