From: Markus Elfring Date: Wed, 25 Sep 2024 19:47:39 +0000 (+0200) Subject: ext4: Call ext4_journal_stop(handle) only once in ext4_dio_write_iter() X-Git-Tag: v6.13-rc1~214^2~32 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d431a2cd28e8b7a91474d496e9226ef06a31c6eb;p=linux-block.git ext4: Call ext4_journal_stop(handle) only once in ext4_dio_write_iter() An ext4_journal_stop(handle) call was immediately used after a return value check for a ext4_orphan_add() call in this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Zhang Yi Reviewed-by: Jan Kara Link: https://patch.msgid.link/cf895072-43cf-412c-bced-8268498ad13e@web.de Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/file.c b/fs/ext4/file.c index f14aed14b9cf..23005f1345a8 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -564,12 +564,9 @@ static ssize_t ext4_dio_write_iter(struct kiocb *iocb, struct iov_iter *from) } ret = ext4_orphan_add(handle, inode); - if (ret) { - ext4_journal_stop(handle); - goto out; - } - ext4_journal_stop(handle); + if (ret) + goto out; } if (ilock_shared && !unwritten)