mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org,
	Andreas Dilger <andreas.dilger@intel.com>,
	Oleg Drokin <oleg.drokin@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lustre Development List <lustre-devel@lists.lustre.org>,
	Jinshan Xiong <jinshan.xiong@intel.com>,
	James Simmons <jsimmons@infradead.org>
Subject: [PATCH 04/14] staging: lustre: lov: cleanup when cl_io_iter_init() fails
Date: Sat, 18 Feb 2017 16:47:05 -0500	[thread overview]
Message-ID: <1487454435-4895-5-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1487454435-4895-1-git-send-email-jsimmons@infradead.org>

From: Jinshan Xiong <jinshan.xiong@intel.com>

In lov_io_iter_init(), if cl_io_iter_init() against sub io fails,
it should call cl_io_iter_fini() to cleanup leftover information;

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6271
Reviewed-on: http://review.whamcloud.com/16456
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lustre/lov/lov_io.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c
index e0f0756..df77b25 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -424,21 +424,23 @@ static int lov_io_iter_init(const struct lu_env *env,
 
 		end = lov_offset_mod(end, 1);
 		sub = lov_sub_get(env, lio, stripe);
-		if (!IS_ERR(sub)) {
-			lov_io_sub_inherit(sub->sub_io, lio, stripe,
-					   start, end);
-			rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
-			lov_sub_put(sub);
-			CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n",
-			       stripe, start, end);
-		} else {
+		if (IS_ERR(sub)) {
 			rc = PTR_ERR(sub);
+			break;
 		}
 
-		if (!rc)
-			list_add_tail(&sub->sub_linkage, &lio->lis_active);
-		else
+		lov_io_sub_inherit(sub->sub_io, lio, stripe, start, end);
+		rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
+		if (rc)
+			cl_io_iter_fini(sub->sub_env, sub->sub_io);
+		lov_sub_put(sub);
+		if (rc)
 			break;
+
+		CDEBUG(D_VFSTRACE, "shrink: %d [%llu, %llu)\n",
+		       stripe, start, end);
+
+		list_add_tail(&sub->sub_linkage, &lio->lis_active);
 	}
 	return rc;
 }
-- 
1.8.3.1

  parent reply	other threads:[~2017-02-18 21:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18 21:47 [PATCH 00/14] staging: lustre: missing fixes from lustre 2.8 James Simmons
2017-02-18 21:47 ` [PATCH 01/14] staging: lustre: llite: lower message level for ll_setattr_raw() James Simmons
2017-02-18 21:47 ` [PATCH 02/14] staging: lustre: llite: omit to update wire data James Simmons
2017-02-18 21:47 ` [PATCH 03/14] staging: lustre: osc: remove obsolete asserts James Simmons
2017-02-18 21:47 ` James Simmons [this message]
2017-02-18 21:47 ` [PATCH 05/14] staging: lustre: ldlm: handle ldlm lock cancel race when evicting client James Simmons
2017-02-18 21:47 ` [PATCH 06/14] staging: lustre: osc: further LRU OSC cleanup after eviction James Simmons
2017-02-18 21:47 ` [PATCH 07/14] staging: lustre: lov: trying smaller memory allocations James Simmons
2017-02-18 21:47 ` [PATCH 08/14] staging: lustre: llite: remove extraneous export parameter James Simmons
2017-02-18 21:47 ` [PATCH 09/14] staging: lustre: ldlm: reduce ldlm pool recalc window James Simmons
2017-02-18 21:47 ` [PATCH 10/14] staging: lustre: ldlm: disconnect speedup James Simmons
2017-02-18 21:47 ` [PATCH 11/14] staging: lustre: ldlm: fix race of starting bl threads James Simmons
2017-02-18 21:47 ` [PATCH 12/14] staging: lustre: llog: change lgh_hdr_lock to mutex James Simmons
2017-02-24 16:58   ` Greg Kroah-Hartman
2017-02-18 21:47 ` [PATCH 13/14] staging: lustre: llog: limit file size of plain logs James Simmons
2017-02-24 16:59   ` Greg Kroah-Hartman
2017-02-25  3:50     ` Oleg Drokin
2017-02-25  4:04     ` Oleg Drokin
2017-02-18 21:47 ` [PATCH 14/14] staging: lustre: lprocfs: move lprocfs_stats_[un]lock to a source file 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=1487454435-4895-5-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jinshan.xiong@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /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

all inboxes | Powered by JetHome®