All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 01/29] GFS2: Prevent double brelse in gfs2_meta_indirect_buffer
Date: Sun,  3 Sep 2017 21:50:49 -0500	[thread overview]
Message-ID: <20170904025117.14737-2-rpeterso@redhat.com> (raw)
In-Reply-To: <20170904025117.14737-1-rpeterso@redhat.com>

Before this patch, problems reading in indirect buffers would send
an IO error back to the caller, and release the buffer_head with
brelse() in function gfs2_meta_indirect_buffer, however, it would
still return the address of the buffer_head it released. After the
error was discovered, function gfs2_block_map would call function
release_metapath to free all buffers. That checked:
if (mp->mp_bh[i] == NULL) but since the value was set after the
error, it was non-zero, so brelse was called a second time. This
resulted in the following error:

kernel: WARNING: at fs/buffer.c:1224 __brelse+0x3a/0x40() (Tainted: G        W  -- ------------   )
kernel: Hardware name: RHEV Hypervisor
kernel: VFS: brelse: Trying to free free buffer

This patch changes gfs2_meta_indirect_buffer so it only sets
the buffer_head pointer in cases where it isn't released.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
---
 fs/gfs2/meta_io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index fabe1614f879..4da7745c890a 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -419,8 +419,9 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
 	if (ret == 0 && gfs2_metatype_check(sdp, bh, mtype)) {
 		brelse(bh);
 		ret = -EIO;
+	} else {
+		*bhp = bh;
 	}
-	*bhp = bh;
 	return ret;
 }
 
-- 
2.13.5



  reply	other threads:[~2017-09-04  2:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04  2:50 [Cluster-devel] [PATCH 00/29] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2017-09-04  2:50 ` Bob Peterson [this message]
2017-09-04  2:50 ` [Cluster-devel] [PATCH 02/29] gfs2: Lock holder cleanup (fixup) Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 03/29] gfs2: Don't clear SGID when inheriting ACLs Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 04/29] gfs2: Fixup to "Get rid of flush_delayed_work in gfs2_evict_inode" Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 05/29] GFS2: fix code parameter error in inode_go_lock Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 06/29] gfs2: add flag REQ_PRIO for metadata I/O Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 07/29] GFS2: Introduce helper for clearing gl_object Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 08/29] GFS2: Set gl_object in inode lookup only after block type check Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 09/29] GFS2: Clear gl_object if gfs2_create_inode fails Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 10/29] GFS2: Clear gl_object when deleting an inode in gfs2_delete_inode Bob Peterson
2017-09-04  2:50 ` [Cluster-devel] [PATCH 11/29] GFS2: Don't bother trying to add rgrps to the lru list Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 12/29] GFS2: Don't waste time locking lru_lock for non-lru glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 13/29] GFS2: Delete debugfs files only after we evict the glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 14/29] gfs2: Fix trivial typos Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 15/29] gfs2: gfs2_glock_get: Wait on freeing glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 16/29] gfs2: Get rid of gfs2_set_nlink Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 17/29] gfs2: gfs2_evict_inode: Put glocks asynchronously Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 18/29] gfs2: Defer deleting inodes under memory pressure Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 19/29] gfs2: Clean up waiting on glocks Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 20/29] gfs2: forcibly flush ail to relieve memory pressure Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 21/29] gfs2: fix slab corruption during mounting and umounting gfs file system Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 22/29] GFS2: Withdraw for IO errors writing to the journal or statfs Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 23/29] gfs2: Silence gcc format-truncation warning Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 24/29] GFS2: Fix up some sparse warnings Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 25/29] GFS2: Fix gl_object warnings Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 26/29] gfs2: constify rhashtable_params Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 27/29] GFS2: Fix non-recursive truncate bug Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 28/29] gfs2: don't return ENODATA in __gfs2_xattr_set unless replacing Bob Peterson
2017-09-04  2:51 ` [Cluster-devel] [PATCH 29/29] gfs2: preserve i_mode if __gfs2_set_acl() fails Bob Peterson

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=20170904025117.14737-2-rpeterso@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.