aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index ef69fa5d2e5b..fc2b5226278d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -611,6 +611,7 @@ static struct mountpoint *new_mountpoint(struct dentry *dentry)
611{ 611{
612 struct list_head *chain = mountpoint_hashtable + hash(NULL, dentry); 612 struct list_head *chain = mountpoint_hashtable + hash(NULL, dentry);
613 struct mountpoint *mp; 613 struct mountpoint *mp;
614 int ret;
614 615
615 list_for_each_entry(mp, chain, m_hash) { 616 list_for_each_entry(mp, chain, m_hash) {
616 if (mp->m_dentry == dentry) { 617 if (mp->m_dentry == dentry) {
@@ -626,14 +627,12 @@ static struct mountpoint *new_mountpoint(struct dentry *dentry)
626 if (!mp) 627 if (!mp)
627 return ERR_PTR(-ENOMEM); 628 return ERR_PTR(-ENOMEM);
628 629
629 spin_lock(&dentry->d_lock); 630 ret = d_set_mounted(dentry);
630 if (d_unlinked(dentry)) { 631 if (ret) {
631 spin_unlock(&dentry->d_lock);
632 kfree(mp); 632 kfree(mp);
633 return ERR_PTR(-ENOENT); 633 return ERR_PTR(ret);
634 } 634 }
635 dentry->d_flags |= DCACHE_MOUNTED; 635
636 spin_unlock(&dentry->d_lock);
637 mp->m_dentry = dentry; 636 mp->m_dentry = dentry;
638 mp->m_count = 1; 637 mp->m_count = 1;
639 list_add(&mp->m_hash, chain); 638 list_add(&mp->m_hash, chain);