diff options
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 130 |
1 files changed, 70 insertions, 60 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 4e47849d7427..91d123938cef 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1640,7 +1640,7 @@ int btrfs_insert_fs_root(struct btrfs_fs_info *fs_info, | |||
1640 | { | 1640 | { |
1641 | int ret; | 1641 | int ret; |
1642 | 1642 | ||
1643 | ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); | 1643 | ret = radix_tree_preload(GFP_NOFS); |
1644 | if (ret) | 1644 | if (ret) |
1645 | return ret; | 1645 | return ret; |
1646 | 1646 | ||
@@ -2417,7 +2417,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info, | |||
2417 | /* returns with log_tree_root freed on success */ | 2417 | /* returns with log_tree_root freed on success */ |
2418 | ret = btrfs_recover_log_trees(log_tree_root); | 2418 | ret = btrfs_recover_log_trees(log_tree_root); |
2419 | if (ret) { | 2419 | if (ret) { |
2420 | btrfs_std_error(tree_root->fs_info, ret, | 2420 | btrfs_handle_fs_error(tree_root->fs_info, ret, |
2421 | "Failed to recover log tree"); | 2421 | "Failed to recover log tree"); |
2422 | free_extent_buffer(log_tree_root->node); | 2422 | free_extent_buffer(log_tree_root->node); |
2423 | kfree(log_tree_root); | 2423 | kfree(log_tree_root); |
@@ -2517,6 +2517,7 @@ int open_ctree(struct super_block *sb, | |||
2517 | int num_backups_tried = 0; | 2517 | int num_backups_tried = 0; |
2518 | int backup_index = 0; | 2518 | int backup_index = 0; |
2519 | int max_active; | 2519 | int max_active; |
2520 | bool cleaner_mutex_locked = false; | ||
2520 | 2521 | ||
2521 | tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL); | 2522 | tree_root = fs_info->tree_root = btrfs_alloc_root(fs_info, GFP_KERNEL); |
2522 | chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info, GFP_KERNEL); | 2523 | chunk_root = fs_info->chunk_root = btrfs_alloc_root(fs_info, GFP_KERNEL); |
@@ -2713,7 +2714,7 @@ int open_ctree(struct super_block *sb, | |||
2713 | * Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k). | 2714 | * Pass the whole disk block of size BTRFS_SUPER_INFO_SIZE (4k). |
2714 | */ | 2715 | */ |
2715 | if (btrfs_check_super_csum(bh->b_data)) { | 2716 | if (btrfs_check_super_csum(bh->b_data)) { |
2716 | printk(KERN_ERR "BTRFS: superblock checksum mismatch\n"); | 2717 | btrfs_err(fs_info, "superblock checksum mismatch"); |
2717 | err = -EINVAL; | 2718 | err = -EINVAL; |
2718 | brelse(bh); | 2719 | brelse(bh); |
2719 | goto fail_alloc; | 2720 | goto fail_alloc; |
@@ -2733,7 +2734,7 @@ int open_ctree(struct super_block *sb, | |||
2733 | 2734 | ||
2734 | ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY); | 2735 | ret = btrfs_check_super_valid(fs_info, sb->s_flags & MS_RDONLY); |
2735 | if (ret) { | 2736 | if (ret) { |
2736 | printk(KERN_ERR "BTRFS: superblock contains fatal errors\n"); | 2737 | btrfs_err(fs_info, "superblock contains fatal errors"); |
2737 | err = -EINVAL; | 2738 | err = -EINVAL; |
2738 | goto fail_alloc; | 2739 | goto fail_alloc; |
2739 | } | 2740 | } |
@@ -2768,9 +2769,9 @@ int open_ctree(struct super_block *sb, | |||
2768 | features = btrfs_super_incompat_flags(disk_super) & | 2769 | features = btrfs_super_incompat_flags(disk_super) & |
2769 | ~BTRFS_FEATURE_INCOMPAT_SUPP; | 2770 | ~BTRFS_FEATURE_INCOMPAT_SUPP; |
2770 | if (features) { | 2771 | if (features) { |
2771 | printk(KERN_ERR "BTRFS: couldn't mount because of " | 2772 | btrfs_err(fs_info, |
2772 | "unsupported optional features (%Lx).\n", | 2773 | "cannot mount because of unsupported optional features (%llx)", |
2773 | features); | 2774 | features); |
2774 | err = -EINVAL; | 2775 | err = -EINVAL; |
2775 | goto fail_alloc; | 2776 | goto fail_alloc; |
2776 | } | 2777 | } |
@@ -2781,7 +2782,7 @@ int open_ctree(struct super_block *sb, | |||
2781 | features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; | 2782 | features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO; |
2782 | 2783 | ||
2783 | if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) | 2784 | if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) |
2784 | printk(KERN_INFO "BTRFS: has skinny extents\n"); | 2785 | btrfs_info(fs_info, "has skinny extents"); |
2785 | 2786 | ||
2786 | /* | 2787 | /* |
2787 | * flag our filesystem as having big metadata blocks if | 2788 | * flag our filesystem as having big metadata blocks if |
@@ -2789,7 +2790,8 @@ int open_ctree(struct super_block *sb, | |||
2789 | */ | 2790 | */ |
2790 | if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { | 2791 | if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { |
2791 | if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) | 2792 | if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) |
2792 | printk(KERN_INFO "BTRFS: flagging fs with big metadata feature\n"); | 2793 | btrfs_info(fs_info, |
2794 | "flagging fs with big metadata feature"); | ||
2793 | features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; | 2795 | features |= BTRFS_FEATURE_INCOMPAT_BIG_METADATA; |
2794 | } | 2796 | } |
2795 | 2797 | ||
@@ -2805,9 +2807,9 @@ int open_ctree(struct super_block *sb, | |||
2805 | */ | 2807 | */ |
2806 | if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && | 2808 | if ((features & BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS) && |
2807 | (sectorsize != nodesize)) { | 2809 | (sectorsize != nodesize)) { |
2808 | printk(KERN_ERR "BTRFS: unequal leaf/node/sector sizes " | 2810 | btrfs_err(fs_info, |
2809 | "are not allowed for mixed block groups on %s\n", | 2811 | "unequal nodesize/sectorsize (%u != %u) are not allowed for mixed block groups", |
2810 | sb->s_id); | 2812 | nodesize, sectorsize); |
2811 | goto fail_alloc; | 2813 | goto fail_alloc; |
2812 | } | 2814 | } |
2813 | 2815 | ||
@@ -2820,8 +2822,8 @@ int open_ctree(struct super_block *sb, | |||
2820 | features = btrfs_super_compat_ro_flags(disk_super) & | 2822 | features = btrfs_super_compat_ro_flags(disk_super) & |
2821 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; | 2823 | ~BTRFS_FEATURE_COMPAT_RO_SUPP; |
2822 | if (!(sb->s_flags & MS_RDONLY) && features) { | 2824 | if (!(sb->s_flags & MS_RDONLY) && features) { |
2823 | printk(KERN_ERR "BTRFS: couldn't mount RDWR because of " | 2825 | btrfs_err(fs_info, |
2824 | "unsupported option features (%Lx).\n", | 2826 | "cannot mount read-write because of unsupported optional features (%llx)", |
2825 | features); | 2827 | features); |
2826 | err = -EINVAL; | 2828 | err = -EINVAL; |
2827 | goto fail_alloc; | 2829 | goto fail_alloc; |
@@ -2850,8 +2852,7 @@ int open_ctree(struct super_block *sb, | |||
2850 | ret = btrfs_read_sys_array(tree_root); | 2852 | ret = btrfs_read_sys_array(tree_root); |
2851 | mutex_unlock(&fs_info->chunk_mutex); | 2853 | mutex_unlock(&fs_info->chunk_mutex); |
2852 | if (ret) { | 2854 | if (ret) { |
2853 | printk(KERN_ERR "BTRFS: failed to read the system " | 2855 | btrfs_err(fs_info, "failed to read the system array: %d", ret); |
2854 | "array on %s\n", sb->s_id); | ||
2855 | goto fail_sb_buffer; | 2856 | goto fail_sb_buffer; |
2856 | } | 2857 | } |
2857 | 2858 | ||
@@ -2865,8 +2866,7 @@ int open_ctree(struct super_block *sb, | |||
2865 | generation); | 2866 | generation); |
2866 | if (IS_ERR(chunk_root->node) || | 2867 | if (IS_ERR(chunk_root->node) || |
2867 | !extent_buffer_uptodate(chunk_root->node)) { | 2868 | !extent_buffer_uptodate(chunk_root->node)) { |
2868 | printk(KERN_ERR "BTRFS: failed to read chunk root on %s\n", | 2869 | btrfs_err(fs_info, "failed to read chunk root"); |
2869 | sb->s_id); | ||
2870 | if (!IS_ERR(chunk_root->node)) | 2870 | if (!IS_ERR(chunk_root->node)) |
2871 | free_extent_buffer(chunk_root->node); | 2871 | free_extent_buffer(chunk_root->node); |
2872 | chunk_root->node = NULL; | 2872 | chunk_root->node = NULL; |
@@ -2880,8 +2880,7 @@ int open_ctree(struct super_block *sb, | |||
2880 | 2880 | ||
2881 | ret = btrfs_read_chunk_tree(chunk_root); | 2881 | ret = btrfs_read_chunk_tree(chunk_root); |
2882 | if (ret) { | 2882 | if (ret) { |
2883 | printk(KERN_ERR "BTRFS: failed to read chunk tree on %s\n", | 2883 | btrfs_err(fs_info, "failed to read chunk tree: %d", ret); |
2884 | sb->s_id); | ||
2885 | goto fail_tree_roots; | 2884 | goto fail_tree_roots; |
2886 | } | 2885 | } |
2887 | 2886 | ||
@@ -2892,8 +2891,7 @@ int open_ctree(struct super_block *sb, | |||
2892 | btrfs_close_extra_devices(fs_devices, 0); | 2891 | btrfs_close_extra_devices(fs_devices, 0); |
2893 | 2892 | ||
2894 | if (!fs_devices->latest_bdev) { | 2893 | if (!fs_devices->latest_bdev) { |
2895 | printk(KERN_ERR "BTRFS: failed to read devices on %s\n", | 2894 | btrfs_err(fs_info, "failed to read devices"); |
2896 | sb->s_id); | ||
2897 | goto fail_tree_roots; | 2895 | goto fail_tree_roots; |
2898 | } | 2896 | } |
2899 | 2897 | ||
@@ -2905,8 +2903,7 @@ retry_root_backup: | |||
2905 | generation); | 2903 | generation); |
2906 | if (IS_ERR(tree_root->node) || | 2904 | if (IS_ERR(tree_root->node) || |
2907 | !extent_buffer_uptodate(tree_root->node)) { | 2905 | !extent_buffer_uptodate(tree_root->node)) { |
2908 | printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n", | 2906 | btrfs_warn(fs_info, "failed to read tree root"); |
2909 | sb->s_id); | ||
2910 | if (!IS_ERR(tree_root->node)) | 2907 | if (!IS_ERR(tree_root->node)) |
2911 | free_extent_buffer(tree_root->node); | 2908 | free_extent_buffer(tree_root->node); |
2912 | tree_root->node = NULL; | 2909 | tree_root->node = NULL; |
@@ -2938,20 +2935,19 @@ retry_root_backup: | |||
2938 | 2935 | ||
2939 | ret = btrfs_recover_balance(fs_info); | 2936 | ret = btrfs_recover_balance(fs_info); |
2940 | if (ret) { | 2937 | if (ret) { |
2941 | printk(KERN_ERR "BTRFS: failed to recover balance\n"); | 2938 | btrfs_err(fs_info, "failed to recover balance: %d", ret); |
2942 | goto fail_block_groups; | 2939 | goto fail_block_groups; |
2943 | } | 2940 | } |
2944 | 2941 | ||
2945 | ret = btrfs_init_dev_stats(fs_info); | 2942 | ret = btrfs_init_dev_stats(fs_info); |
2946 | if (ret) { | 2943 | if (ret) { |
2947 | printk(KERN_ERR "BTRFS: failed to init dev_stats: %d\n", | 2944 | btrfs_err(fs_info, "failed to init dev_stats: %d", ret); |
2948 | ret); | ||
2949 | goto fail_block_groups; | 2945 | goto fail_block_groups; |
2950 | } | 2946 | } |
2951 | 2947 | ||
2952 | ret = btrfs_init_dev_replace(fs_info); | 2948 | ret = btrfs_init_dev_replace(fs_info); |
2953 | if (ret) { | 2949 | if (ret) { |
2954 | pr_err("BTRFS: failed to init dev_replace: %d\n", ret); | 2950 | btrfs_err(fs_info, "failed to init dev_replace: %d", ret); |
2955 | goto fail_block_groups; | 2951 | goto fail_block_groups; |
2956 | } | 2952 | } |
2957 | 2953 | ||
@@ -2959,31 +2955,33 @@ retry_root_backup: | |||
2959 | 2955 | ||
2960 | ret = btrfs_sysfs_add_fsid(fs_devices, NULL); | 2956 | ret = btrfs_sysfs_add_fsid(fs_devices, NULL); |
2961 | if (ret) { | 2957 | if (ret) { |
2962 | pr_err("BTRFS: failed to init sysfs fsid interface: %d\n", ret); | 2958 | btrfs_err(fs_info, "failed to init sysfs fsid interface: %d", |
2959 | ret); | ||
2963 | goto fail_block_groups; | 2960 | goto fail_block_groups; |
2964 | } | 2961 | } |
2965 | 2962 | ||
2966 | ret = btrfs_sysfs_add_device(fs_devices); | 2963 | ret = btrfs_sysfs_add_device(fs_devices); |
2967 | if (ret) { | 2964 | if (ret) { |
2968 | pr_err("BTRFS: failed to init sysfs device interface: %d\n", ret); | 2965 | btrfs_err(fs_info, "failed to init sysfs device interface: %d", |
2966 | ret); | ||
2969 | goto fail_fsdev_sysfs; | 2967 | goto fail_fsdev_sysfs; |
2970 | } | 2968 | } |
2971 | 2969 | ||
2972 | ret = btrfs_sysfs_add_mounted(fs_info); | 2970 | ret = btrfs_sysfs_add_mounted(fs_info); |
2973 | if (ret) { | 2971 | if (ret) { |
2974 | pr_err("BTRFS: failed to init sysfs interface: %d\n", ret); | 2972 | btrfs_err(fs_info, "failed to init sysfs interface: %d", ret); |
2975 | goto fail_fsdev_sysfs; | 2973 | goto fail_fsdev_sysfs; |
2976 | } | 2974 | } |
2977 | 2975 | ||
2978 | ret = btrfs_init_space_info(fs_info); | 2976 | ret = btrfs_init_space_info(fs_info); |
2979 | if (ret) { | 2977 | if (ret) { |
2980 | printk(KERN_ERR "BTRFS: Failed to initial space info: %d\n", ret); | 2978 | btrfs_err(fs_info, "failed to initialize space info: %d", ret); |
2981 | goto fail_sysfs; | 2979 | goto fail_sysfs; |
2982 | } | 2980 | } |
2983 | 2981 | ||
2984 | ret = btrfs_read_block_groups(fs_info->extent_root); | 2982 | ret = btrfs_read_block_groups(fs_info->extent_root); |
2985 | if (ret) { | 2983 | if (ret) { |
2986 | printk(KERN_ERR "BTRFS: Failed to read block groups: %d\n", ret); | 2984 | btrfs_err(fs_info, "failed to read block groups: %d", ret); |
2987 | goto fail_sysfs; | 2985 | goto fail_sysfs; |
2988 | } | 2986 | } |
2989 | fs_info->num_tolerated_disk_barrier_failures = | 2987 | fs_info->num_tolerated_disk_barrier_failures = |
@@ -2991,12 +2989,20 @@ retry_root_backup: | |||
2991 | if (fs_info->fs_devices->missing_devices > | 2989 | if (fs_info->fs_devices->missing_devices > |
2992 | fs_info->num_tolerated_disk_barrier_failures && | 2990 | fs_info->num_tolerated_disk_barrier_failures && |
2993 | !(sb->s_flags & MS_RDONLY)) { | 2991 | !(sb->s_flags & MS_RDONLY)) { |
2994 | pr_warn("BTRFS: missing devices(%llu) exceeds the limit(%d), writeable mount is not allowed\n", | 2992 | btrfs_warn(fs_info, |
2993 | "missing devices (%llu) exceeds the limit (%d), writeable mount is not allowed", | ||
2995 | fs_info->fs_devices->missing_devices, | 2994 | fs_info->fs_devices->missing_devices, |
2996 | fs_info->num_tolerated_disk_barrier_failures); | 2995 | fs_info->num_tolerated_disk_barrier_failures); |
2997 | goto fail_sysfs; | 2996 | goto fail_sysfs; |
2998 | } | 2997 | } |
2999 | 2998 | ||
2999 | /* | ||
3000 | * Hold the cleaner_mutex thread here so that we don't block | ||
3001 | * for a long time on btrfs_recover_relocation. cleaner_kthread | ||
3002 | * will wait for us to finish mounting the filesystem. | ||
3003 | */ | ||
3004 | mutex_lock(&fs_info->cleaner_mutex); | ||
3005 | cleaner_mutex_locked = true; | ||
3000 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, | 3006 | fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root, |
3001 | "btrfs-cleaner"); | 3007 | "btrfs-cleaner"); |
3002 | if (IS_ERR(fs_info->cleaner_kthread)) | 3008 | if (IS_ERR(fs_info->cleaner_kthread)) |
@@ -3011,8 +3017,7 @@ retry_root_backup: | |||
3011 | if (!btrfs_test_opt(tree_root, SSD) && | 3017 | if (!btrfs_test_opt(tree_root, SSD) && |
3012 | !btrfs_test_opt(tree_root, NOSSD) && | 3018 | !btrfs_test_opt(tree_root, NOSSD) && |
3013 | !fs_info->fs_devices->rotating) { | 3019 | !fs_info->fs_devices->rotating) { |
3014 | printk(KERN_INFO "BTRFS: detected SSD devices, enabling SSD " | 3020 | btrfs_info(fs_info, "detected SSD devices, enabling SSD mode"); |
3015 | "mode\n"); | ||
3016 | btrfs_set_opt(fs_info->mount_opt, SSD); | 3021 | btrfs_set_opt(fs_info->mount_opt, SSD); |
3017 | } | 3022 | } |
3018 | 3023 | ||
@@ -3030,8 +3035,9 @@ retry_root_backup: | |||
3030 | 1 : 0, | 3035 | 1 : 0, |
3031 | fs_info->check_integrity_print_mask); | 3036 | fs_info->check_integrity_print_mask); |
3032 | if (ret) | 3037 | if (ret) |
3033 | printk(KERN_WARNING "BTRFS: failed to initialize" | 3038 | btrfs_warn(fs_info, |
3034 | " integrity check module %s\n", sb->s_id); | 3039 | "failed to initialize integrity check module: %d", |
3040 | ret); | ||
3035 | } | 3041 | } |
3036 | #endif | 3042 | #endif |
3037 | ret = btrfs_read_qgroup_config(fs_info); | 3043 | ret = btrfs_read_qgroup_config(fs_info); |
@@ -3056,17 +3062,17 @@ retry_root_backup: | |||
3056 | ret = btrfs_cleanup_fs_roots(fs_info); | 3062 | ret = btrfs_cleanup_fs_roots(fs_info); |
3057 | if (ret) | 3063 | if (ret) |
3058 | goto fail_qgroup; | 3064 | goto fail_qgroup; |
3059 | 3065 | /* We locked cleaner_mutex before creating cleaner_kthread. */ | |
3060 | mutex_lock(&fs_info->cleaner_mutex); | ||
3061 | ret = btrfs_recover_relocation(tree_root); | 3066 | ret = btrfs_recover_relocation(tree_root); |
3062 | mutex_unlock(&fs_info->cleaner_mutex); | ||
3063 | if (ret < 0) { | 3067 | if (ret < 0) { |
3064 | printk(KERN_WARNING | 3068 | btrfs_warn(fs_info, "failed to recover relocation: %d", |
3065 | "BTRFS: failed to recover relocation\n"); | 3069 | ret); |
3066 | err = -EINVAL; | 3070 | err = -EINVAL; |
3067 | goto fail_qgroup; | 3071 | goto fail_qgroup; |
3068 | } | 3072 | } |
3069 | } | 3073 | } |
3074 | mutex_unlock(&fs_info->cleaner_mutex); | ||
3075 | cleaner_mutex_locked = false; | ||
3070 | 3076 | ||
3071 | location.objectid = BTRFS_FS_TREE_OBJECTID; | 3077 | location.objectid = BTRFS_FS_TREE_OBJECTID; |
3072 | location.type = BTRFS_ROOT_ITEM_KEY; | 3078 | location.type = BTRFS_ROOT_ITEM_KEY; |
@@ -3083,11 +3089,11 @@ retry_root_backup: | |||
3083 | 3089 | ||
3084 | if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) && | 3090 | if (btrfs_test_opt(tree_root, FREE_SPACE_TREE) && |
3085 | !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { | 3091 | !btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { |
3086 | pr_info("BTRFS: creating free space tree\n"); | 3092 | btrfs_info(fs_info, "creating free space tree"); |
3087 | ret = btrfs_create_free_space_tree(fs_info); | 3093 | ret = btrfs_create_free_space_tree(fs_info); |
3088 | if (ret) { | 3094 | if (ret) { |
3089 | pr_warn("BTRFS: failed to create free space tree %d\n", | 3095 | btrfs_warn(fs_info, |
3090 | ret); | 3096 | "failed to create free space tree: %d", ret); |
3091 | close_ctree(tree_root); | 3097 | close_ctree(tree_root); |
3092 | return ret; | 3098 | return ret; |
3093 | } | 3099 | } |
@@ -3104,14 +3110,14 @@ retry_root_backup: | |||
3104 | 3110 | ||
3105 | ret = btrfs_resume_balance_async(fs_info); | 3111 | ret = btrfs_resume_balance_async(fs_info); |
3106 | if (ret) { | 3112 | if (ret) { |
3107 | printk(KERN_WARNING "BTRFS: failed to resume balance\n"); | 3113 | btrfs_warn(fs_info, "failed to resume balance: %d", ret); |
3108 | close_ctree(tree_root); | 3114 | close_ctree(tree_root); |
3109 | return ret; | 3115 | return ret; |
3110 | } | 3116 | } |
3111 | 3117 | ||
3112 | ret = btrfs_resume_dev_replace_async(fs_info); | 3118 | ret = btrfs_resume_dev_replace_async(fs_info); |
3113 | if (ret) { | 3119 | if (ret) { |
3114 | pr_warn("BTRFS: failed to resume dev_replace\n"); | 3120 | btrfs_warn(fs_info, "failed to resume device replace: %d", ret); |
3115 | close_ctree(tree_root); | 3121 | close_ctree(tree_root); |
3116 | return ret; | 3122 | return ret; |
3117 | } | 3123 | } |
@@ -3120,33 +3126,33 @@ retry_root_backup: | |||
3120 | 3126 | ||
3121 | if (btrfs_test_opt(tree_root, CLEAR_CACHE) && | 3127 | if (btrfs_test_opt(tree_root, CLEAR_CACHE) && |
3122 | btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { | 3128 | btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) { |
3123 | pr_info("BTRFS: clearing free space tree\n"); | 3129 | btrfs_info(fs_info, "clearing free space tree"); |
3124 | ret = btrfs_clear_free_space_tree(fs_info); | 3130 | ret = btrfs_clear_free_space_tree(fs_info); |
3125 | if (ret) { | 3131 | if (ret) { |
3126 | pr_warn("BTRFS: failed to clear free space tree %d\n", | 3132 | btrfs_warn(fs_info, |
3127 | ret); | 3133 | "failed to clear free space tree: %d", ret); |
3128 | close_ctree(tree_root); | 3134 | close_ctree(tree_root); |
3129 | return ret; | 3135 | return ret; |
3130 | } | 3136 | } |
3131 | } | 3137 | } |
3132 | 3138 | ||
3133 | if (!fs_info->uuid_root) { | 3139 | if (!fs_info->uuid_root) { |
3134 | pr_info("BTRFS: creating UUID tree\n"); | 3140 | btrfs_info(fs_info, "creating UUID tree"); |
3135 | ret = btrfs_create_uuid_tree(fs_info); | 3141 | ret = btrfs_create_uuid_tree(fs_info); |
3136 | if (ret) { | 3142 | if (ret) { |
3137 | pr_warn("BTRFS: failed to create the UUID tree %d\n", | 3143 | btrfs_warn(fs_info, |
3138 | ret); | 3144 | "failed to create the UUID tree: %d", ret); |
3139 | close_ctree(tree_root); | 3145 | close_ctree(tree_root); |
3140 | return ret; | 3146 | return ret; |
3141 | } | 3147 | } |
3142 | } else if (btrfs_test_opt(tree_root, RESCAN_UUID_TREE) || | 3148 | } else if (btrfs_test_opt(tree_root, RESCAN_UUID_TREE) || |
3143 | fs_info->generation != | 3149 | fs_info->generation != |
3144 | btrfs_super_uuid_tree_generation(disk_super)) { | 3150 | btrfs_super_uuid_tree_generation(disk_super)) { |
3145 | pr_info("BTRFS: checking UUID tree\n"); | 3151 | btrfs_info(fs_info, "checking UUID tree"); |
3146 | ret = btrfs_check_uuid_tree(fs_info); | 3152 | ret = btrfs_check_uuid_tree(fs_info); |
3147 | if (ret) { | 3153 | if (ret) { |
3148 | pr_warn("BTRFS: failed to check the UUID tree %d\n", | 3154 | btrfs_warn(fs_info, |
3149 | ret); | 3155 | "failed to check the UUID tree: %d", ret); |
3150 | close_ctree(tree_root); | 3156 | close_ctree(tree_root); |
3151 | return ret; | 3157 | return ret; |
3152 | } | 3158 | } |
@@ -3180,6 +3186,10 @@ fail_cleaner: | |||
3180 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); | 3186 | filemap_write_and_wait(fs_info->btree_inode->i_mapping); |
3181 | 3187 | ||
3182 | fail_sysfs: | 3188 | fail_sysfs: |
3189 | if (cleaner_mutex_locked) { | ||
3190 | mutex_unlock(&fs_info->cleaner_mutex); | ||
3191 | cleaner_mutex_locked = false; | ||
3192 | } | ||
3183 | btrfs_sysfs_remove_mounted(fs_info); | 3193 | btrfs_sysfs_remove_mounted(fs_info); |
3184 | 3194 | ||
3185 | fail_fsdev_sysfs: | 3195 | fail_fsdev_sysfs: |
@@ -3646,7 +3656,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
3646 | if (ret) { | 3656 | if (ret) { |
3647 | mutex_unlock( | 3657 | mutex_unlock( |
3648 | &root->fs_info->fs_devices->device_list_mutex); | 3658 | &root->fs_info->fs_devices->device_list_mutex); |
3649 | btrfs_std_error(root->fs_info, ret, | 3659 | btrfs_handle_fs_error(root->fs_info, ret, |
3650 | "errors while submitting device barriers."); | 3660 | "errors while submitting device barriers."); |
3651 | return ret; | 3661 | return ret; |
3652 | } | 3662 | } |
@@ -3686,7 +3696,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
3686 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 3696 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
3687 | 3697 | ||
3688 | /* FUA is masked off if unsupported and can't be the reason */ | 3698 | /* FUA is masked off if unsupported and can't be the reason */ |
3689 | btrfs_std_error(root->fs_info, -EIO, | 3699 | btrfs_handle_fs_error(root->fs_info, -EIO, |
3690 | "%d errors while writing supers", total_errors); | 3700 | "%d errors while writing supers", total_errors); |
3691 | return -EIO; | 3701 | return -EIO; |
3692 | } | 3702 | } |
@@ -3704,7 +3714,7 @@ static int write_all_supers(struct btrfs_root *root, int max_mirrors) | |||
3704 | } | 3714 | } |
3705 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); | 3715 | mutex_unlock(&root->fs_info->fs_devices->device_list_mutex); |
3706 | if (total_errors > max_errors) { | 3716 | if (total_errors > max_errors) { |
3707 | btrfs_std_error(root->fs_info, -EIO, | 3717 | btrfs_handle_fs_error(root->fs_info, -EIO, |
3708 | "%d errors while writing supers", total_errors); | 3718 | "%d errors while writing supers", total_errors); |
3709 | return -EIO; | 3719 | return -EIO; |
3710 | } | 3720 | } |