On Fri, Apr 4, 2025 at 1:48 AM Dennis Clarke <dcla...@blastwave.org> wrote:
>
> On 4/3/25 19:52, Shawn Webb wrote:
> > On Wed, Apr 02, 2025 at 01:51:26PM -0700, Rick Macklem wrote:
> >> The commit 2ec2ba7e232d just hit main.  I do not think it will
> >> cause problems, but it is fairly large.
> >>
> >> Man page updates will be done as separate commits.
> >>
> >> Hopefully this will not cause grief, rick
> >
> > Hey Rick,
> >
> > The patch review test plan mentions a patch to ZFS itself to support
> > named attributes. Is that patch available somewhere?
> >
> > Thanks,
> >
>
> I am a little confused but the features seem to be there even if I do
> not recall how to test :
>
> titan# uname -apKU
> FreeBSD titan 15.0-CURRENT FreeBSD 15.0-CURRENT #0
> main-n276246-628d1501f7ec: Fri Apr  4 06:57:29 GMT 2025
> root@titan:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64 1500035
> 1500035
> titan#
>
>
> Create a new ZPool and then a ZFS filesystem with xattr=on :
>
> titan# camcontrol devlist
> <ST20000NM007D-3DJ103 SN03>        at scbus0 target 0 lun 0 (pass0,ada0)
> <ST20000NM007D-3DJ103 SN03>        at scbus1 target 0 lun 0 (pass1,ada1)
> <AHCI SGPIO Enclosure 2.00 0001>   at scbus2 target 0 lun 0 (ses0,pass2)
> <AHCI SGPIO Enclosure 2.00 0001>   at scbus6 target 0 lun 0 (ses1,pass3)
> <SAMSUNG MZVKW512HMJP-000L7 6L6QCXA7>  at scbus7 target 0 lun 1 (pass4,nda0)
> titan#
>
> titan# gpart create -s GPT /dev/ada0
> ada0 created
> titan# gpart create -s GPT /dev/ada1
> ada1 created
> titan#
> titan# gpart show /dev/ada0
> =>         40  39063650224  ada0  GPT  (18T)
>             40  39063650224        - free -  (18T)
>
> titan#
> titan# gpart show /dev/ada1
> =>         40  39063650224  ada1  GPT  (18T)
>             40  39063650224        - free -  (18T)
>
> titan#
> titan# gpart add -t freebsd-zfs -l fbsd15zfs0 /dev/ada0
> ada0p1 added
> titan# gpart add -t freebsd-zfs -l fbsd15zfs1 /dev/ada1
> ada1p1 added
> titan#
> titan# gpart show -l /dev/ada0
> =>         40  39063650224  ada0  GPT  (18T)
>             40  39063650224     1  fbsd15zfs0  (18T)
>
> titan#
> titan# gpart show -l /dev/ada1
> =>         40  39063650224  ada1  GPT  (18T)
>             40  39063650224     1  fbsd15zfs1  (18T)
>
> titan#
> titan# zpool create -O compression=zstd -O checksum=sha512 \
>  > -O atime=off -O xattr=on \
>  > -o autoexpand=off -o autoreplace=on -o failmode=continue \
>  > -o listsnaps=off \
>  > -m none tank mirror /dev/ada0p1 /dev/ada1p1
> titan# zpool list
> NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP
> HEALTH  ALTROOT
> tank   18.2T   588K  18.2T        -         -     0%     0%  1.00x
> ONLINE  -
> titan   460G  44.7G   415G        -         -     0%     9%  1.00x
> ONLINE  -
> titan#
>
> titan# zfs create -o mountpoint=/opt/xattr -o canmount=on \
>  > -o checksum=sha512 -o compression=zstd \
>  > -o atime=on -o exec=on -o setuid=on -o xattr=on -o copies=1 \
>  > tank/xattr
> titan#
> titan# zfs list -r tank
> NAME         USED  AVAIL  REFER  MOUNTPOINT
> tank         696K  18.1T    96K  none
> tank/xattr    96K  18.1T    96K  /opt/xattr
> titan#
> titan# zfs set quota=64G tank/xattr
> titan# zfs list -r tank
> NAME         USED  AVAIL  REFER  MOUNTPOINT
> tank         756K  18.1T    96K  none
> tank/xattr    96K  64.0G    96K  /opt/xattr
> titan# mkdir /opt/xattr/test
> titan# getfacl /opt/xattr/test
> # file: /opt/xattr/test
> # owner: root
> # group: wheel
>              owner@:rwxp--aARWcCos:-------:allow
>              group@:r-x---a-R-c--s:-------:allow
>           everyone@:r-x---a-R-c--s:-------:allow
> titan#
> titan# chgrp devl /opt/xattr/test
> titan# getfacl /opt/xattr/test
> # file: /opt/xattr/test
> # owner: root
> # group: devl
>              owner@:rwxp--aARWcCos:-------:allow
>              group@:r-x---a-R-c--s:-------:allow
>           everyone@:r-x---a-R-c--s:-------:allow
> titan#
>
> titan# setfacl -m group:devl:rwx /opt/xattr/test
> setfacl: /opt/xattr/test: branding mismatch; existing ACL is NFSv4,
> entry to be merged is POSIX.1e
> titan#
> titan#
>
> well ooops .... what was the idea here again ??
Well, this has nothing to do with my recent commit.

ZFS has always supported NFSv4 ACLs (and not POSIX draft ACLs)
on FreeBSD. (I actually am planning on a ZFS patch to add POSIX
draft ACL support, but I haven't even started to work on it. I do have
an IETF draft that adds POSIX draft ACL support to NFSv4.2.)

If you look at the setfacl man page, it shows you how to set NFSv4
ACLs.

ZFS has also always also supported extended attributes on FreeBSD.
They are currently accessed via getextattr(1) and friends.
The patch I just committed to main adds a different syscall/KAPI
that allows manipulation of the extended attributes in a Solaris-like
way, which is what NFSv4 calls "named attributes".
Since the ZFS patch in not there yet, you cannot actually use this
new syscall/KAPI (it will just fail with errors like ENOATTR).

rick


>
>
> --
> --
> Dennis Clarke
> RISC-V/SPARC/PPC/ARM/CISC
> UNIX and Linux spoken
>

Reply via email to