diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-01 16:18:06 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-10-24 23:35:01 -0400 |
commit | 94e92a6e772e009e27083a7f42d49a179e5f668c (patch) | |
tree | 9f2231e69bbed91b459a4d6207ff89714603983c | |
parent | 474279dc0f7745124fc76b474c8dc1294f8e87ce (diff) |
move taking vfsmount_lock down into prepend_path()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/dcache.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 41000305d716..d888223a5486 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2889,6 +2889,7 @@ static int prepend_path(const struct path *path, | |||
2889 | char *bptr; | 2889 | char *bptr; |
2890 | int blen; | 2890 | int blen; |
2891 | 2891 | ||
2892 | br_read_lock(&vfsmount_lock); | ||
2892 | rcu_read_lock(); | 2893 | rcu_read_lock(); |
2893 | restart: | 2894 | restart: |
2894 | bptr = *buffer; | 2895 | bptr = *buffer; |
@@ -2935,6 +2936,7 @@ restart: | |||
2935 | goto restart; | 2936 | goto restart; |
2936 | } | 2937 | } |
2937 | done_seqretry(&rename_lock, seq); | 2938 | done_seqretry(&rename_lock, seq); |
2939 | br_read_unlock(&vfsmount_lock); | ||
2938 | 2940 | ||
2939 | if (error >= 0 && bptr == *buffer) { | 2941 | if (error >= 0 && bptr == *buffer) { |
2940 | if (--blen < 0) | 2942 | if (--blen < 0) |
@@ -2971,9 +2973,7 @@ char *__d_path(const struct path *path, | |||
2971 | int error; | 2973 | int error; |
2972 | 2974 | ||
2973 | prepend(&res, &buflen, "\0", 1); | 2975 | prepend(&res, &buflen, "\0", 1); |
2974 | br_read_lock(&vfsmount_lock); | ||
2975 | error = prepend_path(path, root, &res, &buflen); | 2976 | error = prepend_path(path, root, &res, &buflen); |
2976 | br_read_unlock(&vfsmount_lock); | ||
2977 | 2977 | ||
2978 | if (error < 0) | 2978 | if (error < 0) |
2979 | return ERR_PTR(error); | 2979 | return ERR_PTR(error); |
@@ -2990,9 +2990,7 @@ char *d_absolute_path(const struct path *path, | |||
2990 | int error; | 2990 | int error; |
2991 | 2991 | ||
2992 | prepend(&res, &buflen, "\0", 1); | 2992 | prepend(&res, &buflen, "\0", 1); |
2993 | br_read_lock(&vfsmount_lock); | ||
2994 | error = prepend_path(path, &root, &res, &buflen); | 2993 | error = prepend_path(path, &root, &res, &buflen); |
2995 | br_read_unlock(&vfsmount_lock); | ||
2996 | 2994 | ||
2997 | if (error > 1) | 2995 | if (error > 1) |
2998 | error = -EINVAL; | 2996 | error = -EINVAL; |
@@ -3067,9 +3065,7 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
3067 | 3065 | ||
3068 | rcu_read_lock(); | 3066 | rcu_read_lock(); |
3069 | get_fs_root_rcu(current->fs, &root); | 3067 | get_fs_root_rcu(current->fs, &root); |
3070 | br_read_lock(&vfsmount_lock); | ||
3071 | error = path_with_deleted(path, &root, &res, &buflen); | 3068 | error = path_with_deleted(path, &root, &res, &buflen); |
3072 | br_read_unlock(&vfsmount_lock); | ||
3073 | rcu_read_unlock(); | 3069 | rcu_read_unlock(); |
3074 | 3070 | ||
3075 | if (error < 0) | 3071 | if (error < 0) |
@@ -3224,7 +3220,6 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) | |||
3224 | get_fs_root_and_pwd_rcu(current->fs, &root, &pwd); | 3220 | get_fs_root_and_pwd_rcu(current->fs, &root, &pwd); |
3225 | 3221 | ||
3226 | error = -ENOENT; | 3222 | error = -ENOENT; |
3227 | br_read_lock(&vfsmount_lock); | ||
3228 | if (!d_unlinked(pwd.dentry)) { | 3223 | if (!d_unlinked(pwd.dentry)) { |
3229 | unsigned long len; | 3224 | unsigned long len; |
3230 | char *cwd = page + PATH_MAX; | 3225 | char *cwd = page + PATH_MAX; |
@@ -3232,7 +3227,6 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) | |||
3232 | 3227 | ||
3233 | prepend(&cwd, &buflen, "\0", 1); | 3228 | prepend(&cwd, &buflen, "\0", 1); |
3234 | error = prepend_path(&pwd, &root, &cwd, &buflen); | 3229 | error = prepend_path(&pwd, &root, &cwd, &buflen); |
3235 | br_read_unlock(&vfsmount_lock); | ||
3236 | rcu_read_unlock(); | 3230 | rcu_read_unlock(); |
3237 | 3231 | ||
3238 | if (error < 0) | 3232 | if (error < 0) |
@@ -3253,7 +3247,6 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) | |||
3253 | error = -EFAULT; | 3247 | error = -EFAULT; |
3254 | } | 3248 | } |
3255 | } else { | 3249 | } else { |
3256 | br_read_unlock(&vfsmount_lock); | ||
3257 | rcu_read_unlock(); | 3250 | rcu_read_unlock(); |
3258 | } | 3251 | } |
3259 | 3252 | ||