]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
btrfs: don't set lock_owner when locking extent buffer for reading
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Thu, 9 Jun 2022 02:39:36 +0000 (22:39 -0400)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 26 Aug 2022 08:53:55 +0000 (10:53 +0200)
commitee5ec96b6c4038cdf3efcfbff2e802770aba44df
tree4acc845c79cf7bd4a1c333fee72acb6c78ed648e
parent50ffebca80419fd92848b6dfd725f5984cace896
btrfs: don't set lock_owner when locking extent buffer for reading

BugLink: https://bugs.launchpad.net/bugs/1986718
commit 97e86631bccddfbbe0c13f9a9605cdef11d31296 upstream.

In 196d59ab9ccc "btrfs: switch extent buffer tree lock to rw_semaphore"
the functions for tree read locking were rewritten, and in the process
the read lock functions started setting eb->lock_owner = current->pid.
Previously lock_owner was only set in tree write lock functions.

Read locks are shared, so they don't have exclusive ownership of the
underlying object, so setting lock_owner to any single value for a
read lock makes no sense.  It's mostly harmless because write locks
and read locks are mutually exclusive, and none of the existing code
in btrfs (btrfs_init_new_buffer and print_eb_refs_lock) cares what
nonsense is written in lock_owner when no writer is holding the lock.

KCSAN does care, and will complain about the data race incessantly.
Remove the assignments in the read lock functions because they're
useless noise.

Fixes: 196d59ab9ccc ("btrfs: switch extent buffer tree lock to rw_semaphore")
CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/btrfs/locking.c