linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 01/28] gfs2: release iopen glock early in evict
@ 2021-11-26  2:33 Sasha Levin
  2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 02/28] gfs2: Fix length of holes reported at end-of-file Sasha Levin
                   ` (26 more replies)
  0 siblings, 27 replies; 31+ messages in thread
From: Sasha Levin @ 2021-11-26  2:33 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bob Peterson, Andreas Gruenbacher, Sasha Levin, cluster-devel

From: Bob Peterson <rpeterso@redhat.com>

[ 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>
---
 fs/gfs2/super.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 6a355e1347d7f..d2b7ecbd1b150 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -1438,13 +1438,6 @@ static void gfs2_evict_inode(struct inode *inode)
 	gfs2_ordered_del_inode(ip);
 	clear_inode(inode);
 	gfs2_dir_hash_inval(ip);
-	if (ip->i_gl) {
-		glock_clear_object(ip->i_gl, ip);
-		wait_on_bit_io(&ip->i_flags, GIF_GLOP_PENDING, TASK_UNINTERRUPTIBLE);
-		gfs2_glock_add_to_lru(ip->i_gl);
-		gfs2_glock_put_eventually(ip->i_gl);
-		ip->i_gl = NULL;
-	}
 	if (gfs2_holder_initialized(&ip->i_iopen_gh)) {
 		struct gfs2_glock *gl = ip->i_iopen_gh.gh_gl;
 
@@ -1457,6 +1450,13 @@ static void gfs2_evict_inode(struct inode *inode)
 		gfs2_holder_uninit(&ip->i_iopen_gh);
 		gfs2_glock_put_eventually(gl);
 	}
+	if (ip->i_gl) {
+		glock_clear_object(ip->i_gl, ip);
+		wait_on_bit_io(&ip->i_flags, GIF_GLOP_PENDING, TASK_UNINTERRUPTIBLE);
+		gfs2_glock_add_to_lru(ip->i_gl);
+		gfs2_glock_put_eventually(ip->i_gl);
+		ip->i_gl = NULL;
+	}
 }
 
 static struct inode *gfs2_alloc_inode(struct super_block *sb)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2021-12-03 18:25 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26  2:33 [PATCH AUTOSEL 5.10 01/28] gfs2: release iopen glock early in evict Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 02/28] gfs2: Fix length of holes reported at end-of-file Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 03/28] powerpc/pseries/ddw: Revert "Extend upper limit for huge DMA window for persistent memory" Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 04/28] drm/sun4i: fix unmet dependency on RESET_CONTROLLER for PHY_SUN6I_MIPI_DPHY Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 05/28] mac80211: do not access the IV when it was stripped Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 06/28] tun: fix bonding active backup with arp monitoring Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 07/28] net/smc: Transfer remaining wait queue entries during fallback Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 08/28] atlantic: Fix OOB read and write in hw_atl_utils_fw_rpc_wait Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 09/28] net: return correct error code Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 10/28] pinctrl: amd: Fix wakeups when IRQ is shared with SCI Sasha Levin
2021-11-29 14:47   ` Limonciello, Mario
2021-11-29 18:53     ` Limonciello, Mario
2021-12-03 18:25       ` Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 11/28] pinctrl: qcom: fix unmet dependencies on GPIOLIB for GPIOLIB_IRQCHIP Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 12/28] platform/x86: thinkpad_acpi: Add support for dual fan control Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 13/28] platform/x86: thinkpad_acpi: Fix WWAN device disabled issue after S3 deep Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 14/28] s390/setup: avoid using memblock_enforce_memory_limit Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 15/28] btrfs: check-integrity: fix a warning on write caching disabled disk Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 16/28] thermal: core: Reset previous low and high trip during thermal zone init Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 17/28] scsi: iscsi: Unblock session then wake up error handler Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 18/28] drm/amd/amdkfd: Fix kernel panic when reset failed and been triggered again Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 19/28] drm/amd/amdgpu: fix potential memleak Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 20/28] ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 21/28] ata: libahci: Adjust behavior when StorageD3Enable _DSD is set Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 22/28] ethernet: hisilicon: hns: hns_dsaf_misc: fix a possible array overflow in hns_dsaf_ge_srst_by_port() Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 23/28] ipv6: check return value of ipv6_skip_exthdr Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 24/28] net: tulip: de4x5: fix the problem that the array 'lp->phy[8]' may be out of bound Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 25/28] net: ethernet: dec: tulip: de4x5: fix possible array overflows in type3_infoblock() Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 26/28] perf inject: Fix ARM SPE handling Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 27/28] perf hist: Fix memory leak of a perf_hpp_fmt Sasha Levin
2021-11-26  2:33 ` [PATCH AUTOSEL 5.10 28/28] perf report: Fix memory leaks around perf_tip() Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).