Skip to content

Commit

Permalink
FreeBSD: Don't remove SA xattr if not SA znode
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#12514
  • Loading branch information
Ryan Moeller authored and rincebrain committed Sep 22, 2021
1 parent ed60450 commit e13a3ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/zfs_vnops_os.c
Expand Up @@ -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.
Expand Down

0 comments on commit e13a3ba

Please sign in to comment.