cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 01/11] gfs2: Always check the result of gfs2_rbm_from_block
Date: Fri,  5 Oct 2018 21:18:44 +0200	[thread overview]
Message-ID: <20181005191854.2566-2-agruenba@redhat.com> (raw)
In-Reply-To: <20181005191854.2566-1-agruenba@redhat.com>

When gfs2_rbm_from_block fails, the rbm it returns is undefined, so we
always want to make sure gfs2_rbm_from_block has succeeded before
looking at the rbm.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/rgrp.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index fc181c81cca2..c9caddc2627c 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2227,7 +2227,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
 		return NULL;
 	}
 
-	gfs2_rbm_from_block(&rbm, bstart);
+	BUG_ON(gfs2_rbm_from_block(&rbm, bstart));
 	while (blen--) {
 		bi = rbm_bi(&rbm);
 		if (bi != bi_prev) {
@@ -2360,7 +2360,7 @@ static void gfs2_set_alloc_start(struct gfs2_rbm *rbm,
 	else
 		goal = rbm->rgd->rd_last_alloc + rbm->rgd->rd_data0;
 
-	gfs2_rbm_from_block(rbm, goal);
+	BUG_ON(gfs2_rbm_from_block(rbm, goal));
 }
 
 /**
@@ -2569,7 +2569,8 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type)
 
 	rbm.rgd = rgd;
 	error = gfs2_rbm_from_block(&rbm, no_addr);
-	WARN_ON_ONCE(error != 0);
+	if (WARN_ON_ONCE(error))
+		goto fail;
 
 	if (gfs2_testbit(&rbm, false) != type)
 		error = -ESTALE;
-- 
2.17.1



  reply	other threads:[~2018-10-05 19:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 19:18 [Cluster-devel] [PATCH 00/11] gfs2: Prepare for resource group glock sharing Andreas Gruenbacher
2018-10-05 19:18 ` Andreas Gruenbacher [this message]
2018-10-08 10:12   ` [Cluster-devel] [PATCH 01/11] gfs2: Always check the result of gfs2_rbm_from_block Steven Whitehouse
2018-10-05 19:18 ` [Cluster-devel] [PATCH 02/11] gfs2: Move rs_{sizehint, rgd_gh} fields into the inode Andreas Gruenbacher
2018-10-08 10:34   ` Steven Whitehouse
2018-10-05 19:18 ` [Cluster-devel] [PATCH 03/11] gfs2: Remove unused RGRP_RSRV_MINBYTES definition Andreas Gruenbacher
2018-10-05 19:18 ` [Cluster-devel] [PATCH 04/11] gfs2: Rename bitmap.bi_{len => bytes} Andreas Gruenbacher
2018-10-05 19:18 ` [Cluster-devel] [PATCH 05/11] gfs2: Fix some minor typos Andreas Gruenbacher
2018-10-05 19:18 ` [Cluster-devel] [PATCH 06/11] gfs2: Only use struct gfs2_rbm for bitmap manipulations Andreas Gruenbacher
2018-10-08 10:39   ` Steven Whitehouse
2018-10-05 19:18 ` [Cluster-devel] [PATCH 07/11] gfs2: Fix marking bitmaps non-full Andreas Gruenbacher
2018-10-08 10:23   ` Steven Whitehouse
2018-10-05 19:18 ` [Cluster-devel] [PATCH 08/11] gfs2: Add per-reservation reserved block accounting Andreas Gruenbacher
2018-10-05 19:18 ` [Cluster-devel] [PATCH 09/11] gfs2: Remove unnecessary gfs2_rlist_alloc parameter Andreas Gruenbacher
2018-10-05 19:18 ` [Cluster-devel] [PATCH 10/11] gfs2: Pass resource group to rgblk_free Andreas Gruenbacher
2018-10-08 10:28   ` Steven Whitehouse
2018-10-05 19:18 ` [Cluster-devel] [PATCH 11/11] gfs2: Add local resource group locking Andreas Gruenbacher
2018-10-08 10:33   ` Steven Whitehouse
2018-10-08 12:56     ` Andreas Gruenbacher

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=20181005191854.2566-2-agruenba@redhat.com \
    --to=agruenba@redhat.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;
as well as URLs for NNTP newsgroup(s).