shithub: lwext4

Download patch

ref: c9e58fcc9ee0038c4ad97eb56f655b9e283bec7c
parent: 8c2fea16ee857319361994a2a7628d03a7c030d9
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Fri Dec 25 12:14:21 EST 2015

ext4: do not start new transaction if there is one in use.

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -558,7 +558,7 @@
 int ext4_trans_start(struct ext4_mountpoint *mp)
 {
 	int r = EOK;
-	if (mp->fs.jbd_journal) {
+	if (mp->fs.jbd_journal && !mp->fs.curr_trans) {
 		struct jbd_journal *journal = mp->fs.jbd_journal;
 		struct jbd_trans *trans;
 		trans = jbd_journal_new_trans(journal);
@@ -575,7 +575,7 @@
 int ext4_trans_stop(struct ext4_mountpoint *mp)
 {
 	int r = EOK;
-	if (mp->fs.jbd_journal) {
+	if (mp->fs.jbd_journal && mp->fs.curr_trans) {
 		struct jbd_journal *journal = mp->fs.jbd_journal;
 		struct jbd_trans *trans = mp->fs.curr_trans;
 		r = jbd_journal_commit_trans(journal, trans);
@@ -587,7 +587,7 @@
 int ext4_trans_abort(struct ext4_mountpoint *mp)
 {
 	int r = EOK;
-	if (mp->fs.jbd_journal) {
+	if (mp->fs.jbd_journal && mp->fs.curr_trans) {
 		struct jbd_journal *journal = mp->fs.jbd_journal;
 		struct jbd_trans *trans = mp->fs.curr_trans;
 		r = jbd_journal_commit_trans(journal, trans);