diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-17 16:49:20 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:47 -0400 |
commit | 0dd6c08a0042ed83037cf5c772d9066e33046427 (patch) | |
tree | 9f29ab8ce7c2a5e44b5c1b706ff8fc3ff2dfd6c6 /fs/configfs | |
parent | 16d13b59b5b85ebc91de6c889716fa6e7766237f (diff) |
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>
Diffstat (limited to 'fs/configfs')
-rw-r--r-- | fs/configfs/dir.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 54c59a7e37ce..6c560e77965c 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -264,11 +264,13 @@ static int init_symlink(struct inode * inode) | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | static int create_dir(struct config_item * k, struct dentry * p, | 267 | static int create_dir(struct config_item *k, struct dentry *d) |
268 | struct dentry * d) | ||
269 | { | 268 | { |
270 | int error; | 269 | int error; |
271 | umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO; | 270 | umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO; |
271 | struct dentry *p = d->d_parent; | ||
272 | |||
273 | BUG_ON(!k); | ||
272 | 274 | ||
273 | error = configfs_dirent_exists(p->d_fsdata, d->d_name.name); | 275 | error = configfs_dirent_exists(p->d_fsdata, d->d_name.name); |
274 | if (!error) | 276 | if (!error) |
@@ -304,19 +306,7 @@ static int create_dir(struct config_item * k, struct dentry * p, | |||
304 | 306 | ||
305 | static int configfs_create_dir(struct config_item * item, struct dentry *dentry) | 307 | static int configfs_create_dir(struct config_item * item, struct dentry *dentry) |
306 | { | 308 | { |
307 | struct dentry * parent; | 309 | int error = create_dir(item, dentry); |
308 | int error = 0; | ||
309 | |||
310 | BUG_ON(!item); | ||
311 | |||
312 | if (item->ci_parent) | ||
313 | parent = item->ci_parent->ci_dentry; | ||
314 | else if (configfs_mount) | ||
315 | parent = configfs_mount->mnt_root; | ||
316 | else | ||
317 | return -EFAULT; | ||
318 | |||
319 | error = create_dir(item,parent,dentry); | ||
320 | if (!error) | 310 | if (!error) |
321 | item->ci_dentry = dentry; | 311 | item->ci_dentry = dentry; |
322 | return error; | 312 | return error; |