mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
ext4: prevent sleeping allocation in NOWAIT write path
Block allocation requires journal access which may sleep, violating NOWAIT semantics. Return -EAGAIN early when IOMAP_NOWAIT is set, allowing the caller to retry without the NOWAIT constraint. This ensures that write paths using IOMAP_NOWAIT (e.g., DIO with RWF_NOWAIT) will not block on journal operations when blocks need to be allocated. Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://sashiko.dev/#/patchset/20260611163441.2431805-1-libaokun@linux.alibaba.com?part=1 Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Baokun Li <libaokun@linux.alibaba.com> Link: https://patch.msgid.link/20260629113827.4074335-2-libaokun@linux.alibaba.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
91949729be
commit
07d62890ef
|
|
@ -3687,6 +3687,9 @@ static int ext4_iomap_alloc(struct inode *inode, struct ext4_map_blocks *map,
|
|||
int ret, dio_credits, m_flags = 0, retries = 0;
|
||||
bool force_commit = false;
|
||||
|
||||
if (flags & IOMAP_NOWAIT)
|
||||
return -EAGAIN;
|
||||
|
||||
/*
|
||||
* Trim the mapping request to the maximum value that we can map at
|
||||
* once for direct I/O.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user