-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Gluster Server compatibility regression with xattr #16828
Comments
@darkain If you read FreeBSD's extattr(2) and extattr(9) man pages, you will see that respective extended attribute APIs on FreeBSD are taking namespace specification as separate parameter. What |
This should probably be fixed in the OS+documentation then, it confuses people - there seem to exist setups with OpenZFS 2.2 + FreeBSD + GlusterFS, which rely on the ability to store "trusted" xattrs - I'd wager that we're kinda responsible for this state of things, so it should probably be us to do something about it take a look at this StackExchange post Now, the FreeBSD extattr(9) manpage says:
Which, from the point of view of OpenZFS 2.2 users, we did. So I'd say it's not exactly clear it's OK to say they should change their implementation - we are somewhat responsible for this, aren't we :) It would make sense to me to allow for seamless OS transition between Linux and FreeBSD when it comes to Gluster (and other trusted xattrs users) going forward. |
@snajpa If you compare Linux and FreeBSD extended attributes APIs, you'll see that Linux does not have separate namespace argument, but uses prefix within the name. FreeBSD uses separate argument, so passing prefix with the name won't make it any special. Passing "trusted" or "system" any other namespace as prefix there in combination with |
@amotin I'm not familiar with FreeBSD kernel source, but that ^ StackExchange post would suggest it's up to the FS to implement xattrs support more or less completely - as I said, I don't know FreeBSD code, so am taking a leap from that tmpfs note in that post. It's cetainly that way on Linux side - it's upto the FS to uphold the guarantee that only CAP_SYS_ADMIN can access trusted xattrs - so if previously FreeBSD OpenZFS implemented trusted namespace with this guarantee by sharing that logic with the Linux side, I think that was the right thing to do, even if trusted xattrs aren't standardized in FreeBSD. It's actually a compatibility design win it could (and used to) work and it didn't require any kernel change, isn't it? Trusted xattrs are for userspace use, but unlike user.*, regular users just get no access at all. Gluster uses this to store its own state it needs for managing replication, etc. - in the early days of our vpsAdminOS we didn't support trusted xattrs in our containers and I got Gluster to work by just That is to say that I think that OpenZFS can support this first and other FreeBSD FS can follow if there's ever interest in that - one isn't a dependency of the other + both are not mutually exclusive, what do you think? |
@snajpa You are missing my focus. I am not arguing about usefulness of "trusted" attributes implementation, I just don't know enough. I am talking that FreeBSD APIs expect namespace to be passed as separate parameter. It should not be sent as part of the name. So the hack you've done before on FreeBSD should actually look as |
Ah I see, so the problem is what number to use for it and how to guarantee that won't have to change in the future, right? Then I'd be interested in how the old code did it and if there was any discussion around that. I'll take a look tomorrow, out of curiosity |
@amotin I just went through current git tip of GlusterFS and it would seem that it uses |
@darkain if you'd be so kind and could get a syscall trace from glusterfsd when this failure happens so we could confirm it doesn't reach for the trusted namespace, that'd be awesome - I think it doesn't and if there's a bug it's probably unrelated to the lack of support for trusted xattrs namespace on FreeBSD |
@snajpa But did they remove "trusted." prefix from the attribute name or they are trying to specify two namespaces in two ways? |
@amotin they have these OS-dependent ifdefs which I think imply that there was never any interop between Gluster on Linux and Gluster on FreeBSD - it would seem that Gluster under FreeBSD puts everything under the |
umm maybe we're just trying to be smart in the code and actually disallow the combination of |
@snajpa Yes. I think so. And it seems Gluster uses all sort of prefixes:
|
@amotin yes those virtual ones |
olol I should have just read through the commit OP linked :D it's all in there - and now that we know that Gluster would like to store xattrs starting with |
Maybe it could be as simple as this? diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index 1676020d0..ac01b3ad2 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -1942,8 +1942,6 @@ enum zio_encrypt {
#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, \
@@ -1953,8 +1951,7 @@ enum zio_encrypt {
(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))
+ ZFS_XA_NS_PREFIX_MATCH(LINUX_TRUSTED, name)
#ifdef __cplusplus
} OK maybe not entirely that simple but by forking this macro so we have a Linux and FreeBSD version it might work, maybe... the |
@amotin so my idea is to instead of forbidding certain prefixes entirely on FreeBSD, move it always into the The problem with this approach is it that it forces Gluster+OpenZFS+FreeBSD users to take action when migrating onto a version with this integrated (but still better than not being able to use Gluster+OpenZFS+FreeBSD at all going fwd). There's also the possibility of also allowing Don't really have a preference but if 'user delight' is one of OpenZFS goals then the second path might be preferable. Or if anyone can think of a third... :)) |
@snajpa The whole goal of that project was to allow compatibility between different OS'es. Adding duplicate prefixes aside if being a mess would not allow that, but instead would make already existing mess even worse. What Gluster does on FreeBSD I find just broken, and instead of conforming to it we might provide them a way to do it properly. That might include addition of trusted attributes support to FreeBSD (I have no idea why it is not there, may have a reason or just be an omission), and patching the code in OS-dependent ifdefs to cut the prefix from the attribute name and passing it as via the namespace parameter instead of hardcoding |
@amotin if compatibility between OSes is the primary goal then |
Gluster evidently doesn't really care if the CAP_SYS_ADMIN/root condition is enforced, but I think we have no business telling users in general they can't name their user or EXTATTR_NAMESPACE_USER xattrs |
@snajpa With compatibility I mean on disk. APIs are just different between the OS'es, period. You should not try to push things where they should not go. Yes, on-disk format for the attributes will likely include the prefixes. But we can not say that "we have no business telling users in general they can't name the xattrs user.whatever, |
#16828 (comment) then this is my best answer, compatible Linux<=>FreeBSD - with that "trusted.*" in EXTATTR_NAMESPACE_USER + root enforced part being optional. No idea about Illumos and if anyone would care to enforce the root boundary there - but it probably should be, if things shouldn't get more messy. This would IMHO decrease entropy on the user side, but it does increase code complexity, since we have to deal with the |
There is the thing that if people now on-disk have I can already do But currently, in master, even if we ignore Gluster, I won't be able to change ondisk stored
This code would be a whole lot easier if we could rely that there's only the new prefixed way of storing xattrs. |
That is why I'd prefer adding the proper namespace to FreeBSD and patch the Gluster. It would avoid double-prefixing and zillion other problems. Code before 5c00613 added no prefixes so should migrate to addition of EXTATTR_NAMESPACE_TRUSTED just fine. Just Gluster would need to be updated together with OS. |
@amotin OK, then |
It'd be awesome if there was a way out of this by upgrading within supported release versions of FreeBSD/illumos + OpenZFS with the trusted semantics respected with a non-hacky implementation. @amotin Gluster doesn't even have to be updated if we don't disallow what we shouldn't really be disallowing, which I think any respectable fix for this situation should rectify too, I think there shouldn't be any limitation on using But in the situation where we fix this even while also delivering proper trusted xattr namespace support in FreeBSD, if anyone's running Gluster which isn't updated, the interop/migration problems still arise. So this needs some solution, it'd be best if that solution was in Gluster in their supported releases before this has a chance to surprise users (I'm almost certain there will be people who will be hit by this and so it needs at least some manual howto they can follow, if Gluster devs wouldn't want to automate it better). |
@snajpa I would agree that I feel like I am repeating myself third time and you don't hear me. I've already told how I see the proper final solution. And if on top of that you can propose temporary transitional shims -- I'll give them a fair review. But I will not personally accept simple affirmation of improper API usage, considering the consequences. |
@amotin yes it would be accessed as Gluster's current improper usage of xattr APIs on top of OpenZFS across supported platforms will need to be addressed more broadly than just releasing a fixed version that uses new trusted xattr namespace in FreeBSD - because people's requirements are different, you can see that a lot of times in issues here too - some have policies that they can upgrade this or that component, but that one closer to the core of their business needs to undergo more rigorous testing and sometimes even certifications, etc., so I can imagine there could be situations where people are unwilling/unable to upgrade Gluster itself in lockstep with kernel+ZFS. Others might be able to upgrade Gluster but kernel+ZFS upgrade could be late - though I think we're okay in this particular scenario, because that upgrade would be blocked and the fact it could happen doesn't mean it needs to, in environments that care more about stability of ZFS+kernel than Gluster. For the former, some script for one-off migration between improper xattrs in |
@snajpa I am not sure we have the |
If we can accept that we'll only fix this slowly, if we say that it's ok for some parts of this to stay broken for a while - then we can use time to our advantage -
@amotin is that really okay though? it's a bet on the theory there's no other significant breakage in other software caused by the EINVALs :) |
@snajpa "only then fix the problem with user.trusted., user.user., user.system.* being unreachable with -EINVAL on FreeBSD" -- I am still not sure it is a big problem, but yes. Though I would consider the problem solved after the step 2. We could add a tunable to allow disabling the check with a big warning that xattrs written that way might be inaccessible on different platforms or when the possibly broken software is finally fixed. |
System information
Describe the problem you're observing
5c00613
This commit broke compatibility with the Gluster server application. Gluster relies heavily upon xattrs, more specifically, the "trusted" namespace xattrs. Without these, Gluster server fails to function at all.
gluster/glusterfs#4340
This issue has been open for months over on the Gluster GitHub repo, however I believe it should also be noted here as a regression in ZFS.
Describe how to reproduce the problem
A quick repro example without installing Gluster:
Alternatively: Installer Gluster and attempt to create a volume.
gluster volume create
will fail with the following error message:Include any warning/errors/backtraces from the system logs
NOTE: Gluster produces a similar error with a different path.
Testing
zfs/include/sys/fs/zfs.h
Line 1956 in f29dcc2
On my personal machine, I removed the single
ZFS_XA_NS_PREFIX_MATCH(LINUX_TRUSTED, name)
line fromZFS_XA_NS_PREFIX_FORBIDDEN
, recompiled, and Gluster Server started to function as normal again.Upsteam Docs
https://man7.org/linux/man-pages/man7/xattr.7.html
This directly states that it is intended to be used by trusted user-space applications, which Gluster Server most likely would fall into. I'm uncertain why ZFS would want to remove this functionality entirely. I understand wanting to unify feature sets between Linux, FreeBSD, and others, but to flat out "forbid" flags like this which is actively used seems to be the wrong decision. At worst, this should be gated with a dataset attribute of some kind, rather than a hard-coded "FORBIDDEN"
The text was updated successfully, but these errors were encountered: