configfs: configfs_create_dir() has parent dentry in dentry->d_parent

no need to play sick games with parent item, internal mount, etc.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2012-03-17 16:49:20 -04:00
parent 16d13b59b5
commit 0dd6c08a00

View file

@ -264,11 +264,13 @@ static int init_symlink(struct inode * inode)
return 0; return 0;
} }
static int create_dir(struct config_item * k, struct dentry * p, static int create_dir(struct config_item *k, struct dentry *d)
struct dentry * d)
{ {
int error; int error;
umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO; umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
struct dentry *p = d->d_parent;
BUG_ON(!k);
error = configfs_dirent_exists(p->d_fsdata, d->d_name.name); error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
if (!error) if (!error)
@ -304,19 +306,7 @@ static int create_dir(struct config_item * k, struct dentry * p,
static int configfs_create_dir(struct config_item * item, struct dentry *dentry) static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
{ {
struct dentry * parent; int error = create_dir(item, dentry);
int error = 0;
BUG_ON(!item);
if (item->ci_parent)
parent = item->ci_parent->ci_dentry;
else if (configfs_mount)
parent = configfs_mount->mnt_root;
else
return -EFAULT;
error = create_dir(item,parent,dentry);
if (!error) if (!error)
item->ci_dentry = dentry; item->ci_dentry = dentry;
return error; return error;