Patch "btrfs: change the lockdep class of free space inode's invalidate_lock" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    btrfs: change the lockdep class of free space inode's invalidate_lock

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-change-the-lockdep-class-of-free-space-inode-s.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a029bfa12be1da1c419fa9f774fbb645899d2832
Author: Ioannis Angelakopoulos <iangelak@xxxxxx>
Date:   Mon Jul 25 15:11:57 2022 -0700

    btrfs: change the lockdep class of free space inode's invalidate_lock
    
    [ Upstream commit 9d7464c87b159bbf763c24faeb7a2dcaac96e4a1 ]
    
    Reinitialize the class of the lockdep map for struct inode's
    mapping->invalidate_lock in load_free_space_cache() function in
    fs/btrfs/free-space-cache.c. This will prevent lockdep from producing
    false positives related to execution paths that make use of free space
    inodes and paths that make use of normal inodes.
    
    Specifically, with this change lockdep will create separate lock
    dependencies that include the invalidate_lock, in the case that free
    space inodes are used and in the case that normal inodes are used.
    
    The lockdep class for this lock was first initialized in
    inode_init_always() in fs/inode.c.
    
    Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
    Signed-off-by: Ioannis Angelakopoulos <iangelak@xxxxxx>
    Signed-off-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 85404c62a1c2..835071fa39a9 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -920,6 +920,8 @@ static int copy_free_space_cache(struct btrfs_block_group *block_group,
 	return ret;
 }
 
+static struct lock_class_key btrfs_free_space_inode_key;
+
 int load_free_space_cache(struct btrfs_block_group *block_group)
 {
 	struct btrfs_fs_info *fs_info = block_group->fs_info;
@@ -989,6 +991,14 @@ int load_free_space_cache(struct btrfs_block_group *block_group)
 	}
 	spin_unlock(&block_group->lock);
 
+	/*
+	 * Reinitialize the class of struct inode's mapping->invalidate_lock for
+	 * free space inodes to prevent false positives related to locks for normal
+	 * inodes.
+	 */
+	lockdep_set_class(&(&inode->i_data)->invalidate_lock,
+			  &btrfs_free_space_inode_key);
+
 	ret = __load_free_space_cache(fs_info->tree_root, inode, &tmp_ctl,
 				      path, block_group->start);
 	btrfs_free_path(path);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux