diff options
-rw-r--r-- | fs/ocfs2/dcache.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index e5ba34818332..a40edc1e1d86 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
@@ -170,13 +170,10 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, | |||
170 | u64 parent_blkno, | 170 | u64 parent_blkno, |
171 | int skip_unhashed) | 171 | int skip_unhashed) |
172 | { | 172 | { |
173 | struct list_head *p; | 173 | struct dentry *dentry; |
174 | struct dentry *dentry = NULL; | ||
175 | 174 | ||
176 | spin_lock(&inode->i_lock); | 175 | spin_lock(&inode->i_lock); |
177 | list_for_each(p, &inode->i_dentry) { | 176 | list_for_each_entry(dentry, &inode->i_dentry, d_alias) { |
178 | dentry = list_entry(p, struct dentry, d_alias); | ||
179 | |||
180 | spin_lock(&dentry->d_lock); | 177 | spin_lock(&dentry->d_lock); |
181 | if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { | 178 | if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { |
182 | trace_ocfs2_find_local_alias(dentry->d_name.len, | 179 | trace_ocfs2_find_local_alias(dentry->d_name.len, |
@@ -184,16 +181,13 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, | |||
184 | 181 | ||
185 | dget_dlock(dentry); | 182 | dget_dlock(dentry); |
186 | spin_unlock(&dentry->d_lock); | 183 | spin_unlock(&dentry->d_lock); |
187 | break; | 184 | spin_unlock(&inode->i_lock); |
185 | return dentry; | ||
188 | } | 186 | } |
189 | spin_unlock(&dentry->d_lock); | 187 | spin_unlock(&dentry->d_lock); |
190 | |||
191 | dentry = NULL; | ||
192 | } | 188 | } |
193 | |||
194 | spin_unlock(&inode->i_lock); | 189 | spin_unlock(&inode->i_lock); |
195 | 190 | return NULL; | |
196 | return dentry; | ||
197 | } | 191 | } |
198 | 192 | ||
199 | DEFINE_SPINLOCK(dentry_attach_lock); | 193 | DEFINE_SPINLOCK(dentry_attach_lock); |