Commit e6946b9a authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3 ordering fix

Fix the order of inodes being marked dirty in a couple of corner cases.

The only impact of this bug is that the on-disk copies of i_version
might got out of sync for a directory, or that an error inserting an
inode into a directory might leave its i_nlinks incorrect on disk for a
short interval.  Neither problem will cause trouble for ext3 during
normal operation, but the nlink problem might cause e2fsck to emit
unnecessary warnings if we crash while the incorrect version of the
inode is in the journal.
parent 63959896
......@@ -514,8 +514,8 @@ static int ext3_create (struct inode * dir, struct dentry * dentry, int mode)
inode->i_mapping->a_ops = &ext3_writeback_aops;
else
inode->i_mapping->a_ops = &ext3_aops;
ext3_mark_inode_dirty(handle, inode);
err = ext3_add_nondir(handle, dentry, inode);
ext3_mark_inode_dirty(handle, inode);
}
ext3_journal_stop(handle, dir);
unlock_kernel();
......@@ -543,8 +543,8 @@ static int ext3_mknod (struct inode * dir, struct dentry *dentry,
err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
init_special_inode(inode, mode, rdev);
ext3_mark_inode_dirty(handle, inode);
err = ext3_add_nondir(handle, dentry, inode);
ext3_mark_inode_dirty(handle, inode);
}
ext3_journal_stop(handle, dir);
unlock_kernel();
......@@ -1006,8 +1006,8 @@ static int ext3_symlink (struct inode * dir,
inode->i_size = l-1;
}
EXT3_I(inode)->i_disksize = inode->i_size;
ext3_mark_inode_dirty(handle, inode);
err = ext3_add_nondir(handle, dentry, inode);
ext3_mark_inode_dirty(handle, inode);
out_stop:
ext3_journal_stop(handle, dir);
unlock_kernel();
......@@ -1046,8 +1046,8 @@ static int ext3_link (struct dentry * old_dentry,
ext3_inc_count(handle, inode);
atomic_inc(&inode->i_count);
ext3_mark_inode_dirty(handle, inode);
err = ext3_add_nondir(handle, dentry, inode);
ext3_mark_inode_dirty(handle, inode);
ext3_journal_stop(handle, dir);
unlock_kernel();
return 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