diff options
-rw-r--r-- | fs/btrfs/super.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 15634d4648d..244fa46c50b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -492,7 +492,6 @@ static struct dentry *get_default_root(struct super_block *sb, | |||
492 | struct btrfs_path *path; | 492 | struct btrfs_path *path; |
493 | struct btrfs_key location; | 493 | struct btrfs_key location; |
494 | struct inode *inode; | 494 | struct inode *inode; |
495 | struct dentry *dentry; | ||
496 | u64 dir_id; | 495 | u64 dir_id; |
497 | int new = 0; | 496 | int new = 0; |
498 | 497 | ||
@@ -566,29 +565,7 @@ setup_root: | |||
566 | return dget(sb->s_root); | 565 | return dget(sb->s_root); |
567 | } | 566 | } |
568 | 567 | ||
569 | if (new) { | 568 | return d_obtain_alias(inode); |
570 | const struct qstr name = { .name = "/", .len = 1 }; | ||
571 | |||
572 | /* | ||
573 | * New inode, we need to make the dentry a sibling of s_root so | ||
574 | * everything gets cleaned up properly on unmount. | ||
575 | */ | ||
576 | dentry = d_alloc(sb->s_root, &name); | ||
577 | if (!dentry) { | ||
578 | iput(inode); | ||
579 | return ERR_PTR(-ENOMEM); | ||
580 | } | ||
581 | d_splice_alias(inode, dentry); | ||
582 | } else { | ||
583 | /* | ||
584 | * We found the inode in cache, just find a dentry for it and | ||
585 | * put the reference to the inode we just got. | ||
586 | */ | ||
587 | dentry = d_find_alias(inode); | ||
588 | iput(inode); | ||
589 | } | ||
590 | |||
591 | return dentry; | ||
592 | } | 569 | } |
593 | 570 | ||
594 | static int btrfs_fill_super(struct super_block *sb, | 571 | static int btrfs_fill_super(struct super_block *sb, |