From nobody Sun Mar 09 23:26:46 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Z9x4h0HQCz5pRQG; Sun, 09 Mar 2025 23:27:00 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z9x4g2m4qz3wdL; Sun, 09 Mar 2025 23:26:59 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5e614da8615so2766043a12.1; Sun, 09 Mar 2025 16:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741562818; x=1742167618; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CybKTf33ljwC05WeLUg/0H32ZNN0S4l7K4WAVPY5N+w=; b=mcer65kfaGzBVuOgLpTJmo9+pvE8UP0IOYjCTezdisfFEAtm1j2tYIVTcc29B2uJ99 Lnlw9CwDLUa8vMpmyRxLAx56RVje1dhleAET3AMPTIzuw/y1G1Zr7HztGo0FB7+y+a3B iJZwgrUgszREHRsteAAPucJkA33CI/QNJpQCRDEWzIf1rGjogVhJRcxLdf9LOGjaqrVT nJ36x3bw3zWzpDLbOboGLNe21R2I7wJjvI0gkDLSABRjTbv35gpT3s4dLS+DEpe1Es8P hvH7TjX5bmlZS18ltmEOJTmhSO0Jd15m8NjBnPTnlk4Gs/S/KJ3tZY9FD767fXcVKvVx nTKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741562818; x=1742167618; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CybKTf33ljwC05WeLUg/0H32ZNN0S4l7K4WAVPY5N+w=; b=upT3Iq+r7ii9Trca93rv965x4UFoFH7Jzb/KWSjo17tnF6T0OTO95ctk8P/4VloC2t f5bHDYuuSOZEfXQT1yoLgjUgq8u43jmYwy7K0b8lKi1Be2i/r1PtwAoW2EiGVgs4BsN/ DF9CN1dWb+I1XoKb5MO6HUIJzCU8Fz52sKw4YJsrXGTVFTs9lVYIs7+nd605NPsihcmc zM1og5dPUnQ0qz2ovfhKyoHg52awtXKy4WOGprXWcBRzmTBHP4e6pFEDuUbCCEudPmyd nZ6NSuo/eyPJwcmEGKjN2Ck8LSQTT/Q+Odqgzb60VC/cf4sL8rJ+YgqEogXt2IjdGBsh pDAg== X-Forwarded-Encrypted: i=1; AJvYcCUFVNKfta0ldhkV5y29ZUMaKVUb6QrQy63ZvGPeMhWZxRVDoqVFYZaLhcw/OyyarN4+ksDckKnpJcqbcP0X4Soq@freebsd.org, AJvYcCW1D3Zu+Mq/HO3oXEA8k3S8zSRmxchfx2xXHmSpLe4+xcdQoViQbJ7F3CUGCmMJxiqemIudgHetaw/Ss1o=@freebsd.org X-Gm-Message-State: AOJu0Yz19u187GcdyR42DX8pFg0z7UTCJz4px+YCzSb13fhvDGE0h/1M 8WCm/ripBdQN3T9jHCQAQ6hhu0Nr0mLpcKdqKWYel0yIUkXEVJ0/aBZsUsqzXd95k4m9qut2NPX h7ezn3d6KH8rYGbsqTTMrSfLj3g== X-Gm-Gg: ASbGncs4ytHfnGULUqQVemT6DEcLLiYsNK5RQoMzs6pS57No9zdtCTbFS/R232UuiZm yjNzybyvwYAV4GA1s00Ocv03TqXnY1KD1hii1iEfwFlFviS+G6DoaKZjLO/MRGcGgzGcXOx2C4r my6IKEOVW8msHpkdrYJGj+iyjzA7EeBDI+cf9OqKpDpMjUK4Jo/xs16nE6 X-Google-Smtp-Source: AGHT+IG3EYxcjaN8e479takrLgpHO1bOcV5CvvjIyaFcMvRQNXmY8Z8OPAXYPQO2NNnbjTvqnPhFCeqJzlNpSHtQ0aY= X-Received: by 2002:a05:6402:51ca:b0:5e5:4807:545f with SMTP id 4fb4d7f45d1cf-5e6150296a1mr8783686a12.12.1741562817568; Sun, 09 Mar 2025 16:26:57 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Rick Macklem Date: Sun, 9 Mar 2025 16:26:46 -0700 X-Gm-Features: AQ5f1JrDX7kC6CGXWk_n5nd239FIRB0mGx6wG_uk2_eoQGY6H0vqp-V3-tOLes8 Message-ID: Subject: Re: RFC: Solaris style extended attributes for FreeBSD To: Andrew Walker Cc: Konstantin Belousov , freebsd-arch@freebsd.org, FreeBSD CURRENT , Cedric Blancher , Lionel Cons Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4Z9x4g2m4qz3wdL X-Spamd-Bar: ---- On Sun, Mar 9, 2025 at 10:15=E2=80=AFAM Andrew Walker wrote: > > On Sun, Mar 9, 2025 at 8:24=E2=80=AFAM Rick Macklem wrote: > > > > On Sun, Mar 9, 2025 at 5:46=E2=80=AFAM Andrew Walker wrote: > > > > > > Out of curiosity, how are you preventing users from creating / writin= g > > > xattrs with the `system?` name prefix. In ZFS on FreeBSD IIRC this > > > prefix is used to determine whether the corresponding attribute when > > > accessed via the extattr interface is in the user or system > > > namespaces. > > A couple of comments... > > 1 - My current thinking would be a ZFS fs would be configured for one > > or the other (mixing them is weird as noted by the next comment), > > There is currently the xattr property that can be set to "dir" or = "sa". > > 2 - I haven't looked at system space FreeBSD attributes yet (I will), > > but when mixing them, you can get two attributes with the same nam= e > > showing up in the named attribute directory (the open gets the nam= ed > > attribute one). I haven't yet figured out how to get rid of the du= plicate. > > 3 - I assume the patch could include code that excludes "system.xxx" na= mes > > from the directory. (I'll do some testing.) > > This seems to be the NFS equivalent to SMB alternate data streams (or > MacOS resource forks). > > In my opinion it's better to keep them cleanly separated from xattrs / > extattrs (minimally in a different namespace). Solaris IIRC did this > with its SMB server (there xattrs IIRC were written to an SA and > streams were written using the attributes directory). When ZFS got > ported to FreeBSD / Linux, the attr dir got repurposed for extattr / > xattr, and then when performance problems were found (and problems > with expectation of atomicity with ops) they were shifted to SA / > dnode bonus block. > > I think it would be better (inside ZFS) to have a dedicated hard-coded > prefix for stuff written in the attr dir. For example: "stream.". This > can be used to delineate ones that should never be written to SA from > regular user namespace extattrs and regular user namespace ones. This > can correspond to adding a new extattr namespace in the FreeBSD VFS > (for examples "stream") that can be used to present these like we > separate out the prefix for system. > > This gives a few advantages: > 1. It prevents writing to restricted namespace > 2. prevents weird combinations of SA and file > > Unfortunately, this also means having to adjust userspace backup tools > (such as tar) and cp / mv to account for the new extattr namespace. If > the data gets replicated to a system that lacks this support, IIRC the > ZFS streams will appear in the user namespace with the string > "stream." prefixing the extattr. > > It's somewhat awkward, but generally trying to treat two different > sorts of thing (streams and xattrs) as if they're the same thing is > awkward. I do think that this may need to be socialized with upstream > openzfs. Sounds good. You obviously know a lot more about how ZFS does this than I do. Are you volunteering to write some code? (I can probably figure out how to prefix the named attributes with "stream.= " and keep them separate from the ones handled via the get/setextattr mechani= sm.) I think we agree that they need to be kept separate. Alternately, having a new setting for the "xattr" property that does not al= low the get/setextattr interface might be a simpler way to do it. (Without that setting, the named attributes would not be allowed.) And, yes, obviously the OpenZFS folk would need to be involved if/when a patch was headed that way. (I think they are fairly flexible so long as the patch only applies to the module/os/freebsd subtree.) rick > > Andrew