aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Elfring <[email protected]>2024-09-25 21:47:39 +0200
committerTheodore Ts'o <[email protected]>2024-10-30 17:42:44 -0400
commitd431a2cd28e8b7a91474d496e9226ef06a31c6eb (patch)
tree33835699b3c0b2b02bd9366875fa319b9725c091
parent42f7652d3eb527d03665b09edac47f85fb600924 (diff)
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 <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
-rw-r--r--fs/ext4/file.c7
1 files changed, 2 insertions, 5 deletions
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)