Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 229078
b: refs/heads/master
c: 2b543ed
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Jan Kara committed Jan 6, 2011
1 parent b8468ce commit 7271925
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99fbb1e2af5da27d3ee75c2e421712fe9d083fb6
refs/heads/master: 2b543edae2d9161ae8dda1d85cbd28ef8a166cc0
36 changes: 22 additions & 14 deletions trunk/fs/ext3/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,7 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
{
handle_t *handle;
struct inode * inode;
struct buffer_head * dir_block;
struct buffer_head * dir_block = NULL;
struct ext3_dir_entry_2 * de;
int err, retries = 0;

Expand Down Expand Up @@ -1790,15 +1790,14 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
inode->i_fop = &ext3_dir_operations;
inode->i_size = EXT3_I(inode)->i_disksize = inode->i_sb->s_blocksize;
dir_block = ext3_bread (handle, inode, 0, 1, &err);
if (!dir_block) {
drop_nlink(inode); /* is this nlink == 0? */
unlock_new_inode(inode);
ext3_mark_inode_dirty(handle, inode);
iput (inode);
goto out_stop;
}
if (!dir_block)
goto out_clear_inode;

BUFFER_TRACE(dir_block, "get_write_access");
ext3_journal_get_write_access(handle, dir_block);
err = ext3_journal_get_write_access(handle, dir_block);
if (err)
goto out_clear_inode;

de = (struct ext3_dir_entry_2 *) dir_block->b_data;
de->inode = cpu_to_le32(inode->i_ino);
de->name_len = 1;
Expand All @@ -1814,11 +1813,16 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
ext3_set_de_type(dir->i_sb, de, S_IFDIR);
inode->i_nlink = 2;
BUFFER_TRACE(dir_block, "call ext3_journal_dirty_metadata");
ext3_journal_dirty_metadata(handle, dir_block);
brelse (dir_block);
ext3_mark_inode_dirty(handle, inode);
err = ext3_add_entry (handle, dentry, inode);
err = ext3_journal_dirty_metadata(handle, dir_block);
if (err)
goto out_clear_inode;

err = ext3_mark_inode_dirty(handle, inode);
if (!err)
err = ext3_add_entry (handle, dentry, inode);

if (err) {
out_clear_inode:
inode->i_nlink = 0;
unlock_new_inode(inode);
ext3_mark_inode_dirty(handle, inode);
Expand All @@ -1827,10 +1831,14 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode)
}
inc_nlink(dir);
ext3_update_dx_flag(dir);
ext3_mark_inode_dirty(handle, dir);
err = ext3_mark_inode_dirty(handle, dir);
if (err)
goto out_clear_inode;

d_instantiate(dentry, inode);
unlock_new_inode(inode);
out_stop:
brelse(dir_block);
ext3_journal_stop(handle);
if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
goto retry;
Expand Down

0 comments on commit 7271925

Please sign in to comment.