aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/ialloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/ialloc.c')
-rw-r--r--fs/ext2/ialloc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index f59741346760..66321a877e74 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -550,7 +550,7 @@ got:
550 550
551 sb->s_dirt = 1; 551 sb->s_dirt = 1;
552 mark_buffer_dirty(bh2); 552 mark_buffer_dirty(bh2);
553 inode->i_uid = current->fsuid; 553 inode->i_uid = current_fsuid();
554 if (test_opt (sb, GRPID)) 554 if (test_opt (sb, GRPID))
555 inode->i_gid = dir->i_gid; 555 inode->i_gid = dir->i_gid;
556 else if (dir->i_mode & S_ISGID) { 556 else if (dir->i_mode & S_ISGID) {
@@ -558,19 +558,15 @@ got:
558 if (S_ISDIR(mode)) 558 if (S_ISDIR(mode))
559 mode |= S_ISGID; 559 mode |= S_ISGID;
560 } else 560 } else
561 inode->i_gid = current->fsgid; 561 inode->i_gid = current_fsgid();
562 inode->i_mode = mode; 562 inode->i_mode = mode;
563 563
564 inode->i_ino = ino; 564 inode->i_ino = ino;
565 inode->i_blocks = 0; 565 inode->i_blocks = 0;
566 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; 566 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
567 memset(ei->i_data, 0, sizeof(ei->i_data)); 567 memset(ei->i_data, 0, sizeof(ei->i_data));
568 ei->i_flags = EXT2_I(dir)->i_flags & ~EXT2_BTREE_FL; 568 ei->i_flags =
569 if (S_ISLNK(mode)) 569 ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED);
570 ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL);
571 /* dirsync is only applied to directories */
572 if (!S_ISDIR(mode))
573 ei->i_flags &= ~EXT2_DIRSYNC_FL;
574 ei->i_faddr = 0; 570 ei->i_faddr = 0;
575 ei->i_frag_no = 0; 571 ei->i_frag_no = 0;
576 ei->i_frag_size = 0; 572 ei->i_frag_size = 0;
@@ -585,7 +581,10 @@ got:
585 spin_lock(&sbi->s_next_gen_lock); 581 spin_lock(&sbi->s_next_gen_lock);
586 inode->i_generation = sbi->s_next_generation++; 582 inode->i_generation = sbi->s_next_generation++;
587 spin_unlock(&sbi->s_next_gen_lock); 583 spin_unlock(&sbi->s_next_gen_lock);
588 insert_inode_hash(inode); 584 if (insert_inode_locked(inode) < 0) {
585 err = -EINVAL;
586 goto fail_drop;
587 }
589 588
590 if (DQUOT_ALLOC_INODE(inode)) { 589 if (DQUOT_ALLOC_INODE(inode)) {
591 err = -EDQUOT; 590 err = -EDQUOT;
@@ -612,6 +611,7 @@ fail_drop:
612 DQUOT_DROP(inode); 611 DQUOT_DROP(inode);
613 inode->i_flags |= S_NOQUOTA; 612 inode->i_flags |= S_NOQUOTA;
614 inode->i_nlink = 0; 613 inode->i_nlink = 0;
614 unlock_new_inode(inode);
615 iput(inode); 615 iput(inode);
616 return ERR_PTR(err); 616 return ERR_PTR(err);
617 617