Commit 0dd6c08a0042ed83037cf5c772d9066e33046427

Authored by Al Viro
1 parent 16d13b59b5

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>

Showing 1 changed file with 5 additions and 15 deletions Side-by-side Diff

... ... @@ -264,12 +264,14 @@
264 264 return 0;
265 265 }
266 266  
267   -static int create_dir(struct config_item * k, struct dentry * p,
268   - struct dentry * d)
  267 +static int create_dir(struct config_item *k, struct dentry *d)
269 268 {
270 269 int error;
271 270 umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
  271 + struct dentry *p = d->d_parent;
272 272  
  273 + BUG_ON(!k);
  274 +
273 275 error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
274 276 if (!error)
275 277 error = configfs_make_dirent(p->d_fsdata, d, k, mode,
... ... @@ -304,19 +306,7 @@
304 306  
305 307 static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
306 308 {
307   - struct dentry * parent;
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);
  309 + int error = create_dir(item, dentry);
320 310 if (!error)
321 311 item->ci_dentry = dentry;
322 312 return error;