[SRU][J][PATCH 1/1] UBUNTU: SAUCE: Revert "btrfs: avoid unnecessary device path update for the same device"
Matthew Ruffell
matthew.ruffell at canonical.com
Wed May 14 07:39:22 UTC 2025
BugLink: https://bugs.launchpad.net/bugs/2107516
This reverts commit fc83c00ca63bc3a29778957170ccb96fabccf44c (ubuntu-jammy).
"btrfs: avoid unnecessary device path update for the same device" introduced
a regression in the jammy kernel that manifests in two ways.
1) When mounting a btrfs LVM volume, the path changes from
/dev/mapper/VG0-LV0
to
/dev/VG0/LV0
which breaks existing applications that expect a /dev/mapper file.
2) Running lsblk with duplicated mountpoints no longer list all mountpoints
and instead only prints the first one, e.g.:
sdb 8:16 0 9,1T 0 disk
└─sdb1 8:17 0 9,1T 0 part
└─hdd2 254:6 0 9,1T 0 crypt /mnt/hdd2
/var/cache/distfiles
/var/cache/binpkgs
becomes
sdb 8:16 0 9,1T 0 disk
└─sdb1 8:17 0 9,1T 0 part
└─hdd2 254:6 0 9,1T 0 crypt /mnt/hdd2
The author of the patch helped debug the issue in [1] and came to the
conclusion that this patch requires the new btrfs fsconfig mount API
that was introduced in 6.8 and onward.
[1] https://bugs.gentoo.org/947126
Hence, we need to revert this patch for jammy.
Signed-off-by: Matthew Ruffell <matthew.ruffell at canonical.com>
---
fs/btrfs/volumes.c | 38 +-------------------------------------
1 file changed, 1 insertion(+), 37 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c0fcac0a1b8e..b5e2daf538d4 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -717,42 +717,6 @@ u8 *btrfs_sb_fsid_ptr(struct btrfs_super_block *sb)
return has_metadata_uuid ? sb->metadata_uuid : sb->fsid;
}
-static bool is_same_device(struct btrfs_device *device, const char *new_path)
-{
- struct path old = { .mnt = NULL, .dentry = NULL };
- struct path new = { .mnt = NULL, .dentry = NULL };
- char *old_path = NULL;
- bool is_same = false;
- int ret;
-
- if (!device->name)
- goto out;
-
- old_path = kzalloc(PATH_MAX, GFP_NOFS);
- if (!old_path)
- goto out;
-
- rcu_read_lock();
- ret = strscpy(old_path, rcu_str_deref(device->name), PATH_MAX);
- rcu_read_unlock();
- if (ret < 0)
- goto out;
-
- ret = kern_path(old_path, LOOKUP_FOLLOW, &old);
- if (ret)
- goto out;
- ret = kern_path(new_path, LOOKUP_FOLLOW, &new);
- if (ret)
- goto out;
- if (path_equal(&old, &new))
- is_same = true;
-out:
- kfree(old_path);
- path_put(&old);
- path_put(&new);
- return is_same;
-}
-
/*
* Handle scanned device having its CHANGING_FSID_V2 flag set and the fs_devices
* being created with a disk that has already completed its fsid change. Such
@@ -958,7 +922,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
disk_super->fsid, devid, found_transid, path,
current->comm, task_pid_nr(current));
- } else if (!device->name || !is_same_device(device, path)) {
+ } else if (!device->name || strcmp(device->name->str, path)) {
/*
* When FS is already mounted.
* 1. If you are here and if the device->name is NULL that
--
2.45.2
More information about the kernel-team
mailing list