cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2: Fix gfs2_testbit to use clone bitmaps
Date: Tue, 10 Jul 2018 09:28:52 -0400 (EDT)	[thread overview]
Message-ID: <1944111320.49169682.1531229332655.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1281000737.49168822.1531229160359.JavaMail.zimbra@redhat.com>

Hi,

Function gfs2_testbit is called in three places. Two of those places,
gfs2_alloc_extent and gfs2_unaligned_extlen, should be using the
clone bitmaps, not the "real" bitmaps. Function gfs2_unaligned_extlen
is used by the block reservations scheme to determine the length of
an extent of free blocks. Before this patch, it wasn't using the
clone bitmap, which means soon-to-be-freed blocks will be treated
as free blocks for the purposes of an extent, and that's clearly
wrong.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 fs/gfs2/rgrp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 3821b3ab04fa..b248e83f5525 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -130,10 +130,12 @@ static inline void gfs2_setbit(const struct gfs2_rbm *rbm, bool do_clone,
 static inline u8 gfs2_testbit(const struct gfs2_rbm *rbm)
 {
 	struct gfs2_bitmap *bi = rbm_bi(rbm);
-	const u8 *buffer = bi->bi_bh->b_data + bi->bi_offset;
+	const u8 *buffer;
 	const u8 *byte;
 	unsigned int bit;
 
+	buffer = bi->bi_clone ? bi->bi_clone : bi->bi_bh->b_data;
+	buffer += bi->bi_offset;
 	byte = buffer + (rbm->offset / GFS2_NBBY);
 	bit = (rbm->offset % GFS2_NBBY) * GFS2_BIT_SIZE;
 



           reply	other threads:[~2018-07-10 13:28 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1281000737.49168822.1531229160359.JavaMail.zimbra@redhat.com>]

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=1944111320.49169682.1531229332655.JavaMail.zimbra@redhat.com \
    --to=rpeterso@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).