diff options
Diffstat (limited to 'fs/ocfs2/dcache.c')
| -rw-r--r-- | fs/ocfs2/dcache.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index 2d016937fdda..42a61eecdacd 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
| @@ -296,6 +296,18 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, | |||
| 296 | 296 | ||
| 297 | out_attach: | 297 | out_attach: |
| 298 | spin_lock(&dentry_attach_lock); | 298 | spin_lock(&dentry_attach_lock); |
| 299 | if (unlikely(dentry->d_fsdata && !alias)) { | ||
| 300 | /* d_fsdata is set by a racing thread which is doing | ||
| 301 | * the same thing as this thread is doing. Leave the racing | ||
| 302 | * thread going ahead and we return here. | ||
| 303 | */ | ||
| 304 | spin_unlock(&dentry_attach_lock); | ||
| 305 | iput(dl->dl_inode); | ||
| 306 | ocfs2_lock_res_free(&dl->dl_lockres); | ||
| 307 | kfree(dl); | ||
| 308 | return 0; | ||
| 309 | } | ||
| 310 | |||
| 299 | dentry->d_fsdata = dl; | 311 | dentry->d_fsdata = dl; |
| 300 | dl->dl_count++; | 312 | dl->dl_count++; |
| 301 | spin_unlock(&dentry_attach_lock); | 313 | spin_unlock(&dentry_attach_lock); |
