aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/autofs4/root.c')
-rw-r--r--fs/autofs4/root.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 83e5379c5ade..a5b93e8f49b5 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -539,18 +539,15 @@ static int autofs4_dir_symlink(struct inode *dir,
539 if (!autofs4_oz_mode(sbi)) 539 if (!autofs4_oz_mode(sbi))
540 return -EACCES; 540 return -EACCES;
541 541
542 ino = autofs4_init_ino(ino, sbi); 542 BUG_ON(!ino);
543 if (!ino) 543
544 return -ENOMEM; 544 autofs4_init_ino(ino, sbi);
545 545
546 autofs4_del_active(dentry); 546 autofs4_del_active(dentry);
547 547
548 cp = kmalloc(size + 1, GFP_KERNEL); 548 cp = kmalloc(size + 1, GFP_KERNEL);
549 if (!cp) { 549 if (!cp)
550 if (!dentry->d_fsdata)
551 kfree(ino);
552 return -ENOMEM; 550 return -ENOMEM;
553 }
554 551
555 strcpy(cp, symname); 552 strcpy(cp, symname);
556 553
@@ -565,8 +562,7 @@ static int autofs4_dir_symlink(struct inode *dir,
565 inode->i_size = size; 562 inode->i_size = size;
566 d_add(dentry, inode); 563 d_add(dentry, inode);
567 564
568 dentry->d_fsdata = ino; 565 dget(dentry);
569 ino->dentry = dget(dentry);
570 atomic_inc(&ino->count); 566 atomic_inc(&ino->count);
571 p_ino = autofs4_dentry_ino(dentry->d_parent); 567 p_ino = autofs4_dentry_ino(dentry->d_parent);
572 if (p_ino && dentry->d_parent != dentry) 568 if (p_ino && dentry->d_parent != dentry)
@@ -734,25 +730,21 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
734 DPRINTK("dentry %p, creating %.*s", 730 DPRINTK("dentry %p, creating %.*s",
735 dentry, dentry->d_name.len, dentry->d_name.name); 731 dentry, dentry->d_name.len, dentry->d_name.name);
736 732
737 ino = autofs4_init_ino(ino, sbi); 733 BUG_ON(!ino);
738 if (!ino) 734
739 return -ENOMEM; 735 autofs4_init_ino(ino, sbi);
740 736
741 autofs4_del_active(dentry); 737 autofs4_del_active(dentry);
742 738
743 inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555); 739 inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555);
744 if (!inode) { 740 if (!inode)
745 if (!dentry->d_fsdata)
746 kfree(ino);
747 return -ENOMEM; 741 return -ENOMEM;
748 }
749 d_add(dentry, inode); 742 d_add(dentry, inode);
750 743
751 if (sbi->version < 5) 744 if (sbi->version < 5)
752 autofs_set_leaf_automount_flags(dentry); 745 autofs_set_leaf_automount_flags(dentry);
753 746
754 dentry->d_fsdata = ino; 747 dget(dentry);
755 ino->dentry = dget(dentry);
756 atomic_inc(&ino->count); 748 atomic_inc(&ino->count);
757 p_ino = autofs4_dentry_ino(dentry->d_parent); 749 p_ino = autofs4_dentry_ino(dentry->d_parent);
758 if (p_ino && dentry->d_parent != dentry) 750 if (p_ino && dentry->d_parent != dentry)