diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 47bf67cbe6bf77ccc1edcf806628ba544f8bec1f..61bd79abb805a29d2c9b7c0527bc2860c84c6b37 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -685,9 +685,9 @@ static int btrfs_get_sb(struct file_system_type *fs_type, int flags,
 		mutex_unlock(&root->d_inode->i_mutex);
 
 		if (IS_ERR(new_root)) {
+			dput(root);
 			deactivate_locked_super(s);
 			error = PTR_ERR(new_root);
-			dput(root);
 			goto error_free_subvol_name;
 		}
 		if (!new_root->d_inode) {