• Jan Kara's avatar
    fs: Establish locking order for unrelated directories · f23ce757
    Jan Kara authored
    Currently the locking order of inode locks for directories that are not
    in ancestor relationship is not defined because all operations that
    needed to lock two directories like this were serialized by
    sb->s_vfs_rename_mutex. However some filesystems need to lock two
    subdirectories for RENAME_EXCHANGE operations and for this we need the
    locking order established even for two tree-unrelated directories.
    Provide a helper function lock_two_inodes() that establishes lock
    ordering for any two inodes and use it in lock_two_directories().
    
    CC: stable@vger.kernel.org
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Message-Id: <20230601105830.13168-4-jack@suse.cz>
    Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
    f23ce757
inode.c 68.5 KB