aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 55f4d00fda3a..f7b3eac7ac6d 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -451,21 +451,25 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
451 s->s_flags |= MS_ACTIVE; 451 s->s_flags |= MS_ACTIVE;
452 } 452 }
453 453
454 mutex_lock(&s->s_root->d_inode->i_mutex); 454 if (!strcmp(subvol_name, "."))
455 root = lookup_one_len(subvol_name, s->s_root, strlen(subvol_name)); 455 root = dget(s->s_root);
456 mutex_unlock(&s->s_root->d_inode->i_mutex); 456 else {
457 if (IS_ERR(root)) { 457 mutex_lock(&s->s_root->d_inode->i_mutex);
458 up_write(&s->s_umount); 458 root = lookup_one_len(subvol_name, s->s_root, strlen(subvol_name));
459 deactivate_super(s); 459 mutex_unlock(&s->s_root->d_inode->i_mutex);
460 error = PTR_ERR(root); 460 if (IS_ERR(root)) {
461 goto error; 461 up_write(&s->s_umount);
462 } 462 deactivate_super(s);
463 if (!root->d_inode) { 463 error = PTR_ERR(root);
464 dput(root); 464 goto error;
465 up_write(&s->s_umount); 465 }
466 deactivate_super(s); 466 if (!root->d_inode) {
467 error = -ENXIO; 467 dput(root);
468 goto error; 468 up_write(&s->s_umount);
469 deactivate_super(s);
470 error = -ENXIO;
471 goto error;
472 }
469 } 473 }
470 474
471 mnt->mnt_sb = s; 475 mnt->mnt_sb = s;