From: Sasha Levin <sashal@kernel.org> To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Aring <aahringo@redhat.com>, Andreas Gruenbacher <agruenba@redhat.com>, Sasha Levin <sashal@kernel.org>, cluster-devel@redhat.com Subject: [PATCH AUTOSEL 5.9 05/23] gfs2: set lockdep subclass for iopen glocks Date: Sat, 12 Dec 2020 11:07:46 -0500 [thread overview] Message-ID: <20201212160804.2334982-5-sashal@kernel.org> (raw) In-Reply-To: <20201212160804.2334982-1-sashal@kernel.org> From: Alexander Aring <aahringo@redhat.com> [ Upstream commit 515b269d5bd29a986d5e1c0a0cba87fa865a48b4 ] This patch introduce a new globs attribute to define the subclass of the glock lockref spinlock. This avoid the following lockdep warning, which occurs when we lock an inode lock while an iopen lock is held: ============================================ WARNING: possible recursive locking detected 5.10.0-rc3+ #4990 Not tainted -------------------------------------------- kworker/0:1/12 is trying to acquire lock: ffff9067d45672d8 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: lockref_get+0x9/0x20 but task is already holding lock: ffff9067da308588 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: delete_work_func+0x164/0x260 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&gl->gl_lockref.lock); lock(&gl->gl_lockref.lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by kworker/0:1/12: #0: ffff9067c1bfdd38 ((wq_completion)delete_workqueue){+.+.}-{0:0}, at: process_one_work+0x1b7/0x540 #1: ffffac594006be70 ((work_completion)(&(&gl->gl_delete)->work)){+.+.}-{0:0}, at: process_one_work+0x1b7/0x540 #2: ffff9067da308588 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: delete_work_func+0x164/0x260 stack backtrace: CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.10.0-rc3+ #4990 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 Workqueue: delete_workqueue delete_work_func Call Trace: dump_stack+0x8b/0xb0 __lock_acquire.cold+0x19e/0x2e3 lock_acquire+0x150/0x410 ? lockref_get+0x9/0x20 _raw_spin_lock+0x27/0x40 ? lockref_get+0x9/0x20 lockref_get+0x9/0x20 delete_work_func+0x188/0x260 process_one_work+0x237/0x540 worker_thread+0x4d/0x3b0 ? process_one_work+0x540/0x540 kthread+0x127/0x140 ? __kthread_bind_mask+0x60/0x60 ret_from_fork+0x22/0x30 Suggested-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- fs/gfs2/glock.c | 1 + fs/gfs2/glops.c | 1 + fs/gfs2/incore.h | 1 + 3 files changed, 3 insertions(+) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 120a4193a75a7..ac14ba220340d 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1038,6 +1038,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, gl->gl_node.next = NULL; gl->gl_flags = 0; gl->gl_name = name; + lockdep_set_subclass(&gl->gl_lockref.lock, glops->go_subclass); gl->gl_lockref.count = 1; gl->gl_state = LM_ST_UNLOCKED; gl->gl_target = LM_ST_UNLOCKED; diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 138500953b56f..27bffac51ed55 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -751,6 +751,7 @@ const struct gfs2_glock_operations gfs2_iopen_glops = { .go_callback = iopen_go_callback, .go_demote_ok = iopen_go_demote_ok, .go_flags = GLOF_LRU | GLOF_NONDISK, + .go_subclass = 1, }; const struct gfs2_glock_operations gfs2_flock_glops = { diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 387e99d6eda9e..d167307a36299 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h @@ -243,6 +243,7 @@ struct gfs2_glock_operations { const char *fs_id_buf); void (*go_callback)(struct gfs2_glock *gl, bool remote); void (*go_free)(struct gfs2_glock *gl); + const int go_subclass; const int go_type; const unsigned long go_flags; #define GLOF_ASPACE 1 /* address space attached */ -- 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org> To: cluster-devel.redhat.com Subject: [Cluster-devel] [PATCH AUTOSEL 5.9 05/23] gfs2: set lockdep subclass for iopen glocks Date: Sat, 12 Dec 2020 11:07:46 -0500 [thread overview] Message-ID: <20201212160804.2334982-5-sashal@kernel.org> (raw) In-Reply-To: <20201212160804.2334982-1-sashal@kernel.org> From: Alexander Aring <aahringo@redhat.com> [ Upstream commit 515b269d5bd29a986d5e1c0a0cba87fa865a48b4 ] This patch introduce a new globs attribute to define the subclass of the glock lockref spinlock. This avoid the following lockdep warning, which occurs when we lock an inode lock while an iopen lock is held: ============================================ WARNING: possible recursive locking detected 5.10.0-rc3+ #4990 Not tainted -------------------------------------------- kworker/0:1/12 is trying to acquire lock: ffff9067d45672d8 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: lockref_get+0x9/0x20 but task is already holding lock: ffff9067da308588 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: delete_work_func+0x164/0x260 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&gl->gl_lockref.lock); lock(&gl->gl_lockref.lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by kworker/0:1/12: #0: ffff9067c1bfdd38 ((wq_completion)delete_workqueue){+.+.}-{0:0}, at: process_one_work+0x1b7/0x540 #1: ffffac594006be70 ((work_completion)(&(&gl->gl_delete)->work)){+.+.}-{0:0}, at: process_one_work+0x1b7/0x540 #2: ffff9067da308588 (&gl->gl_lockref.lock){+.+.}-{3:3}, at: delete_work_func+0x164/0x260 stack backtrace: CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.10.0-rc3+ #4990 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 Workqueue: delete_workqueue delete_work_func Call Trace: dump_stack+0x8b/0xb0 __lock_acquire.cold+0x19e/0x2e3 lock_acquire+0x150/0x410 ? lockref_get+0x9/0x20 _raw_spin_lock+0x27/0x40 ? lockref_get+0x9/0x20 lockref_get+0x9/0x20 delete_work_func+0x188/0x260 process_one_work+0x237/0x540 worker_thread+0x4d/0x3b0 ? process_one_work+0x540/0x540 kthread+0x127/0x140 ? __kthread_bind_mask+0x60/0x60 ret_from_fork+0x22/0x30 Suggested-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- fs/gfs2/glock.c | 1 + fs/gfs2/glops.c | 1 + fs/gfs2/incore.h | 1 + 3 files changed, 3 insertions(+) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 120a4193a75a7..ac14ba220340d 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1038,6 +1038,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, gl->gl_node.next = NULL; gl->gl_flags = 0; gl->gl_name = name; + lockdep_set_subclass(&gl->gl_lockref.lock, glops->go_subclass); gl->gl_lockref.count = 1; gl->gl_state = LM_ST_UNLOCKED; gl->gl_target = LM_ST_UNLOCKED; diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 138500953b56f..27bffac51ed55 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -751,6 +751,7 @@ const struct gfs2_glock_operations gfs2_iopen_glops = { .go_callback = iopen_go_callback, .go_demote_ok = iopen_go_demote_ok, .go_flags = GLOF_LRU | GLOF_NONDISK, + .go_subclass = 1, }; const struct gfs2_glock_operations gfs2_flock_glops = { diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 387e99d6eda9e..d167307a36299 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h @@ -243,6 +243,7 @@ struct gfs2_glock_operations { const char *fs_id_buf); void (*go_callback)(struct gfs2_glock *gl, bool remote); void (*go_free)(struct gfs2_glock *gl); + const int go_subclass; const int go_type; const unsigned long go_flags; #define GLOF_ASPACE 1 /* address space attached */ -- 2.27.0
next prev parent reply other threads:[~2020-12-12 16:09 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-12 16:07 [PATCH AUTOSEL 5.9 01/23] drm/tegra: sor: Don't warn on probe deferral Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 02/23] drm/tegra: sor: Ensure regulators are disabled on teardown Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 03/23] drm/tegra: replace idr_init() by idr_init_base() Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 04/23] dm integrity: don't use drivers that have CRYPTO_ALG_ALLOCATES_MEMORY Sasha Levin 2020-12-12 16:07 ` [dm-devel] " Sasha Levin 2020-12-12 16:07 ` Sasha Levin [this message] 2020-12-12 16:07 ` [Cluster-devel] [PATCH AUTOSEL 5.9 05/23] gfs2: set lockdep subclass for iopen glocks Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 06/23] ASoC: rt5682: change SAR voltage threshold Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 07/23] kernel/cpu: add arch override for clear_tasks_mm_cpumask() mm handling Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 08/23] drm/tegra: sor: Disable clocks on error in tegra_sor_init() Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 09/23] selftests: tc-testing: enable CONFIG_NET_SCH_RED as a module Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 10/23] habanalabs: free host huge va_range if not used Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 11/23] habanalabs: put devices before driver removal Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 12/23] arm64: syscall: exit userspace before unmasking exceptions Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 13/23] vxlan: Add needed_headroom for lower device Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 14/23] vxlan: Copy needed_tailroom from lowerdev Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 15/23] scsi: storvsc: Validate length of incoming packet in storvsc_on_channel_callback() Sasha Levin 2020-12-12 16:07 ` Sasha Levin 2020-12-12 18:09 ` Andrea Parri 2020-12-12 18:09 ` Andrea Parri 2020-12-13 14:05 ` Sasha Levin 2020-12-13 14:05 ` Sasha Levin 2020-12-14 11:07 ` Dan Carpenter 2020-12-14 11:07 ` Dan Carpenter 2020-12-14 13:06 ` Konstantin Ryabitsev 2020-12-14 13:06 ` Konstantin Ryabitsev 2020-12-14 18:29 ` Sasha Levin 2020-12-14 18:29 ` Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 16/23] scsi: mpt3sas: Increase IOCInit request timeout to 30s Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 17/23] dm table: Remove BUG_ON(in_interrupt()) Sasha Levin 2020-12-12 16:07 ` [dm-devel] " Sasha Levin 2020-12-12 16:07 ` [PATCH AUTOSEL 5.9 18/23] iwlwifi: pcie: add one missing entry for AX210 Sasha Levin 2020-12-12 16:08 ` [PATCH AUTOSEL 5.9 19/23] iwlwifi: pcie: add some missing entries " Sasha Levin 2020-12-12 16:08 ` [PATCH AUTOSEL 5.9 20/23] drm/amd/display: Init clock value by current vbios CLKs Sasha Levin 2020-12-12 16:08 ` Sasha Levin 2020-12-12 16:08 ` [PATCH AUTOSEL 5.9 21/23] perf/x86/intel: Check PEBS status correctly Sasha Levin 2020-12-12 16:08 ` [PATCH AUTOSEL 5.9 22/23] kbuild: avoid split lines in .mod files Sasha Levin 2020-12-12 16:08 ` [PATCH AUTOSEL 5.9 23/23] tools/testing/selftests/vm: fix build error Sasha Levin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20201212160804.2334982-5-sashal@kernel.org \ --to=sashal@kernel.org \ --cc=aahringo@redhat.com \ --cc=agruenba@redhat.com \ --cc=cluster-devel@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=stable@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.