From patchwork Mon Sep 30 18:56:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167303 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C78B11599 for ; Mon, 30 Sep 2019 19:07:14 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AFC0B224EF for ; Mon, 30 Sep 2019 19:07:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFC0B224EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 0D5275E4E3D; Mon, 30 Sep 2019 12:01:15 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id BE0725C3A7B for ; Mon, 30 Sep 2019 11:57:40 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id CCA9B1005F9C; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id C98D0BD; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:56:30 -0400 Message-Id: <1569869810-23848-132-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 131/151] lustre: ldlm: fix export reference X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hongchao Zhang , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Hongchao Zhang In ptlrpc_connect_interpert, the export reference could be leaked if there is error before the following class_exp_put. WC-bug-id: https://jira.whamcloud.com/browse/LU-10656 Lustre-commit: e52f2ea40e55 ("LU-10656 ldlm: fix export reference") Signed-off-by: Hongchao Zhang Reviewed-on: https://review.whamcloud.com/31139 Reviewed-by: Andreas Dilger Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/ptlrpc/import.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/lustre/ptlrpc/import.c b/fs/lustre/ptlrpc/import.c index 152a84c..6fc0c6b 100644 --- a/fs/lustre/ptlrpc/import.c +++ b/fs/lustre/ptlrpc/import.c @@ -935,7 +935,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, u64 old_connect_flags; int msg_flags; struct obd_connect_data *ocd; - struct obd_export *exp; + struct obd_export *exp = NULL; int ret; spin_lock(&imp->imp_lock); @@ -1040,6 +1040,8 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, rc = ptlrpc_connect_set_flags(imp, ocd, old_connect_flags, exp, aa->pcaa_initial_connect); class_export_put(exp); + exp = NULL; + if (rc) goto out; @@ -1205,6 +1207,9 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, imp->imp_connect_tried = 1; spin_unlock(&imp->imp_lock); + if (exp) + class_export_put(exp); + if (rc != 0) { IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON); if (rc == -EACCES) {