ext4: Call ext4_journal_stop(handle) only once in ext4_dio_write_iter()
Subsystems (2)
PATCH 1/1 ext4: Call ext4_journal_stop(handle) only once in ext4_dio_write_iter()
From: Markus Elfring <[email protected]>
Date: Wed, 25 Sep 2024 21:47:39 +0200
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.
--- fs/ext4/file.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/ext4/file.c +2 -5
@@ -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)
--
2.46.1
Quoted 10 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 25 Sep 2024 21:47:39 +0200An
ext4_journal_stop(handle)call was immediately used after a return value check for aext4_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]>
Looks good to me.
Quoted 27 lines
--- fs/ext4/file.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/ext4/file.c +2
-6@@ -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) --2.46.1
Quoted 10 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 25 Sep 2024 21:47:39 +0200An
ext4_journal_stop(handle)call was immediately used after a return value check for aext4_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]>
Looks good. Feel free to add:
Honza
Quoted 26 lines
--- fs/ext4/file.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)fs/ext4/file.c +2
-6@@ -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) --2.46.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Quoted 8 lines · Markus Elfring
An
ext4_journal_stop(handle)call was immediately used after a return value check for aext4_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.
[...]
Applied, thanks!
[1/1] ext4: Call ext4_journal_stop(handle) only once in ext4_dio_write_iter()
commit: d431a2cd28e8b7a91474d496e9226ef06a31c6eb
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>