From: Oleg Drokin <green@linuxhacker.ru>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Andreas Dilger <andreas.dilger@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lustre Development List <lustre-devel@lists.lustre.org>,
Oleg Drokin <green@linuxhacker.ru>
Subject: [PATCH v2 29/29] staging: lustre: quiet lockdep recursive lock warning
Date: Mon, 20 Jun 2016 16:55:52 -0400 [thread overview]
Message-ID: <1466456152-2199975-30-git-send-email-green@linuxhacker.ru> (raw)
In-Reply-To: <1466456152-2199975-1-git-send-email-green@linuxhacker.ru>
From: Andreas Dilger <andreas.dilger@intel.com>
Lockdep complains about potential recursive locking during mount
because the client configuration log is holding a lock on the MGC
obd_device to prevent it from being torn down, while also getting
mutexes on the MDC and OSC devices as they are instantiated:
Lustre: Mounted myth-client
=============================================
[ INFO: possible recursive locking detected ]
4.7.0-rc2-vm-nfs+ #127 Tainted: G C
---------------------------------------------
May be due to missing lock nesting notation
2 locks held by ll_cfg_requeue/5928:
#0: (&cli->cl_sem){.+.+.+}, at: mgc_requeue_thread+0x15d/0x730 [mgc]
#1: (&cld->cld_lock){+.+.+.}, at: mgc_process_log+0x5e/0xf80 [mgc]
CPU: 0 PID: 5928 Comm: ll_cfg_requeue
Call Trace:
[<ffffffff814a0855>] dump_stack+0x86/0xc1
[<ffffffff810e7766>] __lock_acquire+0x726/0x1210
[<ffffffff810e86be>] lock_acquire+0xfe/0x1f0
[<ffffffff81888171>] down_read+0x51/0xa0
[<ffffffffa04a8477>] sptlrpc_conf_client_adapt+0x47/0x150 [ptlrpc]
[<ffffffffa0186b16>] mdc_set_info_async+0x2b6/0x470 [mdc]
[<ffffffffa0294090>] class_notify_sptlrpc_conf+0x190/0x360 [obdclass]
[<ffffffffa01a9e85>] mgc_process_log+0x925/0xf80 [mgc]
[<ffffffffa01abafa>] mgc_requeue_thread+0x1fa/0x730 [mgc]
[<ffffffff810af331>] kthread+0x101/0x120
[<ffffffff8188ad6f>] ret_from_fork+0x1f/0x40
Add a separate lock class for the MGC callpath, since it will always
be held first, and none of the other obd_device locks should ever
be held concurrently.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
drivers/staging/lustre/lustre/include/obd.h | 6 ++++++
drivers/staging/lustre/lustre/mgc/mgc_request.c | 4 +++-
drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 2 +-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index ed1081a..593d107 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -228,6 +228,12 @@ enum {
#define MDC_MAX_RIF_DEFAULT 8
#define MDC_MAX_RIF_MAX 512
+enum obd_cl_sem_lock_class {
+ OBD_CLI_SEM_NORMAL,
+ OBD_CLI_SEM_MGC,
+ OBD_CLI_SEM_MDCOSC,
+};
+
struct mdc_rpc_lock;
struct obd_import;
struct client_obd {
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index fbbf276..9d0bd47 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -496,7 +496,9 @@ static void do_requeue(struct config_llog_data *cld)
* export which is being disconnected. Take the client
* semaphore to make the check non-racy.
*/
- down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem);
+ down_read_nested(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem,
+ OBD_CLI_SEM_MGC);
+
if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) {
int rc;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
index 1238c87..c140354 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_config.c
@@ -815,7 +815,7 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd)
CDEBUG(D_SEC, "obd %s\n", obd->u.cli.cl_target_uuid.uuid);
/* serialize with connect/disconnect import */
- down_read(&obd->u.cli.cl_sem);
+ down_read_nested(&obd->u.cli.cl_sem, OBD_CLI_SEM_MDCOSC);
imp = obd->u.cli.cl_import;
if (imp) {
--
2.7.4
prev parent reply other threads:[~2016-06-20 21:09 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 20:55 [PATCH v2 00/29] Lustre fixes Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 01/29] staging/lustre/llite: allocate and free client cache asynchronously Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 02/29] staging/lustre/llite: correct request handling after ll_lookup_it() Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 03/29] staging/lustre/llite: Get rid of ll_lock_dcache/ll_unlock_dcache Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 04/29] staging/lustre/llite: lock i_lock before __d_drop() Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 05/29] staging/lustre/osc: osc_lock_weight endless loop fix Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 06/29] staging/lustre/osc: Fix reverted condition in osc_lock_weight Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 07/29] staging/lustre/ptlrpc: reorganize ptlrpc_request Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 08/29] staging/lustre/ptlrpc: missing wakeup for ptlrpc_check_set Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 09/29] staging/lustre/ptlrpc: Early Reply vs Reply MDunlink Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 10/29] staging/lustre/ptlrpc: Remove __ptlrpc_request_bufs_pack Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 11/29] staging/lustre/ptlrpc: lost bulk leads to a hang Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 12/29] staging/lustre/llite: take trunc_sem only at vvp layer Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 13/29] staging/lustre: LDLM_DEBUG() shouldn't be passed \n Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 14/29] staging/lustre: Add newline to LU_OBJECT_DEBUG() message Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 15/29] staging/lustre/llite: flatten struct lookup_intent Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 16/29] staging/lustre: Inline Lustre intent disposition functions Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 17/29] staging/lustre/llite: change it_data to it_request Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 18/29] staging/lustre/ldlm: const qualify struct lustre_handle * params Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 21/29] staging/lustre/llite: don't panic when fid is insane Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 22/29] staging/lustre/llite: Restore proper opencache operations Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 23/29] staging/lustre/llite: ll_revalidate_dentry update Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 24/29] staging/lustre/llite: IOC_MDC_GETFILEINFO returns the wrong ino Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 25/29] staging/lustre/osc: fix signed one bit field Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 26/29] staging/lustre: Add documentation for unstable_stats in sysfs Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 27/29] staging/lustre/osc: glimpse lock should match only with granted locks Oleg Drokin
2016-06-20 20:55 ` [PATCH v2 28/29] staging/lustre/libcfs: Do not call kthread_run in wrong state Oleg Drokin
2016-06-20 20:55 ` Oleg Drokin [this message]
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=1466456152-2199975-30-git-send-email-green@linuxhacker.ru \
--to=green@linuxhacker.ru \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome