Commit 5a37db30 authored by Al Viro's avatar Al Viro

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: default avatarIan Kent <raven@themaw.net>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 726a5e06
...@@ -539,18 +539,15 @@ static int autofs4_dir_symlink(struct inode *dir, ...@@ -539,18 +539,15 @@ static int autofs4_dir_symlink(struct inode *dir,
if (!autofs4_oz_mode(sbi)) if (!autofs4_oz_mode(sbi))
return -EACCES; return -EACCES;
ino = autofs4_init_ino(ino, sbi); BUG_ON(!ino);
if (!ino)
return -ENOMEM; autofs4_init_ino(ino, sbi);
autofs4_del_active(dentry); autofs4_del_active(dentry);
cp = kmalloc(size + 1, GFP_KERNEL); cp = kmalloc(size + 1, GFP_KERNEL);
if (!cp) { if (!cp)
if (!dentry->d_fsdata)
kfree(ino);
return -ENOMEM; return -ENOMEM;
}
strcpy(cp, symname); strcpy(cp, symname);
...@@ -565,8 +562,7 @@ static int autofs4_dir_symlink(struct inode *dir, ...@@ -565,8 +562,7 @@ static int autofs4_dir_symlink(struct inode *dir,
inode->i_size = size; inode->i_size = size;
d_add(dentry, inode); d_add(dentry, inode);
dentry->d_fsdata = ino; dget(dentry);
ino->dentry = dget(dentry);
atomic_inc(&ino->count); atomic_inc(&ino->count);
p_ino = autofs4_dentry_ino(dentry->d_parent); p_ino = autofs4_dentry_ino(dentry->d_parent);
if (p_ino && dentry->d_parent != dentry) 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,25 +730,21 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
DPRINTK("dentry %p, creating %.*s", DPRINTK("dentry %p, creating %.*s",
dentry, dentry->d_name.len, dentry->d_name.name); dentry, dentry->d_name.len, dentry->d_name.name);
ino = autofs4_init_ino(ino, sbi); BUG_ON(!ino);
if (!ino)
return -ENOMEM; autofs4_init_ino(ino, sbi);
autofs4_del_active(dentry); autofs4_del_active(dentry);
inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555); inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555);
if (!inode) { if (!inode)
if (!dentry->d_fsdata)
kfree(ino);
return -ENOMEM; return -ENOMEM;
}
d_add(dentry, inode); d_add(dentry, inode);
if (sbi->version < 5) if (sbi->version < 5)
autofs_set_leaf_automount_flags(dentry); autofs_set_leaf_automount_flags(dentry);
dentry->d_fsdata = ino; dget(dentry);
ino->dentry = dget(dentry);
atomic_inc(&ino->count); atomic_inc(&ino->count);
p_ino = autofs4_dentry_ino(dentry->d_parent); p_ino = autofs4_dentry_ino(dentry->d_parent);
if (p_ino && dentry->d_parent != dentry) if (p_ino && dentry->d_parent != dentry)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment