From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 03/12] gfs2: Clean up trunc_start error path
Date: Mon, 8 Jan 2018 15:12:28 -0500 (EST) [thread overview]
Message-ID: <1732078713.4168841.1515442348230.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20171222143507.26680-4-agruenba@redhat.com>
----- Original Message -----
| Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
| ---
| fs/gfs2/bmap.c | 15 +++++----------
| 1 file changed, 5 insertions(+), 10 deletions(-)
|
| diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
| index 8b993e4d80b2..0ad6d812c78b 100644
| --- a/fs/gfs2/bmap.c
| +++ b/fs/gfs2/bmap.c
| @@ -1022,7 +1022,7 @@ static int trunc_start(struct inode *inode, u64
| oldsize, u64 newsize)
| struct gfs2_inode *ip = GFS2_I(inode);
| struct gfs2_sbd *sdp = GFS2_SB(inode);
| struct address_space *mapping = inode->i_mapping;
| - struct buffer_head *dibh;
| + struct buffer_head *dibh = NULL;
| int journaled = gfs2_is_jdata(ip);
| int error;
|
| @@ -1045,7 +1045,7 @@ static int trunc_start(struct inode *inode, u64
| oldsize, u64 newsize)
| if (newsize & (u64)(sdp->sd_sb.sb_bsize - 1)) {
| error = gfs2_block_truncate_page(mapping, newsize);
| if (error)
| - goto out_brelse;
| + goto out;
| }
| ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
| }
| @@ -1059,15 +1059,10 @@ static int trunc_start(struct inode *inode, u64
| oldsize, u64 newsize)
| else
| truncate_pagecache(inode, newsize);
|
| - if (error) {
| - brelse(dibh);
| - return error;
| - }
| -
| -out_brelse:
| - brelse(dibh);
| out:
| - gfs2_trans_end(sdp);
| + brelse(dibh);
| + if (current->journal_info)
| + gfs2_trans_end(sdp);
| return error;
| }
Hi,
This isn't quite right.
error = gfs2_meta_inode_buffer(ip, &dibh);
if (error)
goto out;
...
out:
brelse(dibh);
If this returns an error, we'll do double brelse in out.
If gfs2_meta_inode_buffer returns an error, it has released the
buffer_head already.
Regards,
Bob Peterson
Red Hat File Systems
next prev parent reply other threads:[~2018-01-08 20:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-22 14:34 [Cluster-devel] [PATCH 00/12] gfs2: punch hole Andreas Gruenbacher
2017-12-22 14:34 ` [Cluster-devel] [PATCH 01/12] gfs2: Add gfs2_blk2rgrpd comment and fix incorrect use Andreas Gruenbacher
2017-12-22 14:34 ` [Cluster-devel] [PATCH 02/12] gfs2: Remove pointless BUG_ON Andreas Gruenbacher
2017-12-22 14:34 ` [Cluster-devel] [PATCH 03/12] gfs2: Clean up trunc_start error path Andreas Gruenbacher
2018-01-08 20:12 ` Bob Peterson [this message]
2018-01-08 20:50 ` Bob Peterson
2017-12-22 14:34 ` [Cluster-devel] [PATCH 04/12] gfs2: truncate: Remove unnecessary oldsize parameters Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 05/12] gfs2: Remove minor gfs2_journaled_truncate inefficiencies Andreas Gruenbacher
2018-01-09 13:53 ` Bob Peterson
2018-01-09 14:21 ` Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 06/12] gfs2: Clean up {lookup, fillup}_metapath Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 07/12] gfs2: Fix metadata read-ahead during truncate Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 08/12] gfs2: Improve non-recursive delete algorithm Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 09/12] Turn gfs2_block_truncate_page into gfs2_block_zero_range Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 10/12] gfs2: Generalize truncate code Andreas Gruenbacher
2018-01-09 15:45 ` Bob Peterson
2018-01-09 17:14 ` Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 11/12] gfs2: Turn trunc_dealloc into punch_hole Andreas Gruenbacher
2018-01-12 17:38 ` Andreas Gruenbacher
2017-12-22 14:35 ` [Cluster-devel] [PATCH 12/12] gfs2: Implement fallocate(FALLOC_FL_PUNCH_HOLE) Andreas Gruenbacher
2018-01-16 17:51 ` [Cluster-devel] [PATCH 00/12] gfs2: punch hole 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=1732078713.4168841.1515442348230.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 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.