Commit 688f869c authored by Theodore Ts'o's avatar Theodore Ts'o

ext4: Initialize fsync transaction ids in ext4_new_inode()

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: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 198868f3
...@@ -1054,6 +1054,11 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode, ...@@ -1054,6 +1054,11 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode,
} }
} }
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); err = ext4_mark_inode_dirty(handle, inode);
if (err) { if (err) {
ext4_std_error(sb, err); ext4_std_error(sb, err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment