Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MrDefacto opened this issue Apr 20, 2024 · 3 comments
Open

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

MrDefacto opened this issue Apr 20, 2024 · 3 comments

Comments

@MrDefacto
Copy link

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
Copy link

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

@m-ueberall
Copy link

@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
Copy link
Author

setextattr user trusted.md5sum 1234 file1.txt

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants