]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ext4: Initialize fsync transaction ids in ext4_new_inode()
authorTheodore Ts'o <tytso@mit.edu>
Wed, 16 Mar 2011 21:16:31 +0000 (17:16 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 16 Mar 2011 21:16:31 +0000 (17:16 -0400)
When allocating a new inode, we need to make sure i_sync_tid and
i_datasync_tid are initialized.  Otherwise, one or both of these two
values could be left initialized to zero, which could potentially
result in BUG_ON in jbd2_journal_commit_transaction.

(This could happen by having journal->commit_request getting set to
zero, which could wake up the kjournald process even though there is
no running transaction, which then causes a BUG_ON via the
J_ASSERT(j_ruinning_transaction != NULL) statement.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ialloc.c

index 2fd3b0e41787a198f3a01da0cd53259752f429b0..a679a482c986e8e03af30ed0575ad94727e5b82c 100644 (file)
@@ -1054,6 +1054,11 @@ got:
                }
        }
 
+       if (ext4_handle_valid(handle)) {
+               ei->i_sync_tid = handle->h_transaction->t_tid;
+               ei->i_datasync_tid = handle->h_transaction->t_tid;
+       }
+
        err = ext4_mark_inode_dirty(handle, inode);
        if (err) {
                ext4_std_error(sb, err);