Skip to contentSkip to conversation

JBD2: round commit timer up to avoid uncommitted transaction

PATCH In review Andreas Dilger 3 participants 5 messages Jul 27, 2009 – Aug 11, 2009 Journalling layer for block devices (JBD2)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 JBD2: round commit timer up to avoid uncommitted transaction

jbd and jbd2 fixes: fix jiffie rounding in jbd commit timer setup code. Rounding down could cause the timer to be fired before the corresponding transaction has expired. That transaction can stay not committed forever if no new transaction is created or expicit sync/umount happens.

fs/jbd2/transaction.c +1 -1
Index: linux-2.6.27.21-0.1/fs/jbd2/transaction.c
===================================================================
@@ -54,7 +54,7 @@
 	INIT_LIST_HEAD(&transaction->t_inode_list);
 
 	/* Set up the commit timer for the new transaction. */
-	journal->j_commit_timer.expires = round_jiffies(transaction->t_expires);
+	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
 	add_timer(&journal->j_commit_timer);
 
 	J_ASSERT(journal->j_running_transaction == NULL);

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines

jbd and jbd2 fixes: fix jiffie rounding in jbd commit timer setup code. Rounding down could cause the timer to be fired before the corresponding transaction has expired. That transaction can stay not committed forever if no new transaction is created or expicit sync/umount happens.

Looks fine. You can add:

How about a similar JBD fix?

Honza

Quoted 24 lines

Index: linux-2.6.27.21-0.1/fs/jbd2/transaction.c
===================================================================

fs/jbd2/transaction.c +1 -1
@@ -54,7 +54,7 @@
 	INIT_LIST_HEAD(&transaction->t_inode_list);
 
 	/* Set up the commit timer for the new transaction. */
-	journal->j_commit_timer.expires = round_jiffies(transaction->t_expires);
+	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
 	add_timer(&journal->j_commit_timer);
 
 	J_ASSERT(journal->j_running_transaction == NULL);

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Jan Kara <[email protected]>
SuSE CR Labs
#2 lore raw
Quoted 11 lines · Jan Kara
Quoted 7 lines

jbd and jbd2 fixes: fix jiffie rounding in jbd commit timer setup code. Rounding down could cause the timer to be fired before the corresponding transaction has expired. That transaction can stay not committed forever if no new transaction is created or expicit sync/umount happens.

Looks fine. You can add:

How about a similar JBD fix?

fs/jbd/transaction.c +1 -1
Index: linux-2.6.27.21-0.1/fs/jbd/transaction.c
===================================================================
@@ -54,7 +54,7 @@
 	spin_lock_init(&transaction->t_inode_list);
 
 	/* Set up the commit timer for the new transaction. */
-	journal->j_commit_timer.expires = round_jiffies(transaction->t_expires);
+	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
 	add_timer(&journal->j_commit_timer);
 
 	J_ASSERT(journal->j_running_transaction == NULL);

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

#3 lore raw
Quoted 18 lines · Jan Kara
Quoted 11 lines
Quoted 7 lines

jbd and jbd2 fixes: fix jiffie rounding in jbd commit timer setup code. Rounding down could cause the timer to be fired before the corresponding transaction has expired. That transaction can stay not committed forever if no new transaction is created or expicit sync/umount happens.

Looks fine. You can add:

How about a similar JBD fix?

Index: linux-2.6.27.21-0.1/fs/jbd/transaction.c
===================================================================

fs/jbd/transaction.c line 60

Quoted 8 lines
fs/jbd/transaction.c +1 -1
@@ -54,7 +54,7 @@
 	spin_lock_init(&transaction->t_inode_list);
 
 	/* Set up the commit timer for the new transaction. */
-	journal->j_commit_timer.expires = round_jiffies(transaction->t_expires);
+	journal->j_commit_timer.expires = round_jiffies_up(transaction->t_expires);
 	add_timer(&journal->j_commit_timer);
 
 	J_ASSERT(journal->j_running_transaction == NULL);

Thanks. Copied over the changelog, added your Signed-off-by and merged
into my tree...

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SuSE CR Labs
maintainer
#4 lore raw
In reply to Andreas Dilger
Quoted 7 lines · Andreas Dilger

jbd and jbd2 fixes: fix jiffie rounding in jbd commit timer setup code. Rounding down could cause the timer to be fired before the corresponding transaction has expired. That transaction can stay not committed forever if no new transaction is created or expicit sync/umount happens.

Added to the ext4 patch queue; apologies for the delay.

- Ted