mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Drokin <green@linuxhacker.ru>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	James Simmons <jsimmons@infradead.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>,
	Hongchao Zhang <hongchao.zhang@intel.com>,
	Oleg Drokin <green@linuxhacker.ru>
Subject: [PATCH 02/14] staging/lustre/ldlm: fix export reference problem
Date: Wed,  2 Nov 2016 21:24:52 -0400	[thread overview]
Message-ID: <1478136304-867780-3-git-send-email-green@linuxhacker.ru> (raw)
In-Reply-To: <1478136304-867780-1-git-send-email-green@linuxhacker.ru>

From: Hongchao Zhang <hongchao.zhang@intel.com>

1, in client_import_del_conn, the export returned from
   class_conn2export is not released after using it.

2, in ptlrpc_connect_interpret, the export is not released
   if the connect_flags isn't compatible.

Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/22031
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8500
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c |  3 +++
 drivers/staging/lustre/lustre/ptlrpc/import.c | 19 ++++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 4f9480e..06d3cc6 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -170,6 +170,9 @@ int client_import_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
 				ptlrpc_connection_put(dlmexp->exp_connection);
 				dlmexp->exp_connection = NULL;
 			}
+
+			if (dlmexp)
+				class_export_put(dlmexp);
 		}
 
 		list_del(&imp_conn->oic_item);
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c
index 46ba5a4..05fd92d 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/import.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
@@ -972,6 +972,16 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 
 	spin_unlock(&imp->imp_lock);
 
+	if (!exp) {
+		/* This could happen if export is cleaned during the
+		 * connect attempt
+		 */
+		CERROR("%s: missing export after connect\n",
+		       imp->imp_obd->obd_name);
+		rc = -ENODEV;
+		goto out;
+	}
+
 	/* check that server granted subset of flags we asked for. */
 	if ((ocd->ocd_connect_flags & imp->imp_connect_flags_orig) !=
 	    ocd->ocd_connect_flags) {
@@ -982,15 +992,6 @@ static int ptlrpc_connect_interpret(const struct lu_env *env,
 		goto out;
 	}
 
-	if (!exp) {
-		/* This could happen if export is cleaned during the
-		 * connect attempt
-		 */
-		CERROR("%s: missing export after connect\n",
-		       imp->imp_obd->obd_name);
-		rc = -ENODEV;
-		goto out;
-	}
 	old_connect_flags = exp_connect_flags(exp);
 	exp->exp_connect_data = *ocd;
 	imp->imp_obd->obd_self_export->exp_connect_data = *ocd;
-- 
2.7.4

  parent reply	other threads:[~2016-11-03  1:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03  1:24 [PATCH 00/14] Lustre fixes Oleg Drokin
2016-11-03  1:24 ` [PATCH 01/14] staging/lustre/ldlm: Drop unused blocking_refs flock field Oleg Drokin
2016-11-07  1:38   ` James Simmons
2016-11-03  1:24 ` Oleg Drokin [this message]
2016-11-07  1:37   ` [PATCH 02/14] staging/lustre/ldlm: fix export reference problem James Simmons
2016-11-03  1:24 ` [PATCH 03/14] staging/lustre: conflicting PW & PR extent locks on a client Oleg Drokin
2016-11-07  1:52   ` James Simmons
2016-11-03  1:24 ` [PATCH 04/14] staging/lustre/llite: clear inode timestamps after losing UPDATE lock Oleg Drokin
2016-11-07  1:38   ` James Simmons
2016-11-03  1:24 ` [PATCH 05/14] staging/lustre: Get rid of cl_env hash table Oleg Drokin
2016-11-07  1:53   ` James Simmons
2016-11-03  1:24 ` [PATCH 06/14] staging/lustre/llite: drop_caches hangs in cl_inode_fini() Oleg Drokin
2016-11-07  1:54   ` James Simmons
2016-11-03  1:24 ` [PATCH 07/14] staging/lustre/ldlm: Reinstate ldlm_enqueue_pack() Oleg Drokin
2016-11-07  1:53   ` James Simmons
2016-11-03  1:24 ` [PATCH 08/14] staging/lustre/ldlm: engage ELC for all ldlm enqueue req Oleg Drokin
2016-11-07  1:55   ` James Simmons
2016-11-03  1:24 ` [PATCH 09/14] staging/lustre/ptlrpc: Suppress error for flock requests Oleg Drokin
2016-11-07  1:57   ` James Simmons
2016-11-03  1:25 ` [PATCH 10/14] staging/lustre/llite: protect from accessing NULL lli_clob Oleg Drokin
2016-11-07  1:55   ` James Simmons
2016-11-03  1:25 ` [PATCH 11/14] staging/lustre/ptlrpc: Correctly calculate hrp->hrp_nthrs Oleg Drokin
2016-11-07  1:58   ` James Simmons
2016-11-03  1:25 ` [PATCH 12/14] staging/lustre/llite: update ras window correctly Oleg Drokin
2016-11-07  1:57   ` James Simmons
2016-11-03  1:25 ` [PATCH 13/14] staging/lustre/llite: do not clear uptodate bit in page delete Oleg Drokin
2016-11-07  1:56   ` James Simmons
2016-11-03  1:25 ` [PATCH 14/14] staging/lustre: Get rid of LIBLUSTRE_CLIENT and its users Oleg Drokin
2016-11-07  1:56   ` James Simmons

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=1478136304-867780-3-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=hongchao.zhang@intel.com \
    --cc=jsimmons@infradead.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