From e13a3ba90dfbcccfac5a6faf3be22d7eff02bdd5 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Mon, 30 Aug 2021 19:01:09 -0400 Subject: [PATCH] FreeBSD: Don't remove SA xattr if not SA znode We attempt to remove an existing SA xattr when setting a dir xattr, but this only makes sense if the znode has been upgraded to the SA format. Otherwise, we will hit an assert in zfs_sa_get_xattr. Make sure this is an SA znode before attempting to remove the SA xattr. Reviewed-by: Brian Behlendorf Reviewed-by: Alexander Motin Signed-off-by: Ryan Moeller Closes #12514 --- module/os/freebsd/zfs/zfs_vnops_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c index 3083b538180b..61ff072b3fc6 100644 --- a/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/module/os/freebsd/zfs/zfs_vnops_os.c @@ -5695,7 +5695,7 @@ zfs_setextattr(struct vop_setextattr_args *ap) } if (error) { error = zfs_setextattr_dir(ap, attrname); - if (error == 0) + if (error == 0 && zp->z_is_sa) /* * Successfully put into dir, we need to clear the one * in SA if present.