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>

Al Viro 5a37db30 726a5e06

+10 -18
+10 -18
fs/autofs4/root.c
··· 539 539 if (!autofs4_oz_mode(sbi)) 540 540 return -EACCES; 541 541 542 - ino = autofs4_init_ino(ino, sbi); 543 - if (!ino) 544 - return -ENOMEM; 542 + BUG_ON(!ino); 543 + 544 + autofs4_init_ino(ino, sbi); 545 545 546 546 autofs4_del_active(dentry); 547 547 548 548 cp = kmalloc(size + 1, GFP_KERNEL); 549 - if (!cp) { 550 - if (!dentry->d_fsdata) 551 - kfree(ino); 549 + if (!cp) 552 550 return -ENOMEM; 553 - } 554 551 555 552 strcpy(cp, symname); 556 553 ··· 562 565 inode->i_size = size; 563 566 d_add(dentry, inode); 564 567 565 - dentry->d_fsdata = ino; 566 - ino->dentry = dget(dentry); 568 + dget(dentry); 567 569 atomic_inc(&ino->count); 568 570 p_ino = autofs4_dentry_ino(dentry->d_parent); 569 571 if (p_ino && dentry->d_parent != dentry) ··· 730 734 DPRINTK("dentry %p, creating %.*s", 731 735 dentry, dentry->d_name.len, dentry->d_name.name); 732 736 733 - ino = autofs4_init_ino(ino, sbi); 734 - if (!ino) 735 - return -ENOMEM; 737 + BUG_ON(!ino); 738 + 739 + autofs4_init_ino(ino, sbi); 736 740 737 741 autofs4_del_active(dentry); 738 742 739 743 inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555); 740 - if (!inode) { 741 - if (!dentry->d_fsdata) 742 - kfree(ino); 744 + if (!inode) 743 745 return -ENOMEM; 744 - } 745 746 d_add(dentry, inode); 746 747 747 748 if (sbi->version < 5) 748 749 autofs_set_leaf_automount_flags(dentry); 749 750 750 - dentry->d_fsdata = ino; 751 - ino->dentry = dget(dentry); 751 + dget(dentry); 752 752 atomic_inc(&ino->count); 753 753 p_ino = autofs4_dentry_ino(dentry->d_parent); 754 754 if (p_ino && dentry->d_parent != dentry)