Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 922809
Collapse All | Expand All

(-)a/fs/btrfs/volumes.c (-16 / +14 lines)
Lines 729-734 static noinline struct btrfs_device *device_list_add(const char *path, Link Here
729
	bool same_fsid_diff_dev = false;
729
	bool same_fsid_diff_dev = false;
730
	bool has_metadata_uuid = (btrfs_super_incompat_flags(disk_super) &
730
	bool has_metadata_uuid = (btrfs_super_incompat_flags(disk_super) &
731
		BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
731
		BTRFS_FEATURE_INCOMPAT_METADATA_UUID);
732
	bool can_create_new = *new_device_added;
732
733
733
	if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_CHANGING_FSID_V2) {
734
	if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_CHANGING_FSID_V2) {
734
		btrfs_err(NULL,
735
		btrfs_err(NULL,
Lines 744-749 static noinline struct btrfs_device *device_list_add(const char *path, Link Here
744
		return ERR_PTR(error);
745
		return ERR_PTR(error);
745
	}
746
	}
746
747
748
	*new_device_added = false;
747
	fs_devices = find_fsid_by_device(disk_super, path_devt, &same_fsid_diff_dev);
749
	fs_devices = find_fsid_by_device(disk_super, path_devt, &same_fsid_diff_dev);
748
750
749
	if (!fs_devices) {
751
	if (!fs_devices) {
Lines 795-800 static noinline struct btrfs_device *device_list_add(const char *path, Link Here
795
			return ERR_PTR(-EBUSY);
797
			return ERR_PTR(-EBUSY);
796
		}
798
		}
797
799
800
		if (!can_create_new) {
801
			pr_info(
802
	"BTRFS: device fsid %pU devid %llu transid %llu %s skip registration scanned by %s (%d)\n",
803
				disk_super->fsid, devid, found_transid, path,
804
				current->comm, task_pid_nr(current));
805
			mutex_unlock(&fs_devices->device_list_mutex);
806
			return NULL;
807
		}
808
798
		nofs_flag = memalloc_nofs_save();
809
		nofs_flag = memalloc_nofs_save();
799
		device = btrfs_alloc_device(NULL, &devid,
810
		device = btrfs_alloc_device(NULL, &devid,
800
					    disk_super->dev_item.uuid, path);
811
					    disk_super->dev_item.uuid, path);
Lines 1346-1372 struct btrfs_device *btrfs_scan_one_device(const char *path, blk_mode_t flags, Link Here
1346
		goto error_bdev_put;
1357
		goto error_bdev_put;
1347
	}
1358
	}
1348
1359
1349
	if (!mount_arg_dev && btrfs_super_num_devices(disk_super) == 1 &&
1360
	if (mount_arg_dev || btrfs_super_num_devices(disk_super) != 1 ||
1350
	    !(btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING)) {
1361
	    (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING))
1351
		dev_t devt;
1362
		new_device_added = true;
1352
1353
		ret = lookup_bdev(path, &devt);
1354
		if (ret)
1355
			btrfs_warn(NULL, "lookup bdev failed for path %s: %d",
1356
				   path, ret);
1357
		else
1358
			btrfs_free_stale_devices(devt, NULL);
1359
1360
		pr_debug("BTRFS: skip registering single non-seed device %s\n", path);
1361
		device = NULL;
1362
		goto free_disk_super;
1363
	}
1364
1363
1365
	device = device_list_add(path, disk_super, &new_device_added);
1364
	device = device_list_add(path, disk_super, &new_device_added);
1366
	if (!IS_ERR(device) && new_device_added)
1365
	if (!IS_ERR(device) && new_device_added)
1367
		btrfs_free_stale_devices(device->devt, device);
1366
		btrfs_free_stale_devices(device->devt, device);
1368
1367
1369
free_disk_super:
1370
	btrfs_release_disk_super(disk_super);
1368
	btrfs_release_disk_super(disk_super);
1371
1369
1372
error_bdev_put:
1370
error_bdev_put:

Return to bug 922809