Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751498AbcKGBhs (ORCPT ); Sun, 6 Nov 2016 20:37:48 -0500 Received: from casper.infradead.org ([85.118.1.10]:56068 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbcKGBhl (ORCPT ); Sun, 6 Nov 2016 20:37:41 -0500 Date: Mon, 7 Nov 2016 01:37:31 +0000 (GMT) From: James Simmons To: Oleg Drokin cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Linux Kernel Mailing List , Lustre Development List , Hongchao Zhang Subject: Re: [PATCH 02/14] staging/lustre/ldlm: fix export reference problem In-Reply-To: <1478136304-867780-3-git-send-email-green@linuxhacker.ru> Message-ID: References: <1478136304-867780-1-git-send-email-green@linuxhacker.ru> <1478136304-867780-3-git-send-email-green@linuxhacker.ru> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161107_013731_695051_F3FCEE91 X-CRM114-Status: GOOD ( 16.27 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2670 Lines: 77 > From: Hongchao Zhang > > 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. Reviewed-by: James Simmons > Signed-off-by: Hongchao Zhang > Reviewed-on: http://review.whamcloud.com/22031 > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8500 > Reviewed-by: James Simmons > Reviewed-by: Bobi Jam > Signed-off-by: Oleg Drokin > --- > 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 > >