commit:     86a9c611fce242023f2df0c91b0ea3699a4525c2
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 00:05:23 2024 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 00:05:23 2024 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=86a9c611

Revert of btrfs patch, thanks to David Duchesne

Reverted:
btrfs: avoid unnecessary device path update for the same device

Bug: https://bugs.gentoo.org/947126

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README                                |  4 +++
 1900_revert-btrfs-device-path-update.patch | 56 ++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/0000_README b/0000_README
index 578b4cdb..cc6bd8cc 100644
--- a/0000_README
+++ b/0000_README
@@ -331,6 +331,10 @@ Patch:  
2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
 From:   
https://lore.kernel.org/linux-bluetooth/[email protected]/raw
 Desc:   Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. 
See bug #686758
 
+Patch:  1900_revert-btrfs-device-path-update.patch
+From:   https://bugs.gentoo.org/947126
+Desc:   revert: btrfs: avoid unnecessary device path update for the same device
+
 Patch:  2010_netfilter-nf-tables-bail-if-stateful-expr-provides-no-clone.patch
 From:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 Desc:   netfilter: nf_tables: bail out if stateful expression provides no 
.clone

diff --git a/1900_revert-btrfs-device-path-update.patch 
b/1900_revert-btrfs-device-path-update.patch
new file mode 100644
index 00000000..4dfc9cb4
--- /dev/null
+++ b/1900_revert-btrfs-device-path-update.patch
@@ -0,0 +1,56 @@
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
+index b9a0b26d08e1..28cb91af4c49 100644
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -689,42 +689,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
+@@ -924,7 +888,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

Reply via email to