Linux: Suppress clang static analyzer warning in zfs_remove()

Clang's static analyzer points out that if we fail to find an extended
attribute directory, but somehow find it when calculating delete_now and
delete_now is true, we will have a NULL pointer dereference when we try
to unlink the extended attribute directory.

I am not sure if this is possible, but if it is, I do not see a sane way
of handling this other than rolling back the transaction and retrying.
For now, let us do an VERIFY_IMPLY(). If this trips, it will stop the
transaction from committing, which will prevent an attribute directory
leak.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575
This commit is contained in:
Richard Yao 2023-03-05 01:32:03 -05:00 committed by Brian Behlendorf
parent c2550a136e
commit 66a38fd10a

View File

@ -1089,6 +1089,7 @@ top:
!zn_has_cached_data(zp, 0, LLONG_MAX) && !zn_has_cached_data(zp, 0, LLONG_MAX) &&
xattr_obj == xattr_obj_unlinked && xattr_obj == xattr_obj_unlinked &&
zfs_external_acl(zp) == acl_obj; zfs_external_acl(zp) == acl_obj;
VERIFY_IMPLY(xattr_obj_unlinked, xzp);
} }
if (delete_now) { if (delete_now) {