diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-30 14:37:42 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-31 16:03:16 -0400 |
| commit | ec335e91a4f088d8759c1311d0724e609d1c318e (patch) | |
| tree | 43163e92febda81023fcee742a9667f34ef39063 | |
| parent | d774a058d94d6b0dafada2295ec5221481b07d16 (diff) | |
untangling do_lookup() - merge failure exits in !dentry case
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/namei.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5414438abff0..a0f9a0294ff2 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
| @@ -1176,35 +1176,28 @@ retry: | |||
| 1176 | dentry = d_lookup(parent, name); | 1176 | dentry = d_lookup(parent, name); |
| 1177 | if (dentry && d_need_lookup(dentry)) { | 1177 | if (dentry && d_need_lookup(dentry)) { |
| 1178 | dentry = d_inode_lookup(parent, dentry, nd); | 1178 | dentry = d_inode_lookup(parent, dentry, nd); |
| 1179 | if (IS_ERR(dentry)) { | 1179 | goto l; |
| 1180 | mutex_unlock(&dir->i_mutex); | 1180 | } |
| 1181 | return PTR_ERR(dentry); | 1181 | if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) { |
| 1182 | } | ||
| 1183 | } else if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) { | ||
| 1184 | status = d_revalidate(dentry, nd); | 1182 | status = d_revalidate(dentry, nd); |
| 1185 | if (unlikely(status <= 0)) { | 1183 | if (unlikely(status <= 0)) { |
| 1186 | if (status < 0) { | 1184 | if (status < 0) { |
| 1187 | mutex_unlock(&dir->i_mutex); | ||
| 1188 | dput(dentry); | 1185 | dput(dentry); |
| 1189 | return status; | 1186 | dentry = ERR_PTR(status); |
| 1187 | goto l; | ||
| 1190 | } | 1188 | } |
| 1191 | if (!d_invalidate(dentry)) { | 1189 | if (!d_invalidate(dentry)) { |
| 1192 | dput(dentry); | 1190 | dput(dentry); |
| 1193 | dentry = d_alloc_and_lookup(parent, name, nd); | 1191 | dentry = d_alloc_and_lookup(parent, name, nd); |
| 1194 | if (IS_ERR(dentry)) { | ||
| 1195 | mutex_unlock(&dir->i_mutex); | ||
| 1196 | return PTR_ERR(dentry); | ||
| 1197 | } | ||
| 1198 | } | 1192 | } |
| 1199 | } | 1193 | } |
| 1200 | } else if (!dentry) { | 1194 | } else if (!dentry) { |
| 1201 | dentry = d_alloc_and_lookup(parent, name, nd); | 1195 | dentry = d_alloc_and_lookup(parent, name, nd); |
| 1202 | if (IS_ERR(dentry)) { | ||
| 1203 | mutex_unlock(&dir->i_mutex); | ||
| 1204 | return PTR_ERR(dentry); | ||
| 1205 | } | ||
| 1206 | } | 1196 | } |
| 1197 | l: | ||
| 1207 | mutex_unlock(&dir->i_mutex); | 1198 | mutex_unlock(&dir->i_mutex); |
| 1199 | if (IS_ERR(dentry)) | ||
| 1200 | return PTR_ERR(dentry); | ||
| 1208 | goto done; | 1201 | goto done; |
| 1209 | } | 1202 | } |
| 1210 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) | 1203 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) |
