Btrfs: protect fs_info->alloc_start
[pandora-kernel.git] / fs / btrfs / super.c
index 6846ede..eda330d 100644 (file)
@@ -519,7 +519,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
                case Opt_alloc_start:
                        num = match_strdup(&args[0]);
                        if (num) {
+                               mutex_lock(&info->chunk_mutex);
                                info->alloc_start = memparse(num, NULL);
+                               mutex_unlock(&info->chunk_mutex);
                                kfree(num);
                                printk(KERN_INFO
                                        "btrfs: allocations start at %llu\n",
@@ -1289,7 +1291,9 @@ restore:
        fs_info->mount_opt = old_opts;
        fs_info->compress_type = old_compress_type;
        fs_info->max_inline = old_max_inline;
+       mutex_lock(&fs_info->chunk_mutex);
        fs_info->alloc_start = old_alloc_start;
+       mutex_unlock(&fs_info->chunk_mutex);
        btrfs_resize_thread_pool(fs_info,
                old_thread_pool_size, fs_info->thread_pool_size);
        fs_info->metadata_ratio = old_metadata_ratio;