diff options
-rw-r--r-- | fs/dcache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index be2bea834bf4..e99c6f529ba8 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -532,10 +532,12 @@ static inline struct dentry *lock_parent(struct dentry *dentry) | |||
532 | struct dentry *parent = dentry->d_parent; | 532 | struct dentry *parent = dentry->d_parent; |
533 | if (IS_ROOT(dentry)) | 533 | if (IS_ROOT(dentry)) |
534 | return NULL; | 534 | return NULL; |
535 | if (unlikely((int)dentry->d_lockref.count < 0)) | ||
536 | return NULL; | ||
535 | if (likely(spin_trylock(&parent->d_lock))) | 537 | if (likely(spin_trylock(&parent->d_lock))) |
536 | return parent; | 538 | return parent; |
537 | spin_unlock(&dentry->d_lock); | ||
538 | rcu_read_lock(); | 539 | rcu_read_lock(); |
540 | spin_unlock(&dentry->d_lock); | ||
539 | again: | 541 | again: |
540 | parent = ACCESS_ONCE(dentry->d_parent); | 542 | parent = ACCESS_ONCE(dentry->d_parent); |
541 | spin_lock(&parent->d_lock); | 543 | spin_lock(&parent->d_lock); |