aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-03-30 14:34:00 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-31 16:03:16 -0400
commitd774a058d94d6b0dafada2295ec5221481b07d16 (patch)
tree952afb38f52c989752812dc3c0970259293211a9 /fs
parent08b0ab7c20f767187ae635d51bdd9d262ebe8357 (diff)
untangling do_lookup() - massage !dentry case towards __lookup_hash()
Reorder if-else cases for starters... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 14bb00a9fa9..5414438abff 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1174,39 +1174,34 @@ retry:
1174 1174
1175 mutex_lock(&dir->i_mutex); 1175 mutex_lock(&dir->i_mutex);
1176 dentry = d_lookup(parent, name); 1176 dentry = d_lookup(parent, name);
1177 if (likely(!dentry)) { 1177 if (dentry && d_need_lookup(dentry)) {
1178 dentry = d_alloc_and_lookup(parent, name, nd);
1179 if (IS_ERR(dentry)) {
1180 mutex_unlock(&dir->i_mutex);
1181 return PTR_ERR(dentry);
1182 }
1183 /* known good */
1184 status = 1;
1185 } else if (unlikely(d_need_lookup(dentry))) {
1186 dentry = d_inode_lookup(parent, dentry, nd); 1178 dentry = d_inode_lookup(parent, dentry, nd);
1187 if (IS_ERR(dentry)) { 1179 if (IS_ERR(dentry)) {
1188 mutex_unlock(&dir->i_mutex); 1180 mutex_unlock(&dir->i_mutex);
1189 return PTR_ERR(dentry); 1181 return PTR_ERR(dentry);
1190 } 1182 }
1191 /* known good */ 1183 } else if (dentry && (dentry->d_flags & DCACHE_OP_REVALIDATE)) {
1192 status = 1;
1193 } else if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE))
1194 status = d_revalidate(dentry, nd); 1184 status = d_revalidate(dentry, nd);
1195 if (unlikely(status <= 0)) { 1185 if (unlikely(status <= 0)) {
1196 if (status < 0) { 1186 if (status < 0) {
1197 mutex_unlock(&dir->i_mutex);
1198 dput(dentry);
1199 return status;
1200 }
1201 if (!d_invalidate(dentry)) {
1202 dput(dentry);
1203 dentry = d_alloc_and_lookup(parent, name, nd);
1204 if (IS_ERR(dentry)) {
1205 mutex_unlock(&dir->i_mutex); 1187 mutex_unlock(&dir->i_mutex);
1206 return PTR_ERR(dentry); 1188 dput(dentry);
1189 return status;
1207 } 1190 }
1208 /* known good */ 1191 if (!d_invalidate(dentry)) {
1209 status = 1; 1192 dput(dentry);
1193 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 }
1199 }
1200 } else if (!dentry) {
1201 dentry = d_alloc_and_lookup(parent, name, nd);
1202 if (IS_ERR(dentry)) {
1203 mutex_unlock(&dir->i_mutex);
1204 return PTR_ERR(dentry);
1210 } 1205 }
1211 } 1206 }
1212 mutex_unlock(&dir->i_mutex); 1207 mutex_unlock(&dir->i_mutex);