From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/9] GFS2: Fix allocation error bug with recursive rgrp glocking
Date: Mon, 4 Jun 2018 11:29:31 -0500 [thread overview]
Message-ID: <20180604162937.24134-4-rpeterso@redhat.com> (raw)
In-Reply-To: <20180604162937.24134-1-rpeterso@redhat.com>
From: Andreas Gruenbacher <agruenba@redhat.com>
Before this patch function gfs2_write_begin, upon discovering an
error, called gfs2_trim_blocks while the rgrp glock was still held.
That's because gfs2_inplace_release is not called until later.
This patch reorganizes the logic a bit so gfs2_inplace_release
is called to release the lock prior to the call to gfs2_trim_blocks,
thus preventing the glock recursion.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
fs/gfs2/aops.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index f58716567972..66e7172e0134 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -747,18 +747,21 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
put_page(page);
gfs2_trans_end(sdp);
- if (pos + len > ip->i_inode.i_size)
- gfs2_trim_blocks(&ip->i_inode);
- goto out_trans_fail;
+ if (alloc_required) {
+ gfs2_inplace_release(ip);
+ if (pos + len > ip->i_inode.i_size)
+ gfs2_trim_blocks(&ip->i_inode);
+ }
+ goto out_qunlock;
out_endtrans:
gfs2_trans_end(sdp);
out_trans_fail:
- if (alloc_required) {
+ if (alloc_required)
gfs2_inplace_release(ip);
out_qunlock:
+ if (alloc_required)
gfs2_quota_unlock(ip);
- }
out_unlock:
if (&ip->i_inode == sdp->sd_rindex) {
gfs2_glock_dq(&m_ip->i_gh);
--
2.17.1
next prev parent reply other threads:[~2018-06-04 16:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 16:29 [Cluster-devel] [PATCH 0/9] GFS2: Pre-pull patch posting (merge window) Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 1/9] gfs2: Remove sdp->sd_jheightsize Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 2/9] gfs2: Update find_metapath comment Bob Peterson
2018-06-04 16:29 ` Bob Peterson [this message]
2018-06-04 16:29 ` [Cluster-devel] [PATCH 4/9] GFS2: gfs2_free_extlen can return an extent that is too long Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 5/9] gfs2: hole_size improvement Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 6/9] gfs2: gfs2_stuffed_write_end cleanup Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 7/9] gfs2: Remove ordered write mode handling from gfs2_trans_add_data Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 8/9] gfs2: Iomap cleanups and improvements Bob Peterson
2018-06-04 16:29 ` [Cluster-devel] [PATCH 9/9] MAINTAINERS: Add Andreas Gruenbacher as a maintainer for gfs2 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=20180604162937.24134-4-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 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).