[ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: 73c384c0cdaa8ea9ca9ef2d0cff6a25930f1648e WARNING: Author mismatch between patch and upstream commit: Backport author: Shaoying Xu<shaoyi@xxxxxxxxxx> Commit author: Theodore Ts'o<tytso@xxxxxxx> Status in newer kernel trees: 6.12.y | Present (exact SHA1) 6.6.y | Present (exact SHA1) 6.1.y | Present (exact SHA1) 5.15.y | Present (exact SHA1) 5.10.y | Present (exact SHA1) 5.4.y | Not found Note: The patch differs from the upstream commit: --- 1: 73c384c0cdaa8 ! 1: ad990516172ca ext4: avoid ext4_error()'s caused by ENOMEM in the truncate path @@ Metadata ## Commit message ## ext4: avoid ext4_error()'s caused by ENOMEM in the truncate path + [ Upstream commit 73c384c0cdaa8ea9ca9ef2d0cff6a25930f1648e ] + We can't fail in the truncate path without requiring an fsck. Add work around for this by using a combination of retry loops and the __GFP_NOFAIL flag. @@ Commit message Reviewed-by: Harshad Shirwadkar <harshadshirwadkar@xxxxxxxxx> Link: https://lore.kernel.org/r/20200507175028.15061-1-pendleton@xxxxxxxxxx Signed-off-by: Theodore Ts'o <tytso@xxxxxxx> + Stable-dep-of: c26ab35702f8 ("ext4: fix slab-use-after-free in ext4_split_extent_at()") + [v5.4: resolved contextual conflict in __read_extent_tree_block] + Signed-off-by: Shaoying Xu <shaoyi@xxxxxxxxxx> ## fs/ext4/ext4.h ## @@ fs/ext4/ext4.h: enum { @@ fs/ext4/extents.c: ext4_force_split_extent_at(handle_t *handle, struct inode *in + flags); } - static int + /* @@ fs/ext4/extents.c: __read_extent_tree_block(const char *function, unsigned int line, - { struct buffer_head *bh; int err; -+ gfp_t gfp_flags = __GFP_MOVABLE | GFP_NOFS; + ext4_fsblk_t pblk; ++ gfp_t gfp_flags = __GFP_MOVABLE | GFP_NOFS; + + if (flags & EXT4_EX_NOFAIL) -+ gfp_flags |= __GFP_NOFAIL; ++ gfp_flags |= __GFP_NOFAIL; + pblk = ext4_idx_pblock(idx); - bh = sb_getblk_gfp(inode->i_sb, pblk, __GFP_MOVABLE | GFP_NOFS); + bh = sb_getblk_gfp(inode->i_sb, pblk, gfp_flags); if (unlikely(!bh)) --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.4.y | Success | Success |