Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4cdeed861b5f797b3fa661eb331a6bd6ad669c6a
Commit:     4cdeed861b5f797b3fa661eb331a6bd6ad669c6a
Parent:     b73fce69ecb091a178ef9286027c370a63eb25aa
Author:     Aneesh Kumar K.V <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 22 06:17:31 2008 -0500
Committer:  Theodore Ts'o <[EMAIL PROTECTED]>
CommitDate: Fri Feb 22 06:17:31 2008 -0500

    ext4: Don't leave behind a half-created inode if ext4_mkdir() fails
    
    If ext4_mkdir() fails to allocate the initial block for the directory,
    don't leave behind a half-created directory inode with the link count
    left at one.  This was caused by an inappropriate call to ext4_dec_count().
    
    Signed-off-by: Aneesh Kumar K.V <[EMAIL PROTECTED]>
    Signed-off-by: Mingming Cao <[EMAIL PROTECTED]>
    Signed-off-by: "Theodore Ts'o" <[EMAIL PROTECTED]>
---
 fs/ext4/namei.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index a9347fb..fffd080 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1804,12 +1804,8 @@ retry:
        inode->i_fop = &ext4_dir_operations;
        inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize;
        dir_block = ext4_bread (handle, inode, 0, 1, &err);
-       if (!dir_block) {
-               ext4_dec_count(handle, inode); /* is this nlink == 0? */
-               ext4_mark_inode_dirty(handle, inode);
-               iput (inode);
-               goto out_stop;
-       }
+       if (!dir_block)
+               goto out_clear_inode;
        BUFFER_TRACE(dir_block, "get_write_access");
        ext4_journal_get_write_access(handle, dir_block);
        de = (struct ext4_dir_entry_2 *) dir_block->b_data;
@@ -1832,7 +1828,8 @@ retry:
        ext4_mark_inode_dirty(handle, inode);
        err = ext4_add_entry (handle, dentry, inode);
        if (err) {
-               inode->i_nlink = 0;
+out_clear_inode:
+               clear_nlink(inode);
                ext4_mark_inode_dirty(handle, inode);
                iput (inode);
                goto out_stop;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to