From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Wed, 30 May 2018 15:14:31 -0400 (EDT) Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Fix allocation error bug with recursive rgrp glocking In-Reply-To: <97915428.38585535.1527707643430.JavaMail.zimbra@redhat.com> Message-ID: <492648779.38585592.1527707671394.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, 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: Bob Peterson --- fs/gfs2/aops.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index f58716567972..629e614b324c 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c @@ -746,16 +746,13 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping, unlock_page(page); 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; - out_endtrans: gfs2_trans_end(sdp); out_trans_fail: if (alloc_required) { gfs2_inplace_release(ip); + if (pos + len > ip->i_inode.i_size) + gfs2_trim_blocks(&ip->i_inode); out_qunlock: gfs2_quota_unlock(ip); }