]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
gfs2: release iopen glock early in evict
authorBob Peterson <rpeterso@redhat.com>
Thu, 28 Oct 2021 16:53:10 +0000 (11:53 -0500)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 4 Jan 2022 08:49:04 +0000 (09:49 +0100)
commit01e285dc4e582d120b017a1dc1d4884738fa7327
treef30116820b03821a7586d6c009a3b930ccd1d51c
parentf8624987ebd867404b92193a68cce594376e57a8
gfs2: release iopen glock early in evict

BugLink: https://bugs.launchpad.net/bugs/1953731
[ Upstream commit 49462e2be119d38c5eb5759d0d1b712df3a41239 ]

Before this patch, evict would clear the iopen glock's gl_object after
releasing the inode glock.  In the meantime, another process could reuse
the same block and thus glocks for a new inode.  It would lock the inode
glock (exclusively), and then the iopen glock (shared).  The shared
locking mode doesn't provide any ordering against the evict, so by the
time the iopen glock is reused, evict may not have gotten to setting
gl_object to NULL.

Fix that by releasing the iopen glock before the inode glock in
gfs2_evict_inode.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>gl_object
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/gfs2/super.c