FAILED: patch "[PATCH] ext4: check iomap type only if ext4_iomap_begin() does not" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-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 <[email protected]>.
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.4.y
git checkout FETCH_HEAD
git cherry-pick -x fa83c34e3e56b3c672af38059e066242655271b1
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023051519-quarters-shrank-0a63@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
fa83c34e3e56 ("ext4: check iomap type only if ext4_iomap_begin() does not fail") 8cd115bdda17 ("ext4: Optimize ext4 DIO overwrites")aa9714d0e397 ("ext4: Start with shared i_rwsem in case of DIO instead of exclusive") 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure") 0b9f230b94dd ("ext4: move inode extension check out from ext4_iomap_alloc()") 569342dc2485 ("ext4: move inode extension/truncate code out from ->iomap_end() callback") b1b4705d54ab ("ext4: introduce direct I/O read using iomap infrastructure") 09edf4d38195 ("ext4: introduce new callback for IOMAP_REPORT")f063db5ee989 ("ext4: split IOMAP_WRITE branch in ext4_iomap_begin() into helper") c8fdfe294187 ("ext4: move set iomap routines into a separate helper ext4_set_iomap()") 2e9b51d78229 ("ext4: iomap that extends beyond EOF should be marked dirty") 548feebec7e9 ("ext4: update direct I/O read lock pattern for IOCB_NOWAIT") 53e5cca56795 ("ext4: reorder map.m_flags checks within ext4_iomap_begin()") c8cc88163f40 ("ext4: Add support for blocksize < pagesize in dioread_nolock") 2943fdbc688e ("ext4: Refactor mpage_map_and_submit_buffers function") a00713ea982b ("ext4: Add API to bring in support for unwritten io_end_vec conversion") 821ff38d192a ("ext4: keep uniform naming convention for io & io_end variables")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From fa83c34e3e56b3c672af38059e066242655271b1 Mon Sep 17 00:00:00 2001
From: Baokun Li <[email protected]>
Date: Fri, 5 May 2023 21:24:29 +0800
Subject: [PATCH] ext4: check iomap type only if ext4_iomap_begin() does not
fail
When ext4_iomap_overwrite_begin() calls ext4_iomap_begin() map blocks may fail for some reason (e.g. memory allocation failure, bare disk write), and later because "iomap->type ! = IOMAP_MAPPED" triggers WARN_ON(). When ext4 iomap_begin() returns an error, it is normal that the type of iomap->type may not match the expectation. Therefore, we only determine if iomap->type is as expected when ext4_iomap_begin() is executed successfully.
fs/ext4/inode.c +1 -1
@@ -3377,7 +3377,7 @@ static int ext4_iomap_overwrite_begin(struct inode *inode, loff_t offset,*/ flags &= ~IOMAP_WRITE ; ret =ext4_iomap_begin (inode, offset, length, flags, iomap, srcmap); -WARN_ON_ONCE (iomap->type !=IOMAP_MAPPED ); +WARN_ON_ONCE (!ret && iomap->type !=IOMAP_MAPPED );return ret; }