diff options
Diffstat (limited to 'fs/configfs')
| -rw-r--r-- | fs/configfs/configfs_internal.h | 4 | ||||
| -rw-r--r-- | fs/configfs/dir.c | 24 | ||||
| -rw-r--r-- | fs/configfs/inode.c | 8 |
3 files changed, 16 insertions, 20 deletions
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index da6061a6df40..026cf68553a4 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h | |||
| @@ -120,7 +120,7 @@ static inline struct config_item *configfs_get_config_item(struct dentry *dentry | |||
| 120 | { | 120 | { |
| 121 | struct config_item * item = NULL; | 121 | struct config_item * item = NULL; |
| 122 | 122 | ||
| 123 | spin_lock(&dcache_lock); | 123 | spin_lock(&dentry->d_lock); |
| 124 | if (!d_unhashed(dentry)) { | 124 | if (!d_unhashed(dentry)) { |
| 125 | struct configfs_dirent * sd = dentry->d_fsdata; | 125 | struct configfs_dirent * sd = dentry->d_fsdata; |
| 126 | if (sd->s_type & CONFIGFS_ITEM_LINK) { | 126 | if (sd->s_type & CONFIGFS_ITEM_LINK) { |
| @@ -129,7 +129,7 @@ static inline struct config_item *configfs_get_config_item(struct dentry *dentry | |||
| 129 | } else | 129 | } else |
| 130 | item = config_item_get(sd->s_element); | 130 | item = config_item_get(sd->s_element); |
| 131 | } | 131 | } |
| 132 | spin_unlock(&dcache_lock); | 132 | spin_unlock(&dentry->d_lock); |
| 133 | 133 | ||
| 134 | return item; | 134 | return item; |
| 135 | } | 135 | } |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 0b502f80c691..36637a8c1ed3 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
| @@ -67,7 +67,7 @@ static void configfs_d_iput(struct dentry * dentry, | |||
| 67 | * We _must_ delete our dentries on last dput, as the chain-to-parent | 67 | * We _must_ delete our dentries on last dput, as the chain-to-parent |
| 68 | * behavior is required to clear the parents of default_groups. | 68 | * behavior is required to clear the parents of default_groups. |
| 69 | */ | 69 | */ |
| 70 | static int configfs_d_delete(struct dentry *dentry) | 70 | static int configfs_d_delete(const struct dentry *dentry) |
| 71 | { | 71 | { |
| 72 | return 1; | 72 | return 1; |
| 73 | } | 73 | } |
| @@ -232,10 +232,8 @@ int configfs_make_dirent(struct configfs_dirent * parent_sd, | |||
| 232 | 232 | ||
| 233 | sd->s_mode = mode; | 233 | sd->s_mode = mode; |
| 234 | sd->s_dentry = dentry; | 234 | sd->s_dentry = dentry; |
| 235 | if (dentry) { | 235 | if (dentry) |
| 236 | dentry->d_fsdata = configfs_get(sd); | 236 | dentry->d_fsdata = configfs_get(sd); |
| 237 | dentry->d_op = &configfs_dentry_ops; | ||
| 238 | } | ||
| 239 | 237 | ||
| 240 | return 0; | 238 | return 0; |
| 241 | } | 239 | } |
| @@ -278,7 +276,6 @@ static int create_dir(struct config_item * k, struct dentry * p, | |||
| 278 | error = configfs_create(d, mode, init_dir); | 276 | error = configfs_create(d, mode, init_dir); |
| 279 | if (!error) { | 277 | if (!error) { |
| 280 | inc_nlink(p->d_inode); | 278 | inc_nlink(p->d_inode); |
| 281 | (d)->d_op = &configfs_dentry_ops; | ||
| 282 | } else { | 279 | } else { |
| 283 | struct configfs_dirent *sd = d->d_fsdata; | 280 | struct configfs_dirent *sd = d->d_fsdata; |
| 284 | if (sd) { | 281 | if (sd) { |
| @@ -371,9 +368,7 @@ int configfs_create_link(struct configfs_symlink *sl, | |||
| 371 | CONFIGFS_ITEM_LINK); | 368 | CONFIGFS_ITEM_LINK); |
| 372 | if (!err) { | 369 | if (!err) { |
| 373 | err = configfs_create(dentry, mode, init_symlink); | 370 | err = configfs_create(dentry, mode, init_symlink); |
| 374 | if (!err) | 371 | if (err) { |
| 375 | dentry->d_op = &configfs_dentry_ops; | ||
| 376 | else { | ||
| 377 | struct configfs_dirent *sd = dentry->d_fsdata; | 372 | struct configfs_dirent *sd = dentry->d_fsdata; |
| 378 | if (sd) { | 373 | if (sd) { |
| 379 | spin_lock(&configfs_dirent_lock); | 374 | spin_lock(&configfs_dirent_lock); |
| @@ -399,8 +394,7 @@ static void remove_dir(struct dentry * d) | |||
| 399 | if (d->d_inode) | 394 | if (d->d_inode) |
| 400 | simple_rmdir(parent->d_inode,d); | 395 | simple_rmdir(parent->d_inode,d); |
| 401 | 396 | ||
| 402 | pr_debug(" o %s removing done (%d)\n",d->d_name.name, | 397 | pr_debug(" o %s removing done (%d)\n",d->d_name.name, d->d_count); |
| 403 | atomic_read(&d->d_count)); | ||
| 404 | 398 | ||
| 405 | dput(parent); | 399 | dput(parent); |
| 406 | } | 400 | } |
| @@ -448,7 +442,7 @@ static int configfs_attach_attr(struct configfs_dirent * sd, struct dentry * den | |||
| 448 | return error; | 442 | return error; |
| 449 | } | 443 | } |
| 450 | 444 | ||
| 451 | dentry->d_op = &configfs_dentry_ops; | 445 | d_set_d_op(dentry, &configfs_dentry_ops); |
| 452 | d_rehash(dentry); | 446 | d_rehash(dentry); |
| 453 | 447 | ||
| 454 | return 0; | 448 | return 0; |
| @@ -493,7 +487,11 @@ static struct dentry * configfs_lookup(struct inode *dir, | |||
| 493 | * If it doesn't exist and it isn't a NOT_PINNED item, | 487 | * If it doesn't exist and it isn't a NOT_PINNED item, |
| 494 | * it must be negative. | 488 | * it must be negative. |
| 495 | */ | 489 | */ |
| 496 | return simple_lookup(dir, dentry, nd); | 490 | if (dentry->d_name.len > NAME_MAX) |
| 491 | return ERR_PTR(-ENAMETOOLONG); | ||
| 492 | d_set_d_op(dentry, &configfs_dentry_ops); | ||
| 493 | d_add(dentry, NULL); | ||
| 494 | return NULL; | ||
| 497 | } | 495 | } |
| 498 | 496 | ||
| 499 | out: | 497 | out: |
| @@ -685,6 +683,7 @@ static int create_default_group(struct config_group *parent_group, | |||
| 685 | ret = -ENOMEM; | 683 | ret = -ENOMEM; |
| 686 | child = d_alloc(parent, &name); | 684 | child = d_alloc(parent, &name); |
| 687 | if (child) { | 685 | if (child) { |
| 686 | d_set_d_op(child, &configfs_dentry_ops); | ||
| 688 | d_add(child, NULL); | 687 | d_add(child, NULL); |
| 689 | 688 | ||
| 690 | ret = configfs_attach_group(&parent_group->cg_item, | 689 | ret = configfs_attach_group(&parent_group->cg_item, |
| @@ -1682,6 +1681,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
| 1682 | err = -ENOMEM; | 1681 | err = -ENOMEM; |
| 1683 | dentry = d_alloc(configfs_sb->s_root, &name); | 1682 | dentry = d_alloc(configfs_sb->s_root, &name); |
| 1684 | if (dentry) { | 1683 | if (dentry) { |
| 1684 | d_set_d_op(dentry, &configfs_dentry_ops); | ||
| 1685 | d_add(dentry, NULL); | 1685 | d_add(dentry, NULL); |
| 1686 | 1686 | ||
| 1687 | err = configfs_attach_group(sd->s_element, &group->cg_item, | 1687 | err = configfs_attach_group(sd->s_element, &group->cg_item, |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 253476d78ed8..c83f4768eeaa 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
| @@ -250,18 +250,14 @@ void configfs_drop_dentry(struct configfs_dirent * sd, struct dentry * parent) | |||
| 250 | struct dentry * dentry = sd->s_dentry; | 250 | struct dentry * dentry = sd->s_dentry; |
| 251 | 251 | ||
| 252 | if (dentry) { | 252 | if (dentry) { |
| 253 | spin_lock(&dcache_lock); | ||
| 254 | spin_lock(&dentry->d_lock); | 253 | spin_lock(&dentry->d_lock); |
| 255 | if (!(d_unhashed(dentry) && dentry->d_inode)) { | 254 | if (!(d_unhashed(dentry) && dentry->d_inode)) { |
| 256 | dget_locked(dentry); | 255 | dget_dlock(dentry); |
| 257 | __d_drop(dentry); | 256 | __d_drop(dentry); |
| 258 | spin_unlock(&dentry->d_lock); | 257 | spin_unlock(&dentry->d_lock); |
| 259 | spin_unlock(&dcache_lock); | ||
| 260 | simple_unlink(parent->d_inode, dentry); | 258 | simple_unlink(parent->d_inode, dentry); |
| 261 | } else { | 259 | } else |
| 262 | spin_unlock(&dentry->d_lock); | 260 | spin_unlock(&dentry->d_lock); |
| 263 | spin_unlock(&dcache_lock); | ||
| 264 | } | ||
| 265 | } | 261 | } |
| 266 | } | 262 | } |
| 267 | 263 | ||
