Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-6.9-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fix from David Sterba:
"Fix a problem found in 6.7 after adding the temp-fsid feature which
changed device tracking in memory and broke grub-probe. This is used
on initrd-less systems. There were several iterations of the fix and
it took longer than expected"

* tag 'for-6.9-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: do not skip re-registration for the mounted device

+47 -11
+47 -11
fs/btrfs/volumes.c
··· 1303 1303 return ret; 1304 1304 } 1305 1305 1306 + static bool btrfs_skip_registration(struct btrfs_super_block *disk_super, 1307 + const char *path, dev_t devt, 1308 + bool mount_arg_dev) 1309 + { 1310 + struct btrfs_fs_devices *fs_devices; 1311 + 1312 + /* 1313 + * Do not skip device registration for mounted devices with matching 1314 + * maj:min but different paths. Booting without initrd relies on 1315 + * /dev/root initially, later replaced with the actual root device. 1316 + * A successful scan ensures grub2-probe selects the correct device. 1317 + */ 1318 + list_for_each_entry(fs_devices, &fs_uuids, fs_list) { 1319 + struct btrfs_device *device; 1320 + 1321 + mutex_lock(&fs_devices->device_list_mutex); 1322 + 1323 + if (!fs_devices->opened) { 1324 + mutex_unlock(&fs_devices->device_list_mutex); 1325 + continue; 1326 + } 1327 + 1328 + list_for_each_entry(device, &fs_devices->devices, dev_list) { 1329 + if (device->bdev && (device->bdev->bd_dev == devt) && 1330 + strcmp(device->name->str, path) != 0) { 1331 + mutex_unlock(&fs_devices->device_list_mutex); 1332 + 1333 + /* Do not skip registration. */ 1334 + return false; 1335 + } 1336 + } 1337 + mutex_unlock(&fs_devices->device_list_mutex); 1338 + } 1339 + 1340 + if (!mount_arg_dev && btrfs_super_num_devices(disk_super) == 1 && 1341 + !(btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING)) 1342 + return true; 1343 + 1344 + return false; 1345 + } 1346 + 1306 1347 /* 1307 1348 * Look for a btrfs signature on a device. This may be called out of the mount path 1308 1349 * and we are not allowed to call set_blocksize during the scan. The superblock ··· 1361 1320 struct btrfs_device *device = NULL; 1362 1321 struct file *bdev_file; 1363 1322 u64 bytenr, bytenr_orig; 1323 + dev_t devt; 1364 1324 int ret; 1365 1325 1366 1326 lockdep_assert_held(&uuid_mutex); ··· 1401 1359 goto error_bdev_put; 1402 1360 } 1403 1361 1404 - if (!mount_arg_dev && btrfs_super_num_devices(disk_super) == 1 && 1405 - !(btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING)) { 1406 - dev_t devt; 1362 + devt = file_bdev(bdev_file)->bd_dev; 1363 + if (btrfs_skip_registration(disk_super, path, devt, mount_arg_dev)) { 1364 + pr_debug("BTRFS: skip registering single non-seed device %s (%d:%d)\n", 1365 + path, MAJOR(devt), MINOR(devt)); 1407 1366 1408 - ret = lookup_bdev(path, &devt); 1409 - if (ret) 1410 - btrfs_warn(NULL, "lookup bdev failed for path %s: %d", 1411 - path, ret); 1412 - else 1413 - btrfs_free_stale_devices(devt, NULL); 1367 + btrfs_free_stale_devices(devt, NULL); 1414 1368 1415 - pr_debug("BTRFS: skip registering single non-seed device %s (%d:%d)\n", 1416 - path, MAJOR(devt), MINOR(devt)); 1417 1369 device = NULL; 1418 1370 goto free_disk_super; 1419 1371 }