From 31039815a763d9b051eae0a195438733c48411e9 Mon Sep 17 00:00:00 2001
From: Kent Overstreet <kent.overstreet@linux.dev>
Date: Tue, 20 Aug 2024 19:47:56 -0400
Subject: [PATCH] posix_to_bcachefs: fix missing copy_xattrs() error checking

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
 c_src/posix_to_bcachefs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/c_src/posix_to_bcachefs.c b/c_src/posix_to_bcachefs.c
index 81750751..19c53cc3 100644
--- a/c_src/posix_to_bcachefs.c
+++ b/c_src/posix_to_bcachefs.c
@@ -122,12 +122,13 @@ void copy_xattrs(struct bch_fs *c, struct bch_inode_unpacked *dst,
 			die("error getting xattr val: %m");
 
 		const struct xattr_handler *h = xattr_resolve_name(&attr);
-		struct bch_inode_unpacked inode_u;
+		if (IS_ERR(h))
+			continue;
 
 		int ret = bch2_trans_do(c, NULL, NULL, 0,
 				bch2_xattr_set(trans,
 					       (subvol_inum) { 1, dst->bi_inum },
-					       &inode_u, &hash_info, attr,
+					       dst, &hash_info, attr,
 					       val, val_size, h->flags, 0));
 		if (ret < 0)
 			die("error creating xattr: %s", bch2_err_str(ret));