diff options
| -rw-r--r-- | fs/namei.c | 37 | ||||
| -rw-r--r-- | include/linux/list_bl.h | 2 | ||||
| -rw-r--r-- | kernel/cgroup.c | 2 |
3 files changed, 21 insertions, 20 deletions
diff --git a/fs/namei.c b/fs/namei.c index 86643302079e..8df7a78ace58 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -779,7 +779,8 @@ static void path_put_conditional(struct path *path, struct nameidata *nd) | |||
| 779 | mntput(path->mnt); | 779 | mntput(path->mnt); |
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | static inline void path_to_nameidata(struct path *path, struct nameidata *nd) | 782 | static inline void path_to_nameidata(const struct path *path, |
| 783 | struct nameidata *nd) | ||
| 783 | { | 784 | { |
| 784 | if (!(nd->flags & LOOKUP_RCU)) { | 785 | if (!(nd->flags & LOOKUP_RCU)) { |
| 785 | dput(nd->path.dentry); | 786 | dput(nd->path.dentry); |
| @@ -791,20 +792,20 @@ static inline void path_to_nameidata(struct path *path, struct nameidata *nd) | |||
| 791 | } | 792 | } |
| 792 | 793 | ||
| 793 | static __always_inline int | 794 | static __always_inline int |
| 794 | __do_follow_link(struct path *path, struct nameidata *nd, void **p) | 795 | __do_follow_link(const struct path *link, struct nameidata *nd, void **p) |
| 795 | { | 796 | { |
| 796 | int error; | 797 | int error; |
| 797 | struct dentry *dentry = path->dentry; | 798 | struct dentry *dentry = link->dentry; |
| 798 | 799 | ||
| 799 | touch_atime(path->mnt, dentry); | 800 | touch_atime(link->mnt, dentry); |
| 800 | nd_set_link(nd, NULL); | 801 | nd_set_link(nd, NULL); |
| 801 | 802 | ||
| 802 | if (path->mnt != nd->path.mnt) { | 803 | if (link->mnt != nd->path.mnt) { |
| 803 | path_to_nameidata(path, nd); | 804 | path_to_nameidata(link, nd); |
| 804 | nd->inode = nd->path.dentry->d_inode; | 805 | nd->inode = nd->path.dentry->d_inode; |
| 805 | dget(dentry); | 806 | dget(dentry); |
| 806 | } | 807 | } |
| 807 | mntget(path->mnt); | 808 | mntget(link->mnt); |
| 808 | 809 | ||
| 809 | nd->last_type = LAST_BIND; | 810 | nd->last_type = LAST_BIND; |
| 810 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); | 811 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); |
| @@ -2348,11 +2349,12 @@ reval: | |||
| 2348 | nd.flags = flags; | 2349 | nd.flags = flags; |
| 2349 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 2350 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); |
| 2350 | while (unlikely(!filp)) { /* trailing symlink */ | 2351 | while (unlikely(!filp)) { /* trailing symlink */ |
| 2351 | struct path holder; | 2352 | struct path link = path; |
| 2353 | struct inode *linki = link.dentry->d_inode; | ||
| 2352 | void *cookie; | 2354 | void *cookie; |
| 2353 | error = -ELOOP; | 2355 | error = -ELOOP; |
| 2354 | /* S_ISDIR part is a temporary automount kludge */ | 2356 | /* S_ISDIR part is a temporary automount kludge */ |
| 2355 | if (!(nd.flags & LOOKUP_FOLLOW) && !S_ISDIR(nd.inode->i_mode)) | 2357 | if (!(nd.flags & LOOKUP_FOLLOW) && !S_ISDIR(linki->i_mode)) |
| 2356 | goto exit_dput; | 2358 | goto exit_dput; |
| 2357 | if (count++ == 32) | 2359 | if (count++ == 32) |
| 2358 | goto exit_dput; | 2360 | goto exit_dput; |
| @@ -2368,23 +2370,22 @@ reval: | |||
| 2368 | * just set LAST_BIND. | 2370 | * just set LAST_BIND. |
| 2369 | */ | 2371 | */ |
| 2370 | nd.flags |= LOOKUP_PARENT; | 2372 | nd.flags |= LOOKUP_PARENT; |
| 2371 | error = security_inode_follow_link(path.dentry, &nd); | 2373 | error = security_inode_follow_link(link.dentry, &nd); |
| 2372 | if (error) | 2374 | if (error) |
| 2373 | goto exit_dput; | 2375 | goto exit_dput; |
| 2374 | error = __do_follow_link(&path, &nd, &cookie); | 2376 | error = __do_follow_link(&link, &nd, &cookie); |
| 2375 | if (unlikely(error)) { | 2377 | if (unlikely(error)) { |
| 2376 | if (!IS_ERR(cookie) && nd.inode->i_op->put_link) | 2378 | if (!IS_ERR(cookie) && linki->i_op->put_link) |
| 2377 | nd.inode->i_op->put_link(path.dentry, &nd, cookie); | 2379 | linki->i_op->put_link(link.dentry, &nd, cookie); |
| 2378 | /* nd.path had been dropped */ | 2380 | /* nd.path had been dropped */ |
| 2379 | nd.path = path; | 2381 | nd.path = link; |
| 2380 | goto out_path; | 2382 | goto out_path; |
| 2381 | } | 2383 | } |
| 2382 | holder = path; | ||
| 2383 | nd.flags &= ~LOOKUP_PARENT; | 2384 | nd.flags &= ~LOOKUP_PARENT; |
| 2384 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 2385 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); |
| 2385 | if (nd.inode->i_op->put_link) | 2386 | if (linki->i_op->put_link) |
| 2386 | nd.inode->i_op->put_link(holder.dentry, &nd, cookie); | 2387 | linki->i_op->put_link(link.dentry, &nd, cookie); |
| 2387 | path_put(&holder); | 2388 | path_put(&link); |
| 2388 | } | 2389 | } |
| 2389 | out: | 2390 | out: |
| 2390 | if (nd.root.mnt) | 2391 | if (nd.root.mnt) |
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index b2adbb4b2f73..5bad17d1acde 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | * some fast and compact auxiliary data. | 16 | * some fast and compact auxiliary data. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #if defined(CONFIG_SMP) | 19 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
| 20 | #define LIST_BL_LOCKMASK 1UL | 20 | #define LIST_BL_LOCKMASK 1UL |
| 21 | #else | 21 | #else |
| 22 | #define LIST_BL_LOCKMASK 0UL | 22 | #define LIST_BL_LOCKMASK 0UL |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index ffb7bbad0638..b24d7027b83c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -916,7 +916,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry) | |||
| 916 | 916 | ||
| 917 | parent = dentry->d_parent; | 917 | parent = dentry->d_parent; |
| 918 | spin_lock(&parent->d_lock); | 918 | spin_lock(&parent->d_lock); |
| 919 | spin_lock(&dentry->d_lock); | 919 | spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); |
| 920 | list_del_init(&dentry->d_u.d_child); | 920 | list_del_init(&dentry->d_u.d_child); |
| 921 | spin_unlock(&dentry->d_lock); | 921 | spin_unlock(&dentry->d_lock); |
| 922 | spin_unlock(&parent->d_lock); | 922 | spin_unlock(&parent->d_lock); |
