From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F0722FFF81 for ; Mon, 30 Mar 2026 11:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774868481; cv=none; b=snOv6NFbMxwFy/PIbjJHudY2f/7d7O2R147jE2wJaniXQteCAHaSt+5h7G4VYIh6jhbz8EqhyhNl/dBq4WTIGsLlWVVNxwhXAh+TP9gKuqOOppQnya3FYsex2ecR2SBKmbcdmkDMHxBak2tfK6j6cmd42r6OYx1nOYZN/tHA0KE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774868481; c=relaxed/simple; bh=3WLh0JbGlgpDkjWx/2eeoE0eNvp0bbIkdjVzln65tCY=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=XvxLyMZ+cJOtUZiTLZmKN6V7blW8ASWAdWPhmW1IWEGS+MAb6DPF2fnP6Ue4NaGGCHQK0AdiqzXpH56CBvqqF9xIGz+Jtwj247UKeyHJYG7V6HG/X6RNChtoJkOrFTDFIEE9oo1FWGSKs4u9Piee0eYV4CgFTvPwpdpo4Ou5x3o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LjLjmQqR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LjLjmQqR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 637C3C4CEF7; Mon, 30 Mar 2026 11:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774868480; bh=3WLh0JbGlgpDkjWx/2eeoE0eNvp0bbIkdjVzln65tCY=; h=Subject:To:Cc:From:Date:From; b=LjLjmQqRkz5Yuh01Kpd8y99veA9UBZ8z07JaTEXeu5r4tg0wIPkCPSP2JV8hIMmdV QRwnSFHUooJQuXYH6b4NoIdQIN4T2W6R83SPTXWmWjbmCi5MNl8uWqjpIXZuj1dSLm s7fL4NIh5VF4KB5noM6RD5JarLTjee0vHY3r9UN4= Subject: FAILED: patch "[PATCH] ext4: fix journal credit check when setting fscrypt context" failed to apply to 5.10-stable tree To: simon.weber.39@gmail.com,anthonydev@fastmail.com,ebiggers@kernel.org,tytso@mit.edu Cc: From: Date: Mon, 30 Mar 2026 13:01:09 +0200 Message-ID: <2026033009-straw-negate-ff79@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x b1d682f1990c19fb1d5b97d13266210457092bcd # git commit -s git send-email --to '' --in-reply-to '2026033009-straw-negate-ff79@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b1d682f1990c19fb1d5b97d13266210457092bcd Mon Sep 17 00:00:00 2001 From: Simon Weber Date: Sat, 7 Feb 2026 10:53:03 +0100 Subject: [PATCH] ext4: fix journal credit check when setting fscrypt context Fix an issue arising when ext4 features has_journal, ea_inode, and encrypt are activated simultaneously, leading to ENOSPC when creating an encrypted file. Fix by passing XATTR_CREATE flag to xattr_set_handle function if a handle is specified, i.e., when the function is called in the control flow of creating a new inode. This aligns the number of jbd2 credits set_handle checks for with the number allocated for creating a new inode. ext4_set_context must not be called with a non-null handle (fs_data) if fscrypt context xattr is not guaranteed to not exist yet. The only other usage of this function currently is when handling the ioctl FS_IOC_SET_ENCRYPTION_POLICY, which calls it with fs_data=NULL. Fixes: c1a5d5f6ab21eb7e ("ext4: improve journal credit handling in set xattr paths") Co-developed-by: Anthony Durrer Signed-off-by: Anthony Durrer Signed-off-by: Simon Weber Reviewed-by: Eric Biggers Link: https://patch.msgid.link/20260207100148.724275-4-simon.weber.39@gmail.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c index cf0a0970c095..f41f320f4437 100644 --- a/fs/ext4/crypto.c +++ b/fs/ext4/crypto.c @@ -163,10 +163,17 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, */ if (handle) { + /* + * Since the inode is new it is ok to pass the + * XATTR_CREATE flag. This is necessary to match the + * remaining journal credits check in the set_handle + * function with the credits allocated for the new + * inode. + */ res = ext4_xattr_set_handle(handle, inode, EXT4_XATTR_INDEX_ENCRYPTION, EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, - ctx, len, 0); + ctx, len, XATTR_CREATE); if (!res) { ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT); ext4_clear_inode_state(inode,