mergerfs
mergerfs copied to clipboard
Add Support for Synology's synoacl
Is your feature request related to a problem? Please describe. Using mergerfs with Synology DSM is possible, but with limitations. Synology's EXT4 and BTRFS implementation uses synoacl instead of POSIX ACL, so permissions are not working correctly in this case.
Describe the solution you'd like Synology's synoacl support is part of the Kernel in their GPL contributions which would give hints on how to implement this with mergerfs correctly.
Linux Kernel source (4.4.x): https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/24922branch/kvmx64-source/linux-4.4.x.txz/download
See fs/fuse/dir.c:
2098: static int fuse_syno_acl_sys_is_support(struct dentry *dentry, int tag)
And there also some synoacl related functions too.
I found hints, that it's already has some support for FUSE for GlusterFS:
eg.: include/uapi/linux/syno_acl_xattr_ds.h:21
but also in the dir.c source above.
Hints also in synoconfigs/Kconfig.fs:
config SYNO_FUSE_WINACL
bool "Gluster FS support synoacl"
default y
depends on FUSE_FS && SYNO_FS_WINACL && SYNO_FS_ARCHIVE_BIT && SYNO_FUSE_GLUSTER
Also see fs/syno_acl.c for the ACL methods, what it does exactly.
VFS Related, interesting parts:
fs/synoacl_api.c:
#define VFS_MODULE psynoacl_vfs_op
// [...]
#define IS_VFS_ACL_READY(x) (VFS_MODULE && VFS_MODULE->x)
#define DO_VFS(x, ...) VFS_MODULE->x(__VA_ARGS__)
// [...]
int synoacl_mod_exec_permission(struct dentry *d)
{
if (IS_VFS_ACL_READY(syno_acl_exec_permission)) {
return DO_VFS(syno_acl_exec_permission, d);
}
return 0;
}
EXPORT_SYMBOL(synoacl_mod_exec_permission);
// [...] And so on
I would expect that these calls could be forwarded to the underlying disks too. EXT4 and BTRFS is mounted with the synoacl mount option, which means the function is active on these disks.
Describe alternatives you've considered There is a workaround to use mergerfs as a Volume in DSM, but this causing that no ACL's are there at all, which is required by some services of DSM. It would be better if it supports the synoacl mount option with forwarding the ACL commands to the branches.
Additional context Add any other context or screenshots about the feature request here.
They have explicitly written a lot of special code just for GlusterFS which is a little unnerving. They modify the FUSE protocol so it would require a custom build of mergerfs' libfuse. Otherwise it seems like xattr stuff which should "just work" otherwise. But given the glusterfs specific code I imagine I would have to also fake being glusterfs (which looks to be setting the subtype which I have hardcoded to 'mergerfs').
There is a synoacl_vfs_register method, which may not using the hardcoded parts (I hope so).
fs/synoacl_api.c:74
Also I downloaded their ntfs-3g implementation, which contains some calls related to the ACL support.
Their package toolkit contains some useful libs related to the ACL implementations: https://sourceforge.net/projects/dsgpl/files/toolkit/DSM7.0/ds.kvmx64-7.0.dev.txz/download
Hopefully it's not required to fake the fs as any other.
You can look at the IS_GLUSTER_FS macro. It checks to see if the subtype is "glusterfs".
Yes, I see! So it's hard to implement then?
That part is trivial. It would simply have to change from "mergerfs" to "glusterfs" but on the whole there is more complicated. They changed the FUSE protocol. I'd need to incorporate those same changes and then properly handle the changed data types. That probably isn't too hard but I don't have any way to practically test this stuff. I don't own a Synology device.
+1