gluster / glusterfs

Gluster Filesystem : Build your distributed storage in minutes
https://www.gluster.org
GNU General Public License v2.0
4.51k stars 1.07k forks source link

ZFS xattr conflict due to forbidden 'trusted' prefix #4340

Open MrDefacto opened 3 weeks ago

MrDefacto commented 3 weeks ago

Description of problem:

In newer versions of ZFS, certain prefixes for xattr (extended attribute) names are restricted. Specifically, the 'trusted' prefix used by GlusterFS is now prohibited in ZFS, leading to conflicts. Consequently, ZFS cannot be used as a brick location in these newer versions.

The exact command to reproduce the issue:

Issue following command FreeBSD with filename 'test' located on zfs volume: setextattr user trusted.test test /zfs/test

so also GlusterFS is failing.

The full output of the command that failed:

setextattr: /zfs/test: failed: Invalid argument

Expected results:

no error

Mandatory info:

GlusterFS 8/9/10/11 OpenZFS 2.2.3

Additional info:

For example OpenZFS 2.2.3 file 'includes/sys/fs/zfs.h' define forbidden prefixes:

define ZFS_XA_NS_FREEBSD_PREFIX "freebsd:"

define ZFS_XA_NS_FREEBSD_PREFIX_LEN strlen("freebsd:")

define ZFS_XA_NS_LINUX_SECURITY_PREFIX "security."

define ZFS_XA_NS_LINUX_SECURITY_PREFIX_LEN strlen("security.")

define ZFS_XA_NS_LINUX_SYSTEM_PREFIX "system."

define ZFS_XA_NS_LINUX_SYSTEM_PREFIX_LEN strlen("system.")

define ZFS_XA_NS_LINUX_TRUSTED_PREFIX "trusted."

define ZFS_XA_NS_LINUX_TRUSTED_PREFIX_LEN strlen("trusted.")

define ZFS_XA_NS_LINUX_USER_PREFIX "user."

define ZFS_XA_NS_LINUX_USER_PREFIX_LEN strlen("user.")

define ZFS_XA_NS_PREFIX_MATCH(ns, name) \

(strncmp(name, ZFS_XA_NS_##ns##_PREFIX, \
ZFS_XA_NS_##ns##_PREFIX_LEN) == 0)

define ZFS_XA_NS_PREFIX_FORBIDDEN(name) \

(ZFS_XA_NS_PREFIX_MATCH(FREEBSD, name) || \
    ZFS_XA_NS_PREFIX_MATCH(LINUX_SECURITY, name) || \
    ZFS_XA_NS_PREFIX_MATCH(LINUX_SYSTEM, name) || \
    ZFS_XA_NS_PREFIX_MATCH(LINUX_TRUSTED, name) || \
    ZFS_XA_NS_PREFIX_MATCH(LINUX_USER, name))

- The operating system / glusterfs version:

Checked on FreeBSD

m-ueberall commented 3 weeks ago

For the record, git blame links the above to this commit: Cross-platform xattr user namespace compatibility (Feb 16, 2022).

m-ueberall commented 6 days ago

@MrDefacto: Because we're slowly switching from ZFS v2.1.x to v2.2.x, I tested the below on Linux and didn't see a problem here:

[2024-05-10T21:58:54+0200] root@vserver02:/backup/tmp# df .
Filesystem     Type 1K-blocks  Used Available Use% Mounted on
rpool/BACKUP   zfs   52586112   384  52585728   1% /backup
[2024-05-10T21:58:56+0200] root@vserver02:/backup/tmp# echo "Hello, world" >./file1.txt
[2024-05-10T21:59:08+0200] root@vserver02:/backup/tmp# setfattr -n user.md5sum1 -v 12345 ./file1.txt
[2024-05-10T21:59:32+0200] root@vserver02:/backup/tmp# setfattr -n trusted.md5sum2 -v 98765 ./file1.txt
[2024-05-10T21:59:50+0200] root@vserver02:/backup/tmp# getfattr -d ./file1.txt
# file: file1.txt
user.md5sum1="12345"

[2024-05-10T21:59:58+0200] root@vserver02:/backup/tmp# getfattr -n trusted.md5sum2 ./file1.txt
# file: file1.txt
trusted.md5sum2="98765"

[2024-05-10T22:00:11+0200] root@vserver02:/backup/tmp# zfs -V
zfs-2.2.4-1
zfs-kmod-2.2.4-1
[2024-05-10T22:00:14+0200] root@vserver02:/backup/tmp# 
MrDefacto commented 6 days ago

setextattr user trusted.md5sum 1234 file1.txt

FreeBSD 14.1 zfs-2.2.4-FreeBSD_g256659204 zfs-kmod-2.2.4-FreeBSD_g256659204