From 67e6ae0a354057bdc2639896893196bea7a2f822 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 9 Feb 2021 17:11:23 -0500
Subject: [PATCH] mke2fs: fix a importing a directory with an ACL and inline
 data

If an inode which is copied into a file system using "mke2fs -d" has
an ACL (or extended attributes) and it is also using inline data, when
the extended attribute(s) are copied in, the inline data gets dropped due to a missing call to ext2fs_xattrs_read().

Conflict:delete test cases

Addresses-Debian-Bug: #971014
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/create_inode.c            |   7 ++
 1 files changed, 7 insertions(+)

diff --git a/misc/create_inode.c b/misc/create_inode.c
index 6f8487b9..194b06a2 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -166,6 +166,13 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
 		return retval;
 	}
 
+	retval = ext2fs_xattrs_read(handle);
+	if (retval) {
+		com_err(__func__, retval,
+			_("while reading xattrs for inode %u"), ino);
+		return retval;
+	}
+
 	retval = ext2fs_get_mem(size, &list);
 	if (retval) {
 		com_err(__func__, retval, _("while allocating memory"));
-- 
2.25.1

