aboutsummaryrefslogtreecommitdiffstats
path: root/fs/autofs4
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-01-16 18:29:35 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-01-18 01:21:28 -0500
commit5a37db302e698a83209eff22ca8f3fd05eb1d84b (patch)
tree0ffef4412676c8b1814a2965b150168fcb9cfb03 /fs/autofs4
parent726a5e0688fd344110d8f2979d87f243a4ba1a48 (diff)
autofs4: mkdir and symlink always get a dentry that had passed lookup
... so ->d_fsdata will have been set up before we get there Acked-by: Ian Kent <raven@themaw.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs4')
-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)